diff --git a/.container/Dockerfile b/.container/Dockerfile
index dba46a1..d055697 100644
--- a/.container/Dockerfile
+++ b/.container/Dockerfile
@@ -76,8 +76,6 @@ COPY assets/ ./assets/
COPY README.md .
COPY README_zh.md .
-# 设置环境变量文件 | Set environment variables file
-COPY owl/.env_template ./owl/.env
# 创建启动脚本 | Create startup script
RUN echo '#!/bin/bash\nxvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" python "$@"' > /usr/local/bin/xvfb-python && \
@@ -93,7 +91,10 @@ WORKDIR /app/owl
# 设置适当的权限 | Set appropriate permissions
RUN chown -R owl:owl /app
RUN mkdir -p /root/.cache && chown -R owl:owl /root/.cache
+RUN chmod 644 /app/owl/.env
+
+USER owl
# 切换到非root用户 | Switch to non-root user
# 注意:如果需要访问/dev/shm,可能仍需要root用户 | Note: If you need to access /dev/shm, you may still need root user
# USER owl
diff --git a/.container/build_docker.bat b/.container/build_docker.bat
index 40e6b80..6efb01b 100644
--- a/.container/build_docker.bat
+++ b/.container/build_docker.bat
@@ -1,14 +1,18 @@
@echo off
+chcp 65001 >nul
setlocal enabledelayedexpansion
-echo 在Windows上构建Docker镜像... | Building Docker image on Windows...
+echo 在Windows上构建Docker镜像...
+echo Building Docker image on Windows...
-REM 设置配置变量 | Set configuration variables
+REM 设置配置变量
+REM Set configuration variables
set CACHE_DIR=.docker-cache\pip
set BUILD_ARGS=--build-arg BUILDKIT_INLINE_CACHE=1
set COMPOSE_FILE=docker-compose.yml
-REM 解析命令行参数 | Parse command line arguments
+REM 解析命令行参数
+REM Parse command line arguments
set CLEAN_CACHE=0
set REBUILD=0
set SERVICE=
@@ -32,80 +36,106 @@ if /i "%~1"=="--service" (
goto :parse_args
)
if /i "%~1"=="--help" (
- echo 用法 | Usage: build_docker.bat [选项 | options]
- echo 选项 | Options:
- echo --clean 清理缓存目录 | Clean cache directory
- echo --rebuild 强制重新构建镜像 | Force rebuild image
- echo --service 指定要构建的服务名称 | Specify service name to build
- echo --help 显示此帮助信息 | Show this help message
+ echo 用法: build_docker.bat [选项]
+ echo Usage: build_docker.bat [options]
+ echo 选项:
+ echo Options:
+ echo --clean 清理缓存目录
+ echo --clean Clean cache directory
+ echo --rebuild 强制重新构建镜像
+ echo --rebuild Force rebuild image
+ echo --service 指定要构建的服务名称
+ echo --service Specify service name to build
+ echo --help 显示此帮助信息
+ echo --help Show this help message
exit /b 0
)
shift
goto :parse_args
:end_parse_args
-REM 检查Docker是否安装 | Check if Docker is installed
+REM 检查Docker是否安装
+REM Check if Docker is installed
where docker >nul 2>nul
if %ERRORLEVEL% NEQ 0 (
- echo 错误 | Error: Docker未安装 | Docker not installed
- echo 请先安装Docker Desktop | Please install Docker Desktop first: https://docs.docker.com/desktop/install/windows-install/
+ echo 错误: Docker未安装
+ echo Error: Docker not installed
+ echo 请先安装Docker Desktop
+ echo Please install Docker Desktop first: https://docs.docker.com/desktop/install/windows-install/
pause
exit /b 1
)
-REM 检查Docker是否运行 | Check if Docker is running
+REM 检查Docker是否运行
+REM Check if Docker is running
docker info >nul 2>nul
if %ERRORLEVEL% NEQ 0 (
- echo 错误 | Error: Docker未运行 | Docker not running
- echo 请启动Docker Desktop应用程序 | Please start Docker Desktop application
+ echo 错误: Docker未运行
+ echo Error: Docker not running
+ echo 请启动Docker Desktop应用程序
+ echo Please start Docker Desktop application
pause
exit /b 1
)
-REM 检查docker-compose.yml文件是否存在 | Check if docker-compose.yml file exists
+REM 检查docker-compose.yml文件是否存在
+REM Check if docker-compose.yml file exists
if not exist "%COMPOSE_FILE%" (
- echo 错误 | Error: 未找到%COMPOSE_FILE%文件 | %COMPOSE_FILE% file not found
- echo 请确保在正确的目录中运行此脚本 | Please make sure you are running this script in the correct directory
+ echo 错误: 未找到%COMPOSE_FILE%文件
+ echo Error: %COMPOSE_FILE% file not found
+ echo 请确保在正确的目录中运行此脚本
+ echo Please make sure you are running this script in the correct directory
pause
exit /b 1
)
-REM 检查Docker Compose命令 | Check Docker Compose command
+REM 检查Docker Compose命令
+REM Check Docker Compose command
where docker-compose >nul 2>nul
if %ERRORLEVEL% EQU 0 (
set COMPOSE_CMD=docker-compose
) else (
- echo 尝试使用新的docker compose命令... | Trying to use new docker compose command...
+ echo 尝试使用新的docker compose命令...
+ echo Trying to use new docker compose command...
docker compose version >nul 2>nul
if %ERRORLEVEL% EQU 0 (
set COMPOSE_CMD=docker compose
) else (
- echo 错误 | Error: 未找到Docker Compose命令 | Docker Compose command not found
- echo 请确保Docker Desktop已正确安装 | Please make sure Docker Desktop is properly installed
+ echo 错误: 未找到Docker Compose命令
+ echo Error: Docker Compose command not found
+ echo 请确保Docker Desktop已正确安装
+ echo Please make sure Docker Desktop is properly installed
pause
exit /b 1
)
)
-REM 设置Docker BuildKit环境变量 | Set Docker BuildKit environment variables
+REM 设置Docker BuildKit环境变量
+REM Set Docker BuildKit environment variables
set DOCKER_BUILDKIT=1
set COMPOSE_DOCKER_CLI_BUILD=1
-echo 启用Docker BuildKit加速构建... | Enabling Docker BuildKit to accelerate build...
+echo 启用Docker BuildKit加速构建...
+echo Enabling Docker BuildKit to accelerate build...
-REM 清理缓存(如果指定) | Clean cache (if specified)
+REM 清理缓存(如果指定)
+REM Clean cache (if specified)
if %CLEAN_CACHE% EQU 1 (
- echo 清理缓存目录... | Cleaning cache directory...
+ echo 清理缓存目录...
+ echo Cleaning cache directory...
if exist "%CACHE_DIR%" rmdir /s /q "%CACHE_DIR%"
)
-REM 创建缓存目录 | Create cache directory
+REM 创建缓存目录
+REM Create cache directory
if not exist "%CACHE_DIR%" (
- echo 创建缓存目录... | Creating cache directory...
+ echo 创建缓存目录...
+ echo Creating cache directory...
mkdir "%CACHE_DIR%"
)
-REM 添加构建时间标记 | Add build time tag
+REM 添加构建时间标记
+REM Add build time tag
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "YEAR=%dt:~0,4%"
set "MONTH=%dt:~4,2%"
@@ -115,33 +145,42 @@ set "MINUTE=%dt:~10,2%"
set "BUILD_TIME=%YEAR%%MONTH%%DAY%_%HOUR%%MINUTE%"
set "BUILD_ARGS=%BUILD_ARGS% --build-arg BUILD_TIME=%BUILD_TIME%"
-REM 构建Docker镜像 | Build Docker image
-echo 开始构建Docker镜像... | Starting to build Docker image...
+REM 构建Docker镜像
+REM Build Docker image
+echo 开始构建Docker镜像...
+echo Starting to build Docker image...
if "%SERVICE%"=="" (
if %REBUILD% EQU 1 (
- echo 强制重新构建所有服务... | Force rebuilding all services...
+ echo 强制重新构建所有服务...
+ echo Force rebuilding all services...
%COMPOSE_CMD% build --no-cache %BUILD_ARGS%
) else (
%COMPOSE_CMD% build %BUILD_ARGS%
)
) else (
if %REBUILD% EQU 1 (
- echo 强制重新构建服务 %SERVICE%... | Force rebuilding service %SERVICE%...
+ echo 强制重新构建服务 %SERVICE%...
+ echo Force rebuilding service %SERVICE%...
%COMPOSE_CMD% build --no-cache %BUILD_ARGS% %SERVICE%
) else (
- echo 构建服务 %SERVICE%... | Building service %SERVICE%...
+ echo 构建服务 %SERVICE%...
+ echo Building service %SERVICE%...
%COMPOSE_CMD% build %BUILD_ARGS% %SERVICE%
)
)
if %ERRORLEVEL% EQU 0 (
- echo Docker镜像构建成功! | Docker image build successful!
- echo 构建时间 | Build time: %BUILD_TIME%
- echo 可以使用以下命令启动容器: | You can use the following command to start the container:
+ echo Docker镜像构建成功!
+ echo Docker image build successful!
+ echo 构建时间: %BUILD_TIME%
+ echo Build time: %BUILD_TIME%
+ echo 可以使用以下命令启动容器:
+ echo You can use the following command to start the container:
echo %COMPOSE_CMD% up -d
) else (
- echo Docker镜像构建失败,请检查错误信息。 | Docker image build failed, please check error messages.
+ echo Docker镜像构建失败,请检查错误信息。
+ echo Docker image build failed, please check error messages.
)
pause
\ No newline at end of file
diff --git a/.container/check_docker.bat b/.container/check_docker.bat
index fd061a3..1f7665e 100644
--- a/.container/check_docker.bat
+++ b/.container/check_docker.bat
@@ -1,62 +1,88 @@
@echo off
-echo 检查Docker环境... | Checking Docker environment...
+chcp 65001 >nul
+echo 检查Docker环境...
+echo Checking Docker environment...
-REM 检查Docker是否安装 | Check if Docker is installed
+REM 检查Docker是否安装
+REM Check if Docker is installed
where docker >nul 2>nul
if %ERRORLEVEL% NEQ 0 (
- echo 错误 | Error: Docker未安装 | Docker not installed
- echo 在Windows上安装Docker的方法 | How to install Docker on Windows:
- echo 1. 访问 | Visit https://docs.docker.com/desktop/install/windows-install/ 下载Docker Desktop | to download Docker Desktop
- echo 2. 安装并启动Docker Desktop | Install and start Docker Desktop
+ echo 错误: Docker未安装
+ echo Error: Docker not installed
+ echo 在Windows上安装Docker的方法:
+ echo How to install Docker on Windows:
+ echo 1. 访问 https://docs.docker.com/desktop/install/windows-install/ 下载Docker Desktop
+ echo 1. Visit https://docs.docker.com/desktop/install/windows-install/ to download Docker Desktop
+ echo 2. 安装并启动Docker Desktop
+ echo 2. Install and start Docker Desktop
pause
exit /b 1
)
-echo Docker已安装 | Docker is installed
+echo Docker已安装
+echo Docker is installed
-REM 检查Docker Compose是否安装 | Check if Docker Compose is installed
+REM 检查Docker Compose是否安装
+REM Check if Docker Compose is installed
where docker-compose >nul 2>nul
if %ERRORLEVEL% NEQ 0 (
- echo 警告 | Warning: Docker-Compose未找到,尝试使用新的docker compose命令 | Docker-Compose not found, trying to use new docker compose command
+ echo 警告: Docker-Compose未找到,尝试使用新的docker compose命令
+ echo Warning: Docker-Compose not found, trying to use new docker compose command
docker compose version >nul 2>nul
if %ERRORLEVEL% NEQ 0 (
- echo 错误 | Error: Docker Compose未安装 | Docker Compose not installed
- echo Docker Desktop for Windows应该已包含Docker Compose | Docker Desktop for Windows should already include Docker Compose
- echo 请确保Docker Desktop已正确安装 | Please make sure Docker Desktop is properly installed
+ echo 错误: Docker Compose未安装
+ echo Error: Docker Compose not installed
+ echo Docker Desktop for Windows应该已包含Docker Compose
+ echo Docker Desktop for Windows should already include Docker Compose
+ echo 请确保Docker Desktop已正确安装
+ echo Please make sure Docker Desktop is properly installed
pause
exit /b 1
) else (
- echo 使用新的docker compose命令 | Using new docker compose command
+ echo 使用新的docker compose命令
+ echo Using new docker compose command
set COMPOSE_CMD=docker compose
)
) else (
- echo Docker-Compose已安装 | Docker-Compose is installed
+ echo Docker-Compose已安装
+ echo Docker-Compose is installed
set COMPOSE_CMD=docker-compose
)
-REM 检查Docker是否正在运行 | Check if Docker is running
+REM 检查Docker是否正在运行
+REM Check if Docker is running
docker info >nul 2>nul
if %ERRORLEVEL% NEQ 0 (
- echo 错误 | Error: Docker未运行 | Docker not running
- echo 请启动Docker Desktop应用程序 | Please start Docker Desktop application
+ echo 错误: Docker未运行
+ echo Error: Docker not running
+ echo 请启动Docker Desktop应用程序
+ echo Please start Docker Desktop application
pause
exit /b 1
)
-echo Docker正在运行 | Docker is running
+echo Docker正在运行
+echo Docker is running
-REM 检查是否有.env文件 | Check if .env file exists
-if not exist "owl\.env" (
- echo 警告 | Warning: 未找到owl\.env文件 | owl\.env file not found
- echo 请运行以下命令创建环境变量文件 | Please run the following command to create environment variable file:
- echo copy owl\.env_template owl\.env
- echo 然后编辑owl\.env文件,填写必要的API密钥 | Then edit owl\.env file and fill in necessary API keys
+REM 检查是否有.env文件
+REM Check if .env file exists
+if not exist "..\owl\.env" (
+ echo 警告: 未找到owl\.env文件
+ echo Warning: owl\.env file not found
+ echo 请运行以下命令创建环境变量文件
+ echo Please run the following command to create environment variable file:
+ echo copy ..\owl\.env_template ..\owl\.env
+ echo 然后编辑owl\.env文件,填写必要的API密钥
+ echo Then edit owl\.env file and fill in necessary API keys
) else (
- echo 环境变量文件已存在 | Environment variable file exists
+ echo 环境变量文件已存在
+ echo Environment variable file exists
)
-echo 所有检查完成,您的系统已准备好构建和运行OWL项目的Docker容器 | All checks completed, your system is ready to build and run OWL project Docker container
-echo 请运行以下命令构建Docker镜像 | Please run the following command to build Docker image:
+echo 所有检查完成,您的系统已准备好构建和运行OWL项目的Docker容器
+echo All checks completed, your system is ready to build and run OWL project Docker container
+echo 请运行以下命令构建Docker镜像:
+echo Please run the following command to build Docker image:
echo %COMPOSE_CMD% build
pause
\ No newline at end of file
diff --git a/.container/docker-compose.yml b/.container/docker-compose.yml
index 46b88d4..8b2969f 100644
--- a/.container/docker-compose.yml
+++ b/.container/docker-compose.yml
@@ -11,7 +11,7 @@ services:
- python:3.10-slim
volumes:
# 挂载.env文件,方便配置API密钥 | Mount .env file for easy API key configuration
- - ./owl/.env:/app/owl/.env
+ - ../owl/.env:/app/owl/.env
# 可选:挂载数据目录 | Optional: Mount data directory
- ./data:/app/data
# 挂载缓存目录,避免重复下载 | Mount cache directories to avoid repeated downloads
diff --git a/.container/run_in_docker.bat b/.container/run_in_docker.bat
index 337eb64..355a728 100644
--- a/.container/run_in_docker.bat
+++ b/.container/run_in_docker.bat
@@ -1,116 +1,178 @@
@echo off
+chcp 65001 >nul
setlocal enabledelayedexpansion
-REM 定义配置变量 | Define configuration variables
+REM 定义配置变量
+REM Define configuration variables
set SERVICE_NAME=owl
set PYTHON_CMD=xvfb-python
set MAX_WAIT_SECONDS=60
set CHECK_INTERVAL_SECONDS=2
-REM 检查参数 | Check parameters
+REM 检查参数
+REM Check parameters
if "%~1"=="" (
- echo 用法 | Usage: run_in_docker.bat [脚本名称 | script name] "你的问题 | your question"
- echo 例如 | Example: run_in_docker.bat run.py "什么是人工智能? | What is artificial intelligence?"
- echo 或者 | Or: run_in_docker.bat run_deepseek_example.py "什么是人工智能? | What is artificial intelligence?"
- echo 如果不指定脚本名称,默认使用 run.py | If script name is not specified, run.py will be used by default
+ echo 用法: run_in_docker.bat [脚本名称] "你的问题"
+ echo Usage: run_in_docker.bat [script name] "your question"
+ echo 例如: run_in_docker.bat run.py "什么是人工智能?"
+ echo Example: run_in_docker.bat run.py "What is artificial intelligence?"
+ echo 或者: run_in_docker.bat run_deepseek_example.py "什么是人工智能?"
+ echo Or: run_in_docker.bat run_deepseek_example.py "What is artificial intelligence?"
+ echo 如果不指定脚本名称,默认使用 run.py
+ echo If script name is not specified, run.py will be used by default
exit /b 1
)
-REM 判断第一个参数是否是脚本名称 | Determine if the first parameter is a script name
+REM 判断第一个参数是否是脚本名称
+REM Determine if the first parameter is a script name
set SCRIPT_NAME=%~1
set QUERY=%~2
if "!SCRIPT_NAME:~-3!"==".py" (
- REM 如果提供了第二个参数,则为查询内容 | If a second parameter is provided, it's the query content
+ REM 如果提供了第二个参数,则为查询内容
+ REM If a second parameter is provided, it's the query content
if "!QUERY!"=="" (
- echo 请提供查询参数,例如 | Please provide query parameter, e.g.: run_in_docker.bat !SCRIPT_NAME! "你的问题 | your question"
+ echo 请提供查询参数,例如: run_in_docker.bat !SCRIPT_NAME! "你的问题"
+ echo Please provide query parameter, e.g.: run_in_docker.bat !SCRIPT_NAME! "your question"
exit /b 1
)
) else (
- REM 如果第一个参数不是脚本名称,则默认使用 run.py | If the first parameter is not a script name, use run.py by default
+ REM 如果第一个参数不是脚本名称,则默认使用 run.py
+ REM If the first parameter is not a script name, use run.py by default
set QUERY=!SCRIPT_NAME!
set SCRIPT_NAME=run.py
)
-REM 检查脚本是否存在 | Check if the script exists
-if not exist "owl\!SCRIPT_NAME!" (
- echo 错误 | Error: 脚本 | Script 'owl\!SCRIPT_NAME!' 不存在 | does not exist
- echo 可用的脚本有 | Available scripts:
- dir /b owl\*.py | findstr /v "__"
+REM 检查脚本是否存在
+REM Check if the script exists
+if not exist "..\owl\!SCRIPT_NAME!" (
+ echo 错误: 脚本 '..\owl\!SCRIPT_NAME!' 不存在
+ echo Error: Script '..\owl\!SCRIPT_NAME!' does not exist
+ echo 可用的脚本有:
+ echo Available scripts:
+ dir /b ..\owl\*.py | findstr /v "__"
exit /b 1
)
-echo 使用脚本 | Using script: !SCRIPT_NAME!
-echo 查询内容 | Query content: !QUERY!
+echo 使用脚本: !SCRIPT_NAME!
+echo Using script: !SCRIPT_NAME!
+echo 查询内容: !QUERY!
+echo Query content: !QUERY!
-REM 从docker-compose.yml获取服务名称(如果文件存在) | Get service name from docker-compose.yml (if file exists)
-if exist ".container\docker-compose.yml" (
- for /f "tokens=*" %%a in ('findstr /r "^ [a-zA-Z0-9_-]*:" .container\docker-compose.yml') do (
+REM 优先检查新版 docker compose 命令
+REM Check new docker compose command first
+docker compose version >nul 2>nul
+if %ERRORLEVEL% EQU 0 (
+ echo 使用新版 docker compose 命令
+ echo Using new docker compose command
+ set COMPOSE_CMD=docker compose
+) else (
+ REM 如果新版不可用,检查旧版 docker-compose
+ REM If new version is not available, check old docker-compose
+ where docker-compose >nul 2>nul
+ if %ERRORLEVEL% EQU 0 (
+ echo 使用旧版 docker-compose 命令
+ echo Using old docker-compose command
+ set COMPOSE_CMD=docker-compose
+ ) else (
+ echo 错误: Docker Compose 未安装
+ echo Error: Docker Compose not installed
+ echo 请确保 Docker Desktop 已正确安装
+ echo Please make sure Docker Desktop is properly installed
+ pause
+ exit /b 1
+ )
+)
+
+REM 从docker-compose.yml获取服务名称(如果文件存在)
+REM Get service name from docker-compose.yml (if file exists)
+if exist "docker-compose.yml" (
+ for /f "tokens=*" %%a in ('findstr /r "^ [a-zA-Z0-9_-]*:" docker-compose.yml') do (
set line=%%a
set service=!line:~2,-1!
if not "!service!"=="" (
- REM 使用第一个找到的服务名称 | Use the first service name found
+ REM 使用第一个找到的服务名称
+ REM Use the first service name found
set SERVICE_NAME=!service!
- echo 从docker-compose.yml检测到服务名称 | Detected service name from docker-compose.yml: !SERVICE_NAME!
+ echo 从docker-compose.yml检测到服务名称: !SERVICE_NAME!
+ echo Detected service name from docker-compose.yml: !SERVICE_NAME!
goto :found_service
)
)
)
:found_service
-REM 确保Docker容器正在运行 | Ensure Docker container is running
-docker-compose ps | findstr "!SERVICE_NAME!.*Up" > nul
+REM 确保Docker容器正在运行
+REM Ensure Docker container is running
+%COMPOSE_CMD% ps | findstr "!SERVICE_NAME!.*Up" > nul
if errorlevel 1 (
- echo 启动Docker容器... | Starting Docker container...
- docker-compose up -d
+ echo 启动Docker容器...
+ echo Starting Docker container...
+ %COMPOSE_CMD% up -d
- REM 使用循环检查容器是否就绪 | Use loop to check if container is ready
- echo 等待容器启动... | Waiting for container to start...
+ REM 使用循环检查容器是否就绪
+ REM Use loop to check if container is ready
+ echo 等待容器启动...
+ echo Waiting for container to start...
set /a total_wait=0
:wait_loop
timeout /t !CHECK_INTERVAL_SECONDS! /nobreak > nul
set /a total_wait+=!CHECK_INTERVAL_SECONDS!
- docker-compose ps | findstr "!SERVICE_NAME!.*Up" > nul
+ %COMPOSE_CMD% ps | findstr "!SERVICE_NAME!.*Up" > nul
if errorlevel 1 (
if !total_wait! LSS !MAX_WAIT_SECONDS! (
- echo 容器尚未就绪,已等待!total_wait!秒,继续等待... | Container not ready yet, waited for !total_wait! seconds, continuing to wait...
+ echo 容器尚未就绪,已等待!total_wait!秒,继续等待...
+ echo Container not ready yet, waited for !total_wait! seconds, continuing to wait...
goto :wait_loop
) else (
- echo 错误 | Error:容器启动超时,已等待!MAX_WAIT_SECONDS!秒 | Container startup timeout, waited for !MAX_WAIT_SECONDS! seconds
- echo 请检查Docker容器状态 | Please check Docker container status:docker-compose ps
+ echo 错误:容器启动超时,已等待!MAX_WAIT_SECONDS!秒
+ echo Error: Container startup timeout, waited for !MAX_WAIT_SECONDS! seconds
+ echo 请检查Docker容器状态:%COMPOSE_CMD% ps
+ echo Please check Docker container status: %COMPOSE_CMD% ps
exit /b 1
)
) else (
- echo 容器已就绪,共等待了!total_wait!秒 | Container is ready, waited for !total_wait! seconds in total
+ echo 容器已就绪,共等待了!total_wait!秒
+ echo Container is ready, waited for !total_wait! seconds in total
)
)
-REM 检查容器中是否存在xvfb-python命令 | Check if xvfb-python command exists in container
-echo 检查容器中的命令... | Checking commands in container...
-docker-compose exec -T !SERVICE_NAME! which !PYTHON_CMD! > nul 2>&1
+REM 检查容器中是否存在xvfb-python命令
+REM Check if xvfb-python command exists in container
+echo 检查容器中的命令...
+echo Checking commands in container...
+%COMPOSE_CMD% exec -T !SERVICE_NAME! which !PYTHON_CMD! > nul 2>&1
if errorlevel 1 (
- echo 警告 | Warning:容器中未找到!PYTHON_CMD!命令,尝试使用python替代 | !PYTHON_CMD! command not found in container, trying to use python instead
+ echo 警告:容器中未找到!PYTHON_CMD!命令,尝试使用python替代
+ echo Warning: !PYTHON_CMD! command not found in container, trying to use python instead
set PYTHON_CMD=python
- REM 检查python命令是否存在 | Check if python command exists
- docker-compose exec -T !SERVICE_NAME! which python > nul 2>&1
+ REM 检查python命令是否存在
+ REM Check if python command exists
+ %COMPOSE_CMD% exec -T !SERVICE_NAME! which python > nul 2>&1
if errorlevel 1 (
- echo 错误 | Error:容器中未找到python命令 | python command not found in container
- echo 请检查容器配置 | Please check container configuration
+ echo 错误:容器中未找到python命令
+ echo Error: python command not found in container
+ echo 请检查容器配置
+ echo Please check container configuration
exit /b 1
)
)
-REM 在容器中运行指定的脚本,传递查询参数 | Run the specified script in container, passing query parameter
-echo 在Docker容器中使用!PYTHON_CMD!运行脚本... | Running script in Docker container using !PYTHON_CMD!...
-docker-compose exec -T !SERVICE_NAME! !PYTHON_CMD! !SCRIPT_NAME! "!QUERY!"
+REM 在容器中运行指定的脚本,传递查询参数
+REM Run the specified script in container, passing query parameter
+echo 在Docker容器中使用!PYTHON_CMD!运行脚本...
+echo Running script in Docker container using !PYTHON_CMD!...
+%COMPOSE_CMD% exec -T !SERVICE_NAME! !PYTHON_CMD! !SCRIPT_NAME! "!QUERY!"
if errorlevel 0 (
- echo 查询完成! | Query completed!
+ echo 查询完成!
+ echo Query completed!
) else (
- echo 查询执行失败,请检查错误信息。 | Query execution failed, please check error messages.
+ echo 查询执行失败,请检查错误信息。
+ echo Query execution failed, please check error messages.
)
pause
\ No newline at end of file
diff --git a/README.md b/README.md
index 61880ec..687f03f 100644
--- a/README.md
+++ b/README.md
@@ -71,25 +71,47 @@ Our vision is to revolutionize how AI agents collaborate to solve real-world tas
- [**Install Dependencies**](#install-dependencies)
- [**Setup Environment Variables**](#setup-environment-variables)
- [**Running with Docker**](#running-with-docker)
-
- [🚀 Quick Start](#-quick-start)
+- [🧰 Toolkits and Capabilities](#-toolkits-and-capabilities)
- [🌐 Web Interface](#-web-interface)
- [🧪 Experiments](#-experiments)
- [⏱️ Future Plans](#️-future-plans)
- [📄 License](#-license)
- [🖊️ Cite](#️-cite)
+- [🤝 Contributing](#-contributing)
- [🔥 Community](#-community)
- [❓ FAQ](#-faq)
+- [📚 Exploring CAMEL Dependency](#-exploring-camel-dependency)
- [⭐ Star History](#-star-history)
# 🔥 News
-- **[2025.03.07]**: We open-source the codebase of 🦉 OWL project.
+
+
+ 🌟🌟🌟 COMMUNITY CALL FOR USE CASES! 🌟🌟🌟
+
+
+ We're inviting the community to contribute innovative use cases for OWL!
+ The top ten submissions will receive special community gifts and recognition.
+
+
+ Learn More & Submit
+
+
+ Submission deadline: March 31, 2025
+
+
+
+- **[2025.03.12]**: Added Bocha search in SearchToolkit, integrated Volcano Engine model platform, and enhanced Azure and OpenAI Compatible models with structured output and tool calling.
+- **[2025.03.11]**: We added MCPToolkit, FileWriteToolkit, and TerminalToolkit to enhance OWL agents with MCP tool calling, file writing capabilities, and terminal command execution.
+- **[2025.03.09]**: We added a web-based user interface that makes it easier to interact with the system.
+- **[2025.03.07]**: We open-sourced the codebase of the 🦉 OWL project.
+- **[2025.03.03]**: OWL achieved the #1 position among open-source frameworks on the GAIA benchmark with a score of 58.18.
# 🎬 Demo Video
-https://private-user-images.githubusercontent.com/55657767/420211368-f29f477d-7eef-46da-8d7a-8f3bcf506da2.mp4
+https://github.com/user-attachments/assets/2a2a825d-39ea-45c5-9ba1-f9d58efbc372
https://private-user-images.githubusercontent.com/55657767/420212194-e813fc05-136a-485f-8df3-f10d9b4e63ec.mp4
@@ -104,6 +126,8 @@ https://private-user-images.githubusercontent.com/55657767/420212194-e813fc05-13
# 🛠️ Installation
+OWL supports multiple installation methods to fit your workflow preferences. Choose the option that works best for you.
+
## Option 1: Using uv (Recommended)
```bash
@@ -181,19 +205,45 @@ pip install -r requirements.txt
conda deactivate
```
-## **Setup Environment Variables**
+## **Setup Environment Variables**
-In the `owl/.env_template` file, you will find all the necessary API keys along with the websites where you can register for each service. To use these API services, follow these steps:
+OWL requires various API keys to interact with different services. The `owl/.env_template` file contains placeholders for all necessary API keys along with links to the services where you can register for them.
-1. *Copy and Rename*: Duplicate the `.env_template` file and rename the copy to `.env`.
-```bash
-cp owl/.env_template .env
-```
-2. *Fill in Your Keys*: Open the `.env` file and insert your API keys in the corresponding fields. (For the minimal example (`run_mini.py`), you only need to configure the LLM API key (e.g., OPENAI_API_KEY).)
-3. *For using more other models*: please refer to our CAMEL models docs:https://docs.camel-ai.org/key_modules/models.html#supported-model-platforms-in-camel
+### Option 1: Using a `.env` File (Recommended)
+
+1. **Copy and Rename the Template**:
+ ```bash
+ cd owl
+ cp .env_template .env
+ ```
+
+2. **Configure Your API Keys**:
+ Open the `.env` file in your preferred text editor and insert your API keys in the corresponding fields.
+
+ > **Note**: For the minimal example (`run_mini.py`), you only need to configure the LLM API key (e.g., `OPENAI_API_KEY`).
+
+### Option 2: Setting Environment Variables Directly
+
+Alternatively, you can set environment variables directly in your terminal:
+
+- **macOS/Linux (Bash/Zsh)**:
+ ```bash
+ export OPENAI_API_KEY="your-openai-api-key-here"
+ ```
+
+- **Windows (Command Prompt)**:
+ ```batch
+ set OPENAI_API_KEY="your-openai-api-key-here"
+ ```
+
+- **Windows (PowerShell)**:
+ ```powershell
+ $env:OPENAI_API_KEY = "your-openai-api-key-here"
+ ```
+
+> **Note**: Environment variables set directly in the terminal will only persist for the current session.
-> **Note**: For optimal performance, we strongly recommend using OpenAI models. Our experiments show that other models may result in significantly lower performance on complex tasks and benchmarks.
## **Running with Docker**
@@ -225,9 +275,7 @@ For more detailed Docker usage instructions, including cross-platform support, o
# 🚀 Quick Start
-
-
-Run the following demo case:
+After installation and setting up your environment variables, you can start using OWL right away:
```bash
python owl/run.py
@@ -235,17 +283,32 @@ python owl/run.py
## Running with Different Models
-OWL supports various LLM backends. You can use the following scripts to run with different models:
+### Model Requirements
+
+- **Tool Calling**: OWL requires models with robust tool calling capabilities to interact with various toolkits. Models must be able to understand tool descriptions, generate appropriate tool calls, and process tool outputs.
+
+- **Multimodal Understanding**: For tasks involving web interaction, image analysis, or video processing, models with multimodal capabilities are required to interpret visual content and context.
+
+#### Supported Models
+
+For information on configuring AI models, please refer to our [CAMEL models documentation](https://docs.camel-ai.org/key_modules/models.html#supported-model-platforms-in-camel).
+
+> **Note**: For optimal performance, we strongly recommend using OpenAI models (GPT-4 or later versions). Our experiments show that other models may result in significantly lower performance on complex tasks and benchmarks, especially those requiring advanced multi-modal understanding and tool use.
+
+OWL supports various LLM backends, though capabilities may vary depending on the model's tool calling and multimodal abilities. You can use the following scripts to run with different models:
```bash
# Run with Qwen model
-python owl/run_qwen.py
+python owl/run_qwen_zh.py
# Run with Deepseek model
-python owl/run_deepseek.py
+python owl/run_deepseek_zh.py
# Run with other OpenAI-compatible models
python owl/run_openai_compatiable_model.py
+
+# Run with Ollama
+python owl/run_ollama.py
```
For a simpler version that only requires an LLM API key, you can try our minimal example:
@@ -280,21 +343,92 @@ print(f"\033[94mAnswer: {answer}\033[0m")
OWL will then automatically invoke document-related tools to process the file and extract the answer.
-Example tasks you can try:
+### Example Tasks
+
+Here are some tasks you can try with OWL:
+
- "Find the latest stock price for Apple Inc."
- "Analyze the sentiment of recent tweets about climate change"
- "Help me debug this Python code: [your code here]"
- "Summarize the main points from this research paper: [paper URL]"
+- "Create a data visualization for this dataset: [dataset path]"
+
+# 🧰 Toolkits and Capabilities
+
+> **Important**: Effective use of toolkits requires models with strong tool calling capabilities. For multimodal toolkits (Web, Image, Video), models must also have multimodal understanding abilities.
+
+OWL supports various toolkits that can be customized by modifying the `tools` list in your script:
+
+```python
+# Configure toolkits
+tools = [
+ *WebToolkit(headless=False).get_tools(), # Browser automation
+ *VideoAnalysisToolkit(model=models["video"]).get_tools(),
+ *AudioAnalysisToolkit().get_tools(), # Requires OpenAI Key
+ *CodeExecutionToolkit(sandbox="subprocess").get_tools(),
+ *ImageAnalysisToolkit(model=models["image"]).get_tools(),
+ SearchToolkit().search_duckduckgo,
+ SearchToolkit().search_google, # Comment out if unavailable
+ SearchToolkit().search_wiki,
+ *ExcelToolkit().get_tools(),
+ *DocumentProcessingToolkit(model=models["document"]).get_tools(),
+ *FileWriteToolkit(output_dir="./").get_tools(),
+]
+```
+
+## Available Toolkits
+
+Key toolkits include:
+
+### Multimodal Toolkits (Require multimodal model capabilities)
+- **WebToolkit**: Browser automation for web interaction and navigation
+- **VideoAnalysisToolkit**: Video processing and content analysis
+- **ImageAnalysisToolkit**: Image analysis and interpretation
+
+### Text-Based Toolkits
+- **AudioAnalysisToolkit**: Audio processing (requires OpenAI API)
+- **CodeExecutionToolkit**: Python code execution and evaluation
+- **SearchToolkit**: Web searches (Google, DuckDuckGo, Wikipedia)
+- **DocumentProcessingToolkit**: Document parsing (PDF, DOCX, etc.)
+
+Additional specialized toolkits: ArxivToolkit, GitHubToolkit, GoogleMapsToolkit, MathToolkit, NetworkXToolkit, NotionToolkit, RedditToolkit, WeatherToolkit, and more. For a complete list, see the [CAMEL toolkits documentation](https://docs.camel-ai.org/key_modules/tools.html#built-in-toolkits).
+
+## Customizing Your Configuration
+
+To customize available tools:
+
+```python
+# 1. Import toolkits
+from camel.toolkits import WebToolkit, SearchToolkit, CodeExecutionToolkit
+
+# 2. Configure tools list
+tools = [
+ *WebToolkit(headless=True).get_tools(),
+ SearchToolkit().search_wiki,
+ *CodeExecutionToolkit(sandbox="subprocess").get_tools(),
+]
+
+# 3. Pass to assistant agent
+assistant_agent_kwargs = {"model": models["assistant"], "tools": tools}
+```
+
+Selecting only necessary toolkits optimizes performance and reduces resource usage.
# 🌐 Web Interface
-OWL now includes a web-based user interface that makes it easier to interact with the system. To start the web interface, run:
+OWL includes an intuitive web-based user interface that makes it easier to interact with the system.
+
+## Starting the Web UI
```bash
+# Start the Chinese version
+python run_app_zh.py
+
+# Start the English version
python run_app.py
```
-The web interface provides the following features:
+## Features
- **Easy Model Selection**: Choose between different models (OpenAI, Qwen, DeepSeek, etc.)
- **Environment Variable Management**: Configure your API keys and other settings directly from the UI
@@ -308,21 +442,25 @@ The web interface is built using Gradio and runs locally on your machine. No dat
To reproduce OWL's GAIA benchmark score of 58.18:
1. Switch to the `gaia58.18` branch:
-```bash
-git checkout gaia58.18
-```
+ ```bash
+ git checkout gaia58.18
+ ```
-1. Run the evaluation script:
-```bash
-python run_gaia_roleplaying.py
-```
+2. Run the evaluation script:
+ ```bash
+ python run_gaia_roleplaying.py
+ ```
+
+This will execute the same configuration that achieved our top-ranking performance on the GAIA benchmark.
# ⏱️ Future Plans
-- [ ] Write a technical blog post detailing our exploration and insights in multi-agent collaboration in real-world tasks.
-- [ ] Enhance the toolkit ecosystem with more specialized tools for domain-specific tasks.
-- [ ] Develop more sophisticated agent interaction patterns and communication protocols
+We're continuously working to improve OWL. Here's what's on our roadmap:
+- [ ] Write a technical blog post detailing our exploration and insights in multi-agent collaboration in real-world tasks
+- [ ] Enhance the toolkit ecosystem with more specialized tools for domain-specific tasks
+- [ ] Develop more sophisticated agent interaction patterns and communication protocols
+- [ ] Improve performance on complex multi-step reasoning tasks
# 📄 License
@@ -343,10 +481,27 @@ If you find this repo useful, please cite:
}
```
+# 🤝 Contributing
+
+We welcome contributions from the community! Here's how you can help:
+
+1. Read our [Contribution Guidelines](https://github.com/camel-ai/camel/blob/master/CONTRIBUTING.md)
+2. Check [open issues](https://github.com/camel-ai/camel/issues) or create new ones
+3. Submit pull requests with your improvements
+
+**Current Issues Open for Contribution:**
+- [#1770](https://github.com/camel-ai/camel/issues/1770)
+- [#1712](https://github.com/camel-ai/camel/issues/1712)
+- [#1537](https://github.com/camel-ai/camel/issues/1537)
+- [#1827](https://github.com/camel-ai/camel/issues/1827)
+
+To take on an issue, simply leave a comment stating your interest.
+
# 🔥 Community
+Join us ([*Discord*](https://discord.camel-ai.org/) or [*WeChat*](https://ghli.org/camel/wechat.png)) in pushing the boundaries of finding the scaling laws of agents.
+
Join us for further discussions!
-
-
+
# ❓ FAQ
@@ -355,6 +510,26 @@ Join us for further discussions!
A: If OWL determines that a task can be completed using non-browser tools (such as search or code execution), the browser will not be launched. The browser window will only appear when OWL determines that browser-based interaction is necessary.
+**Q: Which Python version should I use?**
+
+A: OWL supports Python 3.10, 3.11, and 3.12.
+
+**Q: How can I contribute to the project?**
+
+A: See our [Contributing](#-contributing) section for details on how to get involved. We welcome contributions of all kinds, from code improvements to documentation updates.
+
+# 📚 Exploring CAMEL Dependency
+
+OWL is built on top of the [CAMEL](https://github.com/camel-ai/camel) Framework, here's how you can explore the CAMEL source code and understand how it works with OWL:
+
+## Accessing CAMEL Source Code
+
+```bash
+# Clone the CAMEL repository
+git clone https://github.com/camel-ai/camel.git
+cd camel
+```
+
# ⭐ Star History
[](https://star-history.com/#camel-ai/owl&Date)
diff --git a/README_zh.md b/README_zh.md
index a690d72..ac40fed 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -1,6 +1,6 @@
🦉 OWL: Optimized Workforce Learning for General Multi-Agent Assistance in Real-World Task Automation
- 🦉 OWL: 优化劳动力学习的通用智能体,用于处理现实世界的自动化任务
+ 🦉 OWL: 优化劳动力学习的通用智能体,用于处理现实世界的自动化任务
@@ -73,18 +73,42 @@
- [**设置环境变量**](#设置环境变量)
- [**使用Docker运行**](#使用docker运行)
- [🚀 快速开始](#-快速开始)
+- [🧰 工具包与功能](#-工具包与功能)
- [🌐 网页界面](#-网页界面)
- [🧪 实验](#-实验)
- [⏱️ 未来计划](#️-未来计划)
- [📄 许可证](#-许可证)
- [🖊️ 引用](#️-引用)
+- [🤝 贡献](#-贡献)
- [🔥 社区](#-社区)
- [❓ 常见问题](#-常见问题)
+- [📚 探索 CAMEL 依赖](#-探索-camel-依赖)
+- [⭐ Star History](#-star-history)
# 🔥 新闻
+
+
+ 🌟🌟🌟 OWL社区用例征集令! 🌟🌟🌟
+
+
+ 我们请社区成员贡献创新的OWL用例!
+ 前十名提交将获得特别社区礼物和认可。
+
+
+ 了解更多并提交
+
+
+ 提交截止日期:2025年3月31日
+
+
+
+- **[2025.03.12]**: 在SearchToolkit中添加了Bocha搜索功能,集成了火山引擎模型平台,并更新了Azure和OpenAI Compatible模型的结构化输出和工具调用能力。
+- **[2025.03.11]**: 我们添加了 MCPToolkit、FileWriteToolkit 和 TerminalToolkit,增强 OWL Agent的工具调用、文件写入能力和终端命令执行功能。
+- **[2025.03.09]**: 我们添加了基于网页的用户界面,使系统交互变得更加简便。
- **[2025.03.07]**: 我们开源了 🦉 OWL 项目的代码库。
+- **[2025.03.03]**: OWL 在 GAIA 基准测试中取得 58.18 平均分,在开源框架中排名第一!
# 🎬 演示视频
@@ -180,15 +204,43 @@ pip install -r requirements.txt
conda deactivate
```
-## **设置环境变量**
+## **设置环境变量**
-在 `owl/.env_template` 文件中,你可以找到所有必要的 API 密钥以及各服务的注册网址。要使用这些 API 服务,请按照以下步骤操作:
+OWL 需要各种 API 密钥来与不同的服务进行交互。`owl/.env_template` 文件包含了所有必要 API 密钥的占位符,以及可以注册这些服务的链接。
-1. *复制并重命名*: 复制 `.env_template` 文件,并将副本重命名为 `.env`。
-2. *填写你的密钥*: 打开 `.env` 文件,在相应字段中填入你的 API 密钥。
-3. *如需使用更多其他模型*:请参考我们CAMEL的models文档:https://docs.camel-ai.org/key_modules/models.html#supported-model-platforms-in-camel
+### 选项 1:使用 `.env` 文件(推荐)
-> **注意**:为获得最佳性能,我们强烈建议使用 OpenAI 模型。我们通过测试发现,其他模型在处理复杂任务和基准测试时可能会导致性能显著降低。
+1. **复制并重命名模板**:
+ ```bash
+ cd owl
+ cp .env_template .env
+ ```
+
+2. **配置你的 API 密钥**:
+ 在你喜欢的文本编辑器中打开 `.env` 文件,并在相应字段中插入你的 API 密钥。
+
+ > **注意**:对于最小示例(`run_mini.py`),你只需要配置 LLM API 密钥(例如,`OPENAI_API_KEY`)。
+
+### 选项 2:直接设置环境变量
+
+或者,你可以直接在终端中设置环境变量:
+
+- **macOS/Linux (Bash/Zsh)**:
+ ```bash
+ export OPENAI_API_KEY="你的-openai-api-密钥"
+ ```
+
+- **Windows (命令提示符)**:
+ ```batch
+ set OPENAI_API_KEY="你的-openai-api-密钥"
+ ```
+
+- **Windows (PowerShell)**:
+ ```powershell
+ $env:OPENAI_API_KEY = "你的-openai-api-密钥"
+ ```
+
+> **注意**:直接在终端中设置的环境变量仅在当前会话中有效。
## **使用Docker运行**
@@ -235,17 +287,32 @@ python owl/run_mini.py
## 使用不同的模型
-OWL 支持多种 LLM 后端。您可以使用以下脚本来运行不同的模型:
+### 模型要求
+
+- **工具调用能力**:OWL 需要具有强大工具调用能力的模型来与各种工具包交互。模型必须能够理解工具描述、生成适当的工具调用,并处理工具输出。
+
+- **多模态理解能力**:对于涉及网页交互、图像分析或视频处理的任务,需要具备多模态能力的模型来解释视觉内容和上下文。
+
+#### 支持的模型
+
+有关配置模型的信息,请参阅我们的 [CAMEL 模型文档](https://docs.camel-ai.org/key_modules/models.html#supported-model-platforms-in-camel)。
+
+> **注意**:为获得最佳性能,我们强烈推荐使用 OpenAI 模型(GPT-4 或更高版本)。我们的实验表明,其他模型在复杂任务和基准测试上可能表现明显较差,尤其是那些需要多模态理解和工具使用的任务。
+
+OWL 支持多种 LLM 后端,但功能可能因模型的工具调用和多模态能力而异。您可以使用以下脚本来运行不同的模型:
```bash
# 使用 Qwen 模型运行
-python owl/run_qwen.py
+python owl/run_qwen_zh.py
# 使用 Deepseek 模型运行
-python owl/run_deepseek.py
+python owl/run_deepseek_zh.py
# 使用其他 OpenAI 兼容模型运行
python owl/run_openai_compatiable_model.py
+
+# 使用 Ollama 运行
+python owl/run_ollama.py
```
你可以通过修改 `run.py` 脚本来运行自己的任务:
@@ -280,11 +347,76 @@ OWL 将自动调用与文档相关的工具来处理文件并提取答案。
- "帮我调试这段 Python 代码:[在此粘贴你的代码]"
- "总结这篇研究论文的主要观点:[论文URL]"
+# 🧰 工具包与功能
+
+> **重要提示**:有效使用工具包需要具备强大工具调用能力的模型。对于多模态工具包(Web、图像、视频),模型还必须具备多模态理解能力。
+
+OWL支持多种工具包,可通过修改脚本中的`tools`列表进行自定义:
+
+```python
+# 配置工具包
+tools = [
+ *WebToolkit(headless=False).get_tools(), # 浏览器自动化
+ *VideoAnalysisToolkit(model=models["video"]).get_tools(),
+ *AudioAnalysisToolkit().get_tools(), # 需要OpenAI API密钥
+ *CodeExecutionToolkit(sandbox="subprocess").get_tools(),
+ *ImageAnalysisToolkit(model=models["image"]).get_tools(),
+ SearchToolkit().search_duckduckgo,
+ SearchToolkit().search_google, # 如果不可用请注释
+ SearchToolkit().search_wiki,
+ *ExcelToolkit().get_tools(),
+ *DocumentProcessingToolkit(model=models["document"]).get_tools(),
+ *FileWriteToolkit(output_dir="./").get_tools(),
+]
+```
+
+## 主要工具包
+
+关键工具包包括:
+
+### 多模态工具包(需要模型具备多模态能力)
+- **WebToolkit**:浏览器自动化,用于网页交互和导航
+- **VideoAnalysisToolkit**:视频处理和内容分析
+- **ImageAnalysisToolkit**:图像分析和解释
+
+### 基于文本的工具包
+- **AudioAnalysisToolkit**:音频处理(需要 OpenAI API)
+- **CodeExecutionToolkit**:Python 代码执行和评估
+- **SearchToolkit**:网络搜索(Google、DuckDuckGo、维基百科)
+- **DocumentProcessingToolkit**:文档解析(PDF、DOCX等)
+
+其他专用工具包:ArxivToolkit、GitHubToolkit、GoogleMapsToolkit、MathToolkit、NetworkXToolkit、NotionToolkit、RedditToolkit、WeatherToolkit等。完整工具包列表请参阅[CAMEL工具包文档](https://docs.camel-ai.org/key_modules/tools.html#built-in-toolkits)。
+
+## 自定义配置
+
+自定义可用工具的方法:
+
+```python
+# 1. 导入工具包
+from camel.toolkits import WebToolkit, SearchToolkit, CodeExecutionToolkit
+
+# 2. 配置工具列表
+tools = [
+ *WebToolkit(headless=True).get_tools(),
+ SearchToolkit().search_wiki,
+ *CodeExecutionToolkit(sandbox="subprocess").get_tools(),
+]
+
+# 3. 传递给助手代理
+assistant_agent_kwargs = {"model": models["assistant"], "tools": tools}
+```
+
+选择必要的工具包可优化性能并减少资源使用。
+
# 🌐 网页界面
OWL 现在包含一个基于网页的用户界面,使与系统交互变得更加容易。要启动网页界面,请运行:
```bash
+# 中文版本
+python run_app_zh.py
+
+# 英文版本
python run_app.py
```
@@ -314,10 +446,12 @@ python run_gaia_roleplaying.py
# ⏱️ 未来计划
-- [ ] 撰写一篇技术博客,详细介绍我们在现实任务中多智能体协作方面的探索与见解。
-- [ ] 通过引入更多针对特定领域任务的专业工具,进一步完善工具生态系统。
-- [ ] 开发更复杂的智能体交互模式和通信协议
+我们正在不断努力改进 OWL。以下是我们的路线图:
+- [ ] 撰写技术博客,详细介绍我们在现实任务中多智能体协作方面的探索与见解
+- [ ] 通过引入更多针对特定领域任务的专业工具,进一步完善工具生态系统
+- [ ] 开发更复杂的智能体交互模式和通信协议
+- [ ] 提高复杂多步推理任务的性能
# 📄 许可证
@@ -338,10 +472,27 @@ python run_gaia_roleplaying.py
}
```
+# 🤝 贡献
+
+我们欢迎社区的贡献!以下是您可以提供帮助的方式:
+
+1. 阅读我们的[贡献指南](https://github.com/camel-ai/camel/blob/master/CONTRIBUTING.md)
+2. 查看[开放的问题](https://github.com/camel-ai/camel/issues)或创建新的问题
+3. 提交包含您改进的拉取请求
+
+**当前开放贡献的问题:**
+- [#1770](https://github.com/camel-ai/camel/issues/1770)
+- [#1712](https://github.com/camel-ai/camel/issues/1712)
+- [#1537](https://github.com/camel-ai/camel/issues/1537)
+- [#1827](https://github.com/camel-ai/camel/issues/1827)
+
+要认领一个问题,只需在该问题下留言表明您的兴趣即可。
+
# 🔥 社区
+加入我们的 ([*Discord*](https://discord.camel-ai.org/) 或 [*微信*](https://ghli.org/camel/wechat.png)) 社区,一起探索智能体扩展规律的边界。
+
加入我们,参与更多讨论!
-
-
+
# ❓ 常见问题
@@ -350,6 +501,30 @@ python run_gaia_roleplaying.py
A: 当OWL判断某个任务可以使用非浏览器工具(如搜索、代码分析等)完成时,浏览器就不会启动。只有在判断需要使用浏览器工具的时候,本地才会弹出浏览器窗口,并进行浏览器模拟交互。
+**Q: 我应该使用哪个Python版本?**
+
+A: OWL支持Python 3.10、3.11和3.12。为了与所有依赖项获得最佳兼容性,我们推荐使用Python 3.10。
+
+**Q: 我如何为项目做贡献?**
+
+A: 请参阅我们的[贡献](#-贡献)部分,了解如何参与的详细信息。我们欢迎各种形式的贡献,从代码改进到文档更新。
+
+# 📚 探索 CAMEL 依赖
+
+OWL 是基于 [CAMEL](https://github.com/camel-ai/camel) 框架构建的,以下是如何探索 CAMEL 源代码并了解其与 OWL 的工作方式:
+
+## 访问 CAMEL 源代码
+
+```bash
+# 克隆 CAMEL 仓库
+git clone https://github.com/camel-ai/camel.git
+cd camel
+```
+
+# ⭐ Star History
+
+[](https://star-history.com/#camel-ai/owl&Date)
+
[docs-image]: https://img.shields.io/badge/Documentation-EB3ECC
[docs-url]: https://camel-ai.github.io/camel/index.html
[star-image]: https://img.shields.io/github/stars/camel-ai/owl?label=stars&logo=github&color=brightgreen
diff --git a/assets/community.jpg b/assets/community.jpg
new file mode 100644
index 0000000..e8cae08
Binary files /dev/null and b/assets/community.jpg differ
diff --git a/assets/community.png b/assets/community.png
deleted file mode 100644
index 2caffd8..0000000
Binary files a/assets/community.png and /dev/null differ
diff --git a/assets/community_2.png b/assets/community_2.png
deleted file mode 100644
index e977e48..0000000
Binary files a/assets/community_2.png and /dev/null differ
diff --git a/assets/community_3.jpg b/assets/community_3.jpg
deleted file mode 100644
index 242627c..0000000
Binary files a/assets/community_3.jpg and /dev/null differ
diff --git a/assets/community_4.jpg b/assets/community_4.jpg
deleted file mode 100644
index 2c4159c..0000000
Binary files a/assets/community_4.jpg and /dev/null differ
diff --git a/assets/community_5.jpg b/assets/community_5.jpg
deleted file mode 100644
index 226267e..0000000
Binary files a/assets/community_5.jpg and /dev/null differ
diff --git a/assets/community_6.jpg b/assets/community_6.jpg
deleted file mode 100644
index d791638..0000000
Binary files a/assets/community_6.jpg and /dev/null differ
diff --git a/assets/community_6.png b/assets/community_6.png
deleted file mode 100644
index 24a8ec1..0000000
Binary files a/assets/community_6.png and /dev/null differ
diff --git a/assets/community_7.jpg b/assets/community_7.jpg
new file mode 100644
index 0000000..eab6526
Binary files /dev/null and b/assets/community_7.jpg differ
diff --git a/assets/meetup.jpg b/assets/meetup.jpg
deleted file mode 100644
index ab3d0e0..0000000
Binary files a/assets/meetup.jpg and /dev/null differ
diff --git a/assets/qr_code.jpg b/assets/qr_code.jpg
deleted file mode 100644
index 970e301..0000000
Binary files a/assets/qr_code.jpg and /dev/null differ
diff --git a/community_usecase/COMMUNITY_CALL_FOR_USE_CASES.md b/community_usecase/COMMUNITY_CALL_FOR_USE_CASES.md
new file mode 100644
index 0000000..69ad741
--- /dev/null
+++ b/community_usecase/COMMUNITY_CALL_FOR_USE_CASES.md
@@ -0,0 +1,175 @@
+# 🦉 OWL Community Call for Use Cases
+# 🦉 OWL 社区用例征集令
+
+
+
+[![Documentation][docs-image]][docs-url]
+[![Discord][discord-image]][discord-url]
+[![X][x-image]][x-url]
+[![Reddit][reddit-image]][reddit-url]
+[![Wechat][wechat-image]][wechat-url]
+[![Star][star-image]][star-url]
+
+
+
+
+
+
+[English](#join-the-owl-community-contribute-your-use-cases) | [中文](#加入owl社区贡献您的用例)
+
+
+
+
+## Join the OWL Community: Contribute Your Use Cases!
+
+Dear OWL Community,
+
+We are excited to announce a special initiative to expand the capabilities and applications of the OWL framework! As the #1 ranked open-source multi-agent collaboration framework on the [GAIA benchmark](https://huggingface.co/spaces/gaia-benchmark/leaderboard), OWL is revolutionizing how AI agents collaborate to solve real-world tasks.
+
+### 🌟 What We're Looking For
+
+We invite you to contribute use cases that demonstrate the power and versatility of OWL in two ways:
+
+1. **Leverage Existing Tools and Models**: Create innovative use cases using OWL's supported tools and models, then submit a PR to our repository.
+2. **Extend OWL's Capabilities**: Develop new tools that expand OWL's functionality to implement your own unique use cases.
+
+### 🏆 Community Rewards
+
+The **top ten submissions** will receive:
+- Special community gifts
+- Featured promotion within the OWL community
+- Recognition of your contributions and authorship
+
+### 💡 Submission Guidelines
+
+Your submission should include:
+
+1. **Well-documented code**: Clear comments and instructions for running your use case
+2. **Description file**: Explaining what your use case does and why it's valuable
+3. **Requirements**: Any additional dependencies needed
+4. **Example outputs**: Demonstrations of your use case in action
+
+### 🔍 Evaluation Criteria
+
+Submissions will be evaluated based on:
+- **Innovation**: How creative and novel is your use case?
+- **Utility**: How useful is it for real-world applications?
+- **Implementation**: How well is it coded and documented?
+- **Extensibility**: How easily can others build upon your work?
+- **Community Engagement**: Sharing your use case on social media platforms (Zhihu, Xiaohongshu, X/Twitter, YouTube, etc.) will earn you extra points
+
+### 📝 How to Submit
+
+1. Fork the OWL repository
+2. Create your use case in the `examples/community/` directory
+3. Submit a Pull Request with a detailed description of your contribution
+4. Tag your PR with `community-use-case`
+
+### ⏰ Timeline
+
+- Submission deadline: March 31, 2025
+- Winners announcement: April 7, 2025
+
+### 🚀 Inspiration Areas
+
+Consider exploring use cases in:
+- Data analysis and visualization
+- Content creation and summarization
+- Research assistance
+- Educational tools
+- Business process automation
+- Creative applications
+- Cross-modal interactions (text, image, audio, video)
+
+### 🤝 Community Support
+
+Need help or have questions? Join our community channels:
+- [Discord](https://discord.gg/CNcNpquyDc)
+- [GitHub Discussions](https://github.com/camel-ai/owl/discussions)
+
+Let's build the future of multi-agent AI together!
+
+---
+
+## 加入OWL社区:贡献您的用例!
+
+亲爱的OWL社区成员,
+
+我们很高兴宣布一项特别计划,旨在扩展OWL框架的功能和应用!作为在[GAIA基准测试](https://huggingface.co/spaces/gaia-benchmark/leaderboard)中排名第一的开源多智能体协作框架,OWL正在彻底改变AI智能体协作解决现实任务的方式。
+
+### 🌟 我们在寻找什么
+
+我们邀请您通过以下两种方式贡献展示OWL强大功能和多样性的用例:
+
+1. **利用现有工具和模型**:使用OWL支持的工具和模型创建创新用例,然后向我们的仓库提交PR。
+2. **扩展OWL的功能**:开发新工具,扩展OWL的功能,实现您自己独特的用例。
+
+### 🏆 社区奖励
+
+**前十名**将获得:
+- 特别社区礼物
+- 在OWL社区内的推广展示
+- 对您贡献和作者身份的认可
+
+### 💡 提交指南
+
+您的提交应包括:
+
+1. **文档完善的代码**:清晰的注释和运行用例的说明
+2. **描述文件**:解释您的用例做什么以及为什么它有价值
+3. **依赖要求**:需要的任何额外依赖
+4. **示例输出**:展示您的用例实际运行效果
+
+### 🔍 评估标准
+
+提交将基于以下标准进行评估:
+- **创新性**:您的用例有多创新和新颖?
+- **实用性**:它对现实世界应用有多大用处?
+- **实现质量**:代码和文档的质量如何?
+- **可扩展性**:其他人能多容易地在您的工作基础上进行扩展?
+- **社区参与度**:在社交媒体平台(知乎、小红书、X/Twitter、YouTube等)分享您的用例将获得额外加分
+
+### 📝 如何提交
+
+1. Fork OWL仓库
+2. 在`community_usecase/`目录中创建您的用例
+3. 提交一个包含您贡献详细描述的Pull Request
+4. 使用`community-use-case`标签标记您的PR
+
+### ⏰ 时间线
+
+- 提交截止日期:2025年3月31日
+- 获奖者公布:2025年4月7日
+
+### 🚀 灵感领域
+
+考虑探索以下领域的用例:
+- 数据分析和可视化
+- 内容创建和摘要
+- 研究辅助
+- 教育工具
+- 业务流程自动化
+- 创意应用
+- 跨模态交互(文本、图像、音频、视频)
+
+### 🤝 社区支持
+
+需要帮助或有问题?加入我们的社区渠道:
+- [Discord](https://discord.gg/CNcNpquyDc)
+- [GitHub讨论](https://github.com/camel-ai/owl/discussions)
+
+让我们一起构建多智能体AI的未来!
+
+
+[docs-image]: https://img.shields.io/badge/docs-OWL-blue
+[docs-url]: https://docs.camel-ai.org/
+[discord-image]: https://img.shields.io/discord/1135106975706013747?color=7289da&label=Discord&logo=discord&logoColor=white
+[discord-url]: https://discord.gg/CNcNpquyDc
+[x-image]: https://img.shields.io/badge/Twitter-black?logo=x
+[x-url]: https://twitter.com/CamelAIOrg
+[reddit-image]: https://img.shields.io/badge/Reddit-FF4500?logo=reddit&logoColor=white
+[reddit-url]: https://www.reddit.com/r/camelai/
+[wechat-image]: https://img.shields.io/badge/WeChat-07C160?logo=wechat&logoColor=white
+[wechat-url]: https://docs.camel-ai.org/blog/2023/11/29/camel-wechat/
+[star-image]: https://img.shields.io/github/stars/camel-ai/owl?style=social
+[star-url]: https://github.com/camel-ai/owl
diff --git a/owl/.env_template b/owl/.env_template
index 550f899..cbf77f4 100644
--- a/owl/.env_template
+++ b/owl/.env_template
@@ -1,8 +1,8 @@
-# MODEL & API (See https://github.com/camel-ai/camel/blob/master/camel/types/enums.py)
+# MODEL & API (See https://docs.camel-ai.org/key_modules/models.html#)
# OPENAI API
-OPENAI_API_KEY = ""
-# OPENAI_API_BASE_URL = ""
+# OPENAI_API_KEY= ""
+# OPENAI_API_BASE_URL=""
# Qwen API (https://help.aliyun.com/zh/model-studio/developer-reference/get-api-key)
# QWEN_API_KEY=""
@@ -26,3 +26,4 @@ CHUNKR_API_KEY=""
# Firecrawl API (https://www.firecrawl.dev/)
FIRECRAWL_API_KEY=""
+#FIRECRAWL_API_URL="https://api.firecrawl.dev"
\ No newline at end of file
diff --git a/owl/app.py b/owl/app.py
index 92af864..15b967b 100644
--- a/owl/app.py
+++ b/owl/app.py
@@ -25,7 +25,7 @@ import signal
import dotenv
# 设置日志队列
-log_queue = queue.Queue()
+log_queue: queue.Queue[str] = queue.Queue()
# 当前运行的进程
current_process = None
@@ -39,6 +39,9 @@ SCRIPTS = {
"DeepSeek (中文)": "run_deepseek_zh.py",
"Default": "run.py",
"GAIA Roleplaying": "run_gaia_roleplaying.py",
+ "OpenAI Compatible": "run_openai_compatiable_model.py",
+ "Ollama": "run_ollama.py",
+ "Terminal": "run_terminal_zh.py",
}
# 脚本描述
@@ -49,6 +52,9 @@ SCRIPT_DESCRIPTIONS = {
"DeepSeek (中文)": "使用DeepSeek模型,适合非多模态任务",
"Default": "默认OWL实现,使用OpenAI GPT-4o模型和全套工具",
"GAIA Roleplaying": "GAIA基准测试实现,用于评估模型能力",
+ "OpenAI Compatible": "使用兼容OpenAI API的第三方模型,支持自定义API端点",
+ "Ollama": "使用Ollama API",
+ "Terminal": "使用本地终端执行python文件",
}
# 环境变量分组
@@ -144,33 +150,45 @@ def load_env_vars():
# 加载.env文件中可能存在的其他环境变量
if Path(".env").exists():
- with open(".env", "r", encoding="utf-8") as f:
- for line in f:
- line = line.strip()
- if line and not line.startswith("#") and "=" in line:
- key, value = line.split("=", 1)
- key = key.strip()
- value = value.strip().strip("\"'")
+ try:
+ with open(".env", "r", encoding="utf-8") as f:
+ for line in f:
+ line = line.strip()
+ if line and not line.startswith("#") and "=" in line:
+ try:
+ key, value = line.split("=", 1)
+ key = key.strip()
+ value = value.strip()
- # 检查是否是已知的环境变量
- known_var = False
- for group in ENV_GROUPS.values():
- if any(var["name"] == key for var in group):
- known_var = True
- break
+ # 处理引号包裹的值
+ if (value.startswith('"') and value.endswith('"')) or (
+ value.startswith("'") and value.endswith("'")
+ ):
+ value = value[1:-1] # 移除首尾的引号
- # 如果不是已知的环境变量,添加到自定义环境变量组
- if not known_var and key not in env_vars:
- ENV_GROUPS["自定义环境变量"].append(
- {
- "name": key,
- "label": key,
- "type": "text",
- "required": False,
- "help": "用户自定义环境变量",
- }
- )
- env_vars[key] = value
+ # 检查是否是已知的环境变量
+ known_var = False
+ for group in ENV_GROUPS.values():
+ if any(var["name"] == key for var in group):
+ known_var = True
+ break
+
+ # 如果不是已知的环境变量,添加到自定义环境变量组
+ if not known_var and key not in env_vars:
+ ENV_GROUPS["自定义环境变量"].append(
+ {
+ "name": key,
+ "label": key,
+ "type": "text",
+ "required": False,
+ "help": "用户自定义环境变量",
+ }
+ )
+ env_vars[key] = value
+ except Exception as e:
+ print(f"解析环境变量行时出错: {line}, 错误: {str(e)}")
+ except Exception as e:
+ print(f"加载.env文件时出错: {str(e)}")
return env_vars
@@ -182,30 +200,49 @@ def save_env_vars(env_vars):
existing_content = {}
if env_path.exists():
- with open(env_path, "r", encoding="utf-8") as f:
- for line in f:
- line = line.strip()
- if line and not line.startswith("#") and "=" in line:
- key, value = line.split("=", 1)
- existing_content[key.strip()] = value.strip()
+ try:
+ with open(env_path, "r", encoding="utf-8") as f:
+ for line in f:
+ line = line.strip()
+ if line and not line.startswith("#") and "=" in line:
+ try:
+ key, value = line.split("=", 1)
+ existing_content[key.strip()] = value.strip()
+ except Exception as e:
+ print(f"解析环境变量行时出错: {line}, 错误: {str(e)}")
+ except Exception as e:
+ print(f"读取.env文件时出错: {str(e)}")
# 更新环境变量
for key, value in env_vars.items():
- if value: # 只保存非空值
- # 确保值是字符串形式,并用引号包裹
+ if value is not None: # 允许空字符串值,但不允许None
+ # 确保值是字符串形式
value = str(value) # 确保值是字符串
- if not (value.startswith('"') and value.endswith('"')) and not (
+
+ # 检查值是否已经被引号包裹
+ if (value.startswith('"') and value.endswith('"')) or (
value.startswith("'") and value.endswith("'")
):
- value = f'"{value}"'
- existing_content[key] = value
- # 同时更新当前进程的环境变量
- os.environ[key] = value.strip("\"'")
+ # 已经被引号包裹,保持原样
+ existing_content[key] = value
+ # 更新环境变量时移除引号
+ os.environ[key] = value[1:-1]
+ else:
+ # 没有被引号包裹,添加双引号
+ # 用双引号包裹值,确保特殊字符被正确处理
+ quoted_value = f'"{value}"'
+ existing_content[key] = quoted_value
+ # 同时更新当前进程的环境变量(使用未引用的值)
+ os.environ[key] = value
# 写入.env文件
- with open(env_path, "w", encoding="utf-8") as f:
- for key, value in existing_content.items():
- f.write(f"{key}={value}\n")
+ try:
+ with open(env_path, "w", encoding="utf-8") as f:
+ for key, value in existing_content.items():
+ f.write(f"{key}={value}\n")
+ except Exception as e:
+ print(f"写入.env文件时出错: {str(e)}")
+ return f"❌ 保存环境变量失败: {str(e)}"
return "✅ 环境变量已保存"
@@ -239,27 +276,128 @@ def add_custom_env_var(name, value, var_type):
return f"✅ 已添加环境变量 {name}", ENV_GROUPS["自定义环境变量"]
+def update_custom_env_var(name, value, var_type):
+ """更改自定义环境变量"""
+ if not name:
+ return "❌ 环境变量名不能为空", None
+
+ # 检查环境变量是否存在于自定义环境变量组中
+ found = False
+ for i, var in enumerate(ENV_GROUPS["自定义环境变量"]):
+ if var["name"] == name:
+ # 更新类型
+ ENV_GROUPS["自定义环境变量"][i]["type"] = var_type
+ found = True
+ break
+
+ if not found:
+ return f"❌ 自定义环境变量 {name} 不存在", None
+
+ # 保存环境变量值
+ env_vars = {name: value}
+ save_env_vars(env_vars)
+
+ # 返回成功消息和更新后的环境变量组
+ return f"✅ 已更新环境变量 {name}", ENV_GROUPS["自定义环境变量"]
+
+
+def delete_custom_env_var(name):
+ """删除自定义环境变量"""
+ if not name:
+ return "❌ 环境变量名不能为空", None
+
+ # 检查环境变量是否存在于自定义环境变量组中
+ found = False
+ for i, var in enumerate(ENV_GROUPS["自定义环境变量"]):
+ if var["name"] == name:
+ # 从自定义环境变量组中删除
+ del ENV_GROUPS["自定义环境变量"][i]
+ found = True
+ break
+
+ if not found:
+ return f"❌ 自定义环境变量 {name} 不存在", None
+
+ # 从.env文件中删除该环境变量
+ env_path = Path(".env")
+ if env_path.exists():
+ try:
+ with open(env_path, "r", encoding="utf-8") as f:
+ lines = f.readlines()
+
+ with open(env_path, "w", encoding="utf-8") as f:
+ for line in lines:
+ try:
+ # 更精确地匹配环境变量行
+ line_stripped = line.strip()
+ # 检查是否为注释行或空行
+ if not line_stripped or line_stripped.startswith("#"):
+ f.write(line) # 保留注释行和空行
+ continue
+
+ # 检查是否包含等号
+ if "=" not in line_stripped:
+ f.write(line) # 保留不包含等号的行
+ continue
+
+ # 提取变量名并检查是否与要删除的变量匹配
+ var_name = line_stripped.split("=", 1)[0].strip()
+ if var_name != name:
+ f.write(line) # 保留不匹配的变量
+ except Exception as e:
+ print(f"处理.env文件行时出错: {line}, 错误: {str(e)}")
+ # 出错时保留原行
+ f.write(line)
+ except Exception as e:
+ print(f"删除环境变量时出错: {str(e)}")
+ return f"❌ 删除环境变量失败: {str(e)}", None
+
+ # 从当前进程的环境变量中删除
+ if name in os.environ:
+ del os.environ[name]
+
+ # 返回成功消息和更新后的环境变量组
+ return f"✅ 已删除环境变量 {name}", ENV_GROUPS["自定义环境变量"]
+
+
def terminate_process():
"""终止当前运行的进程"""
global current_process
with process_lock:
if current_process is not None and current_process.poll() is None:
- # 在Windows上使用CTRL_BREAK_EVENT,在Unix上使用SIGTERM
- if os.name == "nt":
- current_process.send_signal(signal.CTRL_BREAK_EVENT)
- else:
- current_process.terminate()
-
- # 等待进程终止
try:
- current_process.wait(timeout=5)
- except subprocess.TimeoutExpired:
- # 如果进程没有在5秒内终止,强制终止
- current_process.kill()
+ # 在Windows上使用taskkill强制终止进程树
+ if os.name == "nt":
+ # 获取进程ID
+ pid = current_process.pid
+ # 使用taskkill命令终止进程及其子进程 - 避免使用shell=True以提高安全性
+ try:
+ subprocess.run(
+ ["taskkill", "/F", "/T", "/PID", str(pid)], check=False
+ )
+ except subprocess.SubprocessError as e:
+ log_queue.put(f"终止进程时出错: {str(e)}\n")
+ return f"❌ 终止进程时出错: {str(e)}"
+ else:
+ # 在Unix上使用SIGTERM和SIGKILL
+ current_process.terminate()
+ try:
+ current_process.wait(timeout=3)
+ except subprocess.TimeoutExpired:
+ current_process.kill()
- log_queue.put("进程已终止\n")
- return "✅ 进程已终止"
+ # 等待进程终止
+ try:
+ current_process.wait(timeout=2)
+ except subprocess.TimeoutExpired:
+ pass # 已经尝试强制终止,忽略超时
+
+ log_queue.put("进程已终止\n")
+ return "✅ 进程已终止"
+ except Exception as e:
+ log_queue.put(f"终止进程时出错: {str(e)}\n")
+ return f"❌ 终止进程时出错: {str(e)}"
else:
return "❌ 没有正在运行的进程"
@@ -288,14 +426,21 @@ def run_script(script_dropdown, question, progress=gr.Progress()):
log_file = log_dir / f"{script_name.replace('.py', '')}_{timestamp}.log"
# 构建命令
+ # 获取当前脚本所在的基础路径
+ base_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+
cmd = [
sys.executable,
- os.path.join("owl", "script_adapter.py"),
- os.path.join("owl", script_name),
+ os.path.join(base_path, "owl", "script_adapter.py"),
+ os.path.join(base_path, "owl", script_name),
]
# 创建环境变量副本并添加问题
env = os.environ.copy()
+ # 确保问题是字符串类型
+ if not isinstance(question, str):
+ question = str(question)
+ # 保留换行符,但确保是有效的字符串
env["OWL_QUESTION"] = question
# 启动进程
@@ -307,12 +452,24 @@ def run_script(script_dropdown, question, progress=gr.Progress()):
text=True,
bufsize=1,
env=env,
+ encoding="utf-8",
)
# 创建线程来读取输出
def read_output():
try:
- with open(log_file, "w", encoding="utf-8") as f:
+ # 使用唯一的时间戳确保日志文件名不重复
+ timestamp_unique = datetime.now().strftime("%Y%m%d_%H%M%S_%f")
+ unique_log_file = (
+ log_dir / f"{script_name.replace('.py', '')}_{timestamp_unique}.log"
+ )
+
+ # 使用这个唯一的文件名写入日志
+ with open(unique_log_file, "w", encoding="utf-8") as f:
+ # 更新全局日志文件路径
+ nonlocal log_file
+ log_file = unique_log_file
+
for line in iter(current_process.stdout.readline, ""):
if line:
# 写入日志文件
@@ -456,12 +613,12 @@ def create_ui():
gr.Markdown(
"""
# 🦉 OWL 智能助手运行平台
-
+
选择一个模型并输入您的问题,系统将运行相应的脚本并显示结果。
"""
)
- with gr.Tabs() as tabs:
+ with gr.Tabs():
with gr.TabItem("运行模式"):
with gr.Row():
with gr.Column(scale=1):
@@ -488,12 +645,17 @@ def create_ui():
)
question_input = gr.Textbox(
- lines=5, placeholder="请输入您的问题...", label="问题"
+ lines=8,
+ placeholder="请输入您的问题...",
+ label="问题",
+ elem_id="question_input",
+ show_copy_button=True,
)
gr.Markdown(
"""
> **注意**: 您输入的问题将替换脚本中的默认问题。系统会自动处理问题的替换,确保您的问题被正确使用。
+ > 支持多行输入,换行将被保留。
"""
)
@@ -559,12 +721,72 @@ def create_ui():
visible=len(ENV_GROUPS["自定义环境变量"]) > 0,
)
- # 添加环境变量按钮点击事件
- add_var_button.click(
- fn=add_custom_env_var,
- inputs=[new_var_name, new_var_value, new_var_type],
- outputs=[add_var_status, custom_vars_list],
- )
+ # 更改和删除自定义环境变量部分
+ with gr.Accordion(
+ "更改或删除自定义环境变量",
+ open=True,
+ visible=len(ENV_GROUPS["自定义环境变量"]) > 0,
+ ) as update_delete_accordion:
+ with gr.Row():
+ # 创建下拉菜单,显示所有自定义环境变量
+ custom_var_dropdown = gr.Dropdown(
+ choices=[
+ var["name"] for var in ENV_GROUPS["自定义环境变量"]
+ ],
+ label="选择环境变量",
+ interactive=True,
+ )
+ update_var_value = gr.Textbox(
+ label="新的环境变量值", placeholder="输入新值"
+ )
+ update_var_type = gr.Dropdown(
+ choices=["text", "password"], value="text", label="类型"
+ )
+
+ with gr.Row():
+ update_var_button = gr.Button("更新环境变量", variant="primary")
+ delete_var_button = gr.Button("删除环境变量", variant="stop")
+
+ update_var_status = gr.Textbox(label="操作状态", interactive=False)
+
+ # 添加环境变量按钮点击事件
+ add_var_button.click(
+ fn=add_custom_env_var,
+ inputs=[new_var_name, new_var_value, new_var_type],
+ outputs=[add_var_status, custom_vars_list],
+ ).then(
+ fn=lambda vars: {"visible": len(vars) > 0},
+ inputs=[custom_vars_list],
+ outputs=[update_delete_accordion],
+ )
+
+ # 更新环境变量按钮点击事件
+ update_var_button.click(
+ fn=update_custom_env_var,
+ inputs=[custom_var_dropdown, update_var_value, update_var_type],
+ outputs=[update_var_status, custom_vars_list],
+ )
+
+ # 删除环境变量按钮点击事件
+ delete_var_button.click(
+ fn=delete_custom_env_var,
+ inputs=[custom_var_dropdown],
+ outputs=[update_var_status, custom_vars_list],
+ ).then(
+ fn=lambda vars: {"visible": len(vars) > 0},
+ inputs=[custom_vars_list],
+ outputs=[update_delete_accordion],
+ )
+
+ # 当自定义环境变量列表更新时,更新下拉菜单选项
+ custom_vars_list.change(
+ fn=lambda vars: {
+ "choices": [var["name"] for var in vars],
+ "value": None,
+ },
+ inputs=[custom_vars_list],
+ outputs=[custom_var_dropdown],
+ )
# 现有环境变量配置
for group_name, vars in ENV_GROUPS.items():
@@ -641,7 +863,7 @@ def create_ui():
gr.Markdown(
"""
### 📝 使用说明
-
+
- 选择一个模型并输入您的问题
- 点击"运行"按钮开始执行
- 如需终止运行,点击"终止"按钮
@@ -650,9 +872,9 @@ def create_ui():
- 在"聊天历史"标签页查看对话历史(如果有)
- 在"环境变量配置"标签页配置API密钥和其他环境变量
- 您可以添加自定义环境变量,满足特殊需求
-
+
### ⚠️ 注意事项
-
+
- 运行某些模型可能需要API密钥,请确保在"环境变量配置"标签页中设置了相应的环境变量
- 某些脚本可能需要较长时间运行,请耐心等待
- 如果运行超过30分钟,进程将自动终止
diff --git a/owl/app_en.py b/owl/app_en.py
new file mode 100644
index 0000000..094c1f5
--- /dev/null
+++ b/owl/app_en.py
@@ -0,0 +1,918 @@
+# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
+import os
+import sys
+import gradio as gr
+import subprocess
+import threading
+import time
+from datetime import datetime
+import queue
+from pathlib import Path
+import json
+import signal
+import dotenv
+
+# Set up log queue
+log_queue: queue.Queue[str] = queue.Queue()
+
+# Currently running process
+current_process = None
+process_lock = threading.Lock()
+
+# Script options
+SCRIPTS = {
+ "Qwen Mini (Chinese)": "run_qwen_mini_zh.py",
+ "Qwen (Chinese)": "run_qwen_zh.py",
+ "Mini": "run_mini.py",
+ "DeepSeek (Chinese)": "run_deepseek_zh.py",
+ "Default": "run.py",
+ "GAIA Roleplaying": "run_gaia_roleplaying.py",
+ "OpenAI Compatible": "run_openai_compatiable_model.py",
+ "Ollama": "run_ollama.py",
+ "Terminal": "run_terminal.py",
+}
+
+# Script descriptions
+SCRIPT_DESCRIPTIONS = {
+ "Qwen Mini (Chinese)": "Uses the Chinese version of Alibaba Cloud's Qwen model, suitable for Chinese Q&A and tasks",
+ "Qwen (Chinese)": "Uses Alibaba Cloud's Qwen model, supports various tools and functions",
+ "Mini": "Lightweight version, uses OpenAI GPT-4o model",
+ "DeepSeek (Chinese)": "Uses DeepSeek model, suitable for non-multimodal tasks",
+ "Default": "Default OWL implementation, uses OpenAI GPT-4o model and full set of tools",
+ "GAIA Roleplaying": "GAIA benchmark implementation, used to evaluate model capabilities",
+ "OpenAI Compatible": "Uses third-party models compatible with OpenAI API, supports custom API endpoints",
+ "Ollama": "Uses Ollama API",
+ "Terminal": "Uses local terminal to execute python files",
+}
+
+# Environment variable groups
+ENV_GROUPS = {
+ "Model API": [
+ {
+ "name": "OPENAI_API_KEY",
+ "label": "OpenAI API Key",
+ "type": "password",
+ "required": False,
+ "help": "OpenAI API key for accessing GPT models. Get it from: https://platform.openai.com/api-keys",
+ },
+ {
+ "name": "OPENAI_API_BASE_URL",
+ "label": "OpenAI API Base URL",
+ "type": "text",
+ "required": False,
+ "help": "Base URL for OpenAI API, optional. Set this if using a proxy or custom endpoint.",
+ },
+ {
+ "name": "QWEN_API_KEY",
+ "label": "Alibaba Cloud Qwen API Key",
+ "type": "password",
+ "required": False,
+ "help": "Alibaba Cloud Qwen API key for accessing Qwen models. Get it from: https://help.aliyun.com/zh/model-studio/developer-reference/get-api-key",
+ },
+ {
+ "name": "DEEPSEEK_API_KEY",
+ "label": "DeepSeek API Key",
+ "type": "password",
+ "required": False,
+ "help": "DeepSeek API key for accessing DeepSeek models. Get it from: https://platform.deepseek.com/api_keys",
+ },
+ ],
+ "Search Tools": [
+ {
+ "name": "GOOGLE_API_KEY",
+ "label": "Google API Key",
+ "type": "password",
+ "required": False,
+ "help": "Google Search API key for web search functionality. Get it from: https://developers.google.com/custom-search/v1/overview",
+ },
+ {
+ "name": "SEARCH_ENGINE_ID",
+ "label": "Search Engine ID",
+ "type": "text",
+ "required": False,
+ "help": "Google Custom Search Engine ID, used with Google API key. Get it from: https://developers.google.com/custom-search/v1/overview",
+ },
+ ],
+ "Other Tools": [
+ {
+ "name": "HF_TOKEN",
+ "label": "Hugging Face Token",
+ "type": "password",
+ "required": False,
+ "help": "Hugging Face API token for accessing Hugging Face models and datasets. Get it from: https://huggingface.co/join",
+ },
+ {
+ "name": "CHUNKR_API_KEY",
+ "label": "Chunkr API Key",
+ "type": "password",
+ "required": False,
+ "help": "Chunkr API key for document processing functionality. Get it from: https://chunkr.ai/",
+ },
+ {
+ "name": "FIRECRAWL_API_KEY",
+ "label": "Firecrawl API Key",
+ "type": "password",
+ "required": False,
+ "help": "Firecrawl API key for web crawling functionality. Get it from: https://www.firecrawl.dev/",
+ },
+ ],
+ "Custom Environment Variables": [], # User-defined environment variables will be stored here
+}
+
+
+def get_script_info(script_name):
+ """Get detailed information about the script"""
+ return SCRIPT_DESCRIPTIONS.get(script_name, "No description available")
+
+
+def load_env_vars():
+ """Load environment variables"""
+ env_vars = {}
+ # Try to load from .env file
+ dotenv.load_dotenv()
+
+ # Get all environment variables
+ for group in ENV_GROUPS.values():
+ for var in group:
+ env_vars[var["name"]] = os.environ.get(var["name"], "")
+
+ # Load other environment variables that may exist in the .env file
+ if Path(".env").exists():
+ try:
+ with open(".env", "r", encoding="utf-8") as f:
+ for line in f:
+ line = line.strip()
+ if line and not line.startswith("#") and "=" in line:
+ try:
+ key, value = line.split("=", 1)
+ key = key.strip()
+ value = value.strip()
+
+ # Handle quoted values
+ if (value.startswith('"') and value.endswith('"')) or (
+ value.startswith("'") and value.endswith("'")
+ ):
+ value = value[
+ 1:-1
+ ] # Remove quotes at the beginning and end
+
+ # Check if it's a known environment variable
+ known_var = False
+ for group in ENV_GROUPS.values():
+ if any(var["name"] == key for var in group):
+ known_var = True
+ break
+
+ # If it's not a known environment variable, add it to the custom environment variables group
+ if not known_var and key not in env_vars:
+ ENV_GROUPS["Custom Environment Variables"].append(
+ {
+ "name": key,
+ "label": key,
+ "type": "text",
+ "required": False,
+ "help": "User-defined environment variable",
+ }
+ )
+ env_vars[key] = value
+ except Exception as e:
+ print(
+ f"Error parsing environment variable line: {line}, error: {str(e)}"
+ )
+ except Exception as e:
+ print(f"Error loading .env file: {str(e)}")
+
+ return env_vars
+
+
+def save_env_vars(env_vars):
+ """Save environment variables to .env file"""
+ # Read existing .env file content
+ env_path = Path(".env")
+ existing_content = {}
+
+ if env_path.exists():
+ try:
+ with open(env_path, "r", encoding="utf-8") as f:
+ for line in f:
+ line = line.strip()
+ if line and not line.startswith("#") and "=" in line:
+ try:
+ key, value = line.split("=", 1)
+ existing_content[key.strip()] = value.strip()
+ except Exception as e:
+ print(
+ f"Error parsing environment variable line: {line}, error: {str(e)}"
+ )
+ except Exception as e:
+ print(f"Error reading .env file: {str(e)}")
+
+ # Update environment variables
+ for key, value in env_vars.items():
+ if value is not None: # Allow empty string values, but not None
+ # Ensure the value is a string
+ value = str(value) # Ensure the value is a string
+
+ # Check if the value is already wrapped in quotes
+ if (value.startswith('"') and value.endswith('"')) or (
+ value.startswith("'") and value.endswith("'")
+ ):
+ # Already wrapped in quotes, keep as is
+ existing_content[key] = value
+ # Update environment variable by removing quotes
+ os.environ[key] = value[1:-1]
+ else:
+ # Not wrapped in quotes, add double quotes
+ # Wrap the value in double quotes to ensure special characters are handled correctly
+ quoted_value = f'"{value}"'
+ existing_content[key] = quoted_value
+ # Also update the environment variable for the current process (using the unquoted value)
+ os.environ[key] = value
+
+ # Write to .env file
+ try:
+ with open(env_path, "w", encoding="utf-8") as f:
+ for key, value in existing_content.items():
+ f.write(f"{key}={value}\n")
+ except Exception as e:
+ print(f"Error writing to .env file: {str(e)}")
+ return f"❌ Failed to save environment variables: {str(e)}"
+
+ return "✅ Environment variables saved"
+
+
+def add_custom_env_var(name, value, var_type):
+ """Add custom environment variable"""
+ if not name:
+ return "❌ Environment variable name cannot be empty", None
+
+ # Check if an environment variable with the same name already exists
+ for group in ENV_GROUPS.values():
+ if any(var["name"] == name for var in group):
+ return f"❌ Environment variable {name} already exists", None
+
+ # Add to custom environment variables group
+ ENV_GROUPS["Custom Environment Variables"].append(
+ {
+ "name": name,
+ "label": name,
+ "type": var_type,
+ "required": False,
+ "help": "User-defined environment variable",
+ }
+ )
+
+ # Save environment variables
+ env_vars = {name: value}
+ save_env_vars(env_vars)
+
+ # Return success message and updated environment variable group
+ return f"✅ Added environment variable {name}", ENV_GROUPS[
+ "Custom Environment Variables"
+ ]
+
+
+def update_custom_env_var(name, value, var_type):
+ """Update custom environment variable"""
+ if not name:
+ return "❌ Environment variable name cannot be empty", None
+
+ # Check if the environment variable exists in the custom environment variables group
+ found = False
+ for i, var in enumerate(ENV_GROUPS["Custom Environment Variables"]):
+ if var["name"] == name:
+ # Update type
+ ENV_GROUPS["Custom Environment Variables"][i]["type"] = var_type
+ found = True
+ break
+
+ if not found:
+ return f"❌ Custom environment variable {name} does not exist", None
+
+ # Save environment variable value
+ env_vars = {name: value}
+ save_env_vars(env_vars)
+
+ # Return success message and updated environment variable group
+ return f"✅ Updated environment variable {name}", ENV_GROUPS[
+ "Custom Environment Variables"
+ ]
+
+
+def delete_custom_env_var(name):
+ """Delete custom environment variable"""
+ if not name:
+ return "❌ Environment variable name cannot be empty", None
+
+ # Check if the environment variable exists in the custom environment variables group
+ found = False
+ for i, var in enumerate(ENV_GROUPS["Custom Environment Variables"]):
+ if var["name"] == name:
+ # Delete from custom environment variables group
+ del ENV_GROUPS["Custom Environment Variables"][i]
+ found = True
+ break
+
+ if not found:
+ return f"❌ Custom environment variable {name} does not exist", None
+
+ # Delete the environment variable from .env file
+ env_path = Path(".env")
+ if env_path.exists():
+ try:
+ with open(env_path, "r", encoding="utf-8") as f:
+ lines = f.readlines()
+
+ with open(env_path, "w", encoding="utf-8") as f:
+ for line in lines:
+ try:
+ # More precisely match environment variable lines
+ line_stripped = line.strip()
+ # Check if it's a comment line or empty line
+ if not line_stripped or line_stripped.startswith("#"):
+ f.write(line) # Keep comment lines and empty lines
+ continue
+
+ # Check if it contains an equals sign
+ if "=" not in line_stripped:
+ f.write(line) # Keep lines without equals sign
+ continue
+
+ # Extract variable name and check if it matches the variable to be deleted
+ var_name = line_stripped.split("=", 1)[0].strip()
+ if var_name != name:
+ f.write(line) # Keep variables that don't match
+ except Exception as e:
+ print(
+ f"Error processing .env file line: {line}, error: {str(e)}"
+ )
+ # Keep the original line when an error occurs
+ f.write(line)
+ except Exception as e:
+ print(f"Error deleting environment variable: {str(e)}")
+ return f"❌ Failed to delete environment variable: {str(e)}", None
+
+ # Delete from current process environment variables
+ if name in os.environ:
+ del os.environ[name]
+
+ # Return success message and updated environment variable group
+ return f"✅ Deleted environment variable {name}", ENV_GROUPS[
+ "Custom Environment Variables"
+ ]
+
+
+def terminate_process():
+ """Terminate the currently running process"""
+ global current_process
+
+ with process_lock:
+ if current_process is not None and current_process.poll() is None:
+ try:
+ # On Windows, use taskkill to forcibly terminate the process tree
+ if os.name == "nt":
+ # Get process ID
+ pid = current_process.pid
+ # Use taskkill command to terminate the process and its children - avoid using shell=True for better security
+ try:
+ subprocess.run(
+ ["taskkill", "/F", "/T", "/PID", str(pid)], check=False
+ )
+ except subprocess.SubprocessError as e:
+ log_queue.put(f"Error terminating process: {str(e)}\n")
+ return f"❌ Error terminating process: {str(e)}"
+ else:
+ # On Unix, use SIGTERM and SIGKILL
+ current_process.terminate()
+ try:
+ current_process.wait(timeout=3)
+ except subprocess.TimeoutExpired:
+ current_process.kill()
+
+ # Wait for process to terminate
+ try:
+ current_process.wait(timeout=2)
+ except subprocess.TimeoutExpired:
+ pass # Already tried to force terminate, ignore timeout
+
+ log_queue.put("Process terminated\n")
+ return "✅ Process terminated"
+ except Exception as e:
+ log_queue.put(f"Error terminating process: {str(e)}\n")
+ return f"❌ Error terminating process: {str(e)}"
+ else:
+ return "❌ No process is currently running"
+
+
+def run_script(script_dropdown, question, progress=gr.Progress()):
+ """Run the selected script and return the output"""
+ global current_process
+
+ script_name = SCRIPTS.get(script_dropdown)
+ if not script_name:
+ return "❌ Invalid script selection", "", "", "", None
+
+ if not question.strip():
+ return "Please enter a question!", "", "", "", None
+
+ # Clear the log queue
+ while not log_queue.empty():
+ log_queue.get()
+
+ # Create log directory
+ log_dir = Path("logs")
+ log_dir.mkdir(exist_ok=True)
+
+ # Create log file with timestamp
+ timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
+ log_file = log_dir / f"{script_name.replace('.py', '')}_{timestamp}.log"
+
+ # Build command
+ base_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+ cmd = [
+ sys.executable,
+ os.path.join(base_path, "owl", "script_adapter.py"),
+ os.path.join(base_path, "owl", script_name),
+ ]
+
+ # Create a copy of environment variables and add the question
+ env = os.environ.copy()
+ # Ensure question is a string type
+ if not isinstance(question, str):
+ question = str(question)
+ # Preserve newlines, but ensure it's a valid string
+ env["OWL_QUESTION"] = question
+
+ # Start the process
+ with process_lock:
+ current_process = subprocess.Popen(
+ cmd,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT,
+ text=True,
+ bufsize=1,
+ env=env,
+ encoding="utf-8",
+ )
+
+ # Create thread to read output
+ def read_output():
+ try:
+ # Use a unique timestamp to ensure log filename is not duplicated
+ timestamp_unique = datetime.now().strftime("%Y%m%d_%H%M%S_%f")
+ unique_log_file = (
+ log_dir / f"{script_name.replace('.py', '')}_{timestamp_unique}.log"
+ )
+
+ # Use this unique filename to write logs
+ with open(unique_log_file, "w", encoding="utf-8") as f:
+ # Update global log file path
+ nonlocal log_file
+ log_file = unique_log_file
+
+ for line in iter(current_process.stdout.readline, ""):
+ if line:
+ # Write to log file
+ f.write(line)
+ f.flush()
+ # Add to queue
+ log_queue.put(line)
+ except Exception as e:
+ log_queue.put(f"Error reading output: {str(e)}\n")
+
+ # Start the reading thread
+ threading.Thread(target=read_output, daemon=True).start()
+
+ # Collect logs
+ logs = []
+ progress(0, desc="Running...")
+
+ # Wait for process to complete or timeout
+ start_time = time.time()
+ timeout = 1800 # 30 minutes timeout
+
+ while current_process.poll() is None:
+ # Check if timeout
+ if time.time() - start_time > timeout:
+ with process_lock:
+ if current_process.poll() is None:
+ if os.name == "nt":
+ current_process.send_signal(signal.CTRL_BREAK_EVENT)
+ else:
+ current_process.terminate()
+ log_queue.put("Execution timeout, process terminated\n")
+ break
+
+ # Get logs from queue
+ while not log_queue.empty():
+ log = log_queue.get()
+ logs.append(log)
+
+ # Update progress
+ elapsed = time.time() - start_time
+ progress(min(elapsed / 300, 0.99), desc="Running...")
+
+ # Short sleep to reduce CPU usage
+ time.sleep(0.1)
+
+ # Update log display once per second
+ yield (
+ status_message(current_process),
+ extract_answer(logs),
+ "".join(logs),
+ str(log_file),
+ None,
+ )
+
+ # Get remaining logs
+ while not log_queue.empty():
+ logs.append(log_queue.get())
+
+ # Extract chat history (if any)
+ chat_history = extract_chat_history(logs)
+
+ # Return final status and logs
+ return (
+ status_message(current_process),
+ extract_answer(logs),
+ "".join(logs),
+ str(log_file),
+ chat_history,
+ )
+
+
+def status_message(process):
+ """Return status message based on process status"""
+ if process.poll() is None:
+ return "⏳ Running..."
+ elif process.returncode == 0:
+ return "✅ Execution successful"
+ else:
+ return f"❌ Execution failed (return code: {process.returncode})"
+
+
+def extract_answer(logs):
+ """Extract answer from logs"""
+ answer = ""
+ for log in logs:
+ if "Answer:" in log:
+ answer = log.split("Answer:", 1)[1].strip()
+ break
+ return answer
+
+
+def extract_chat_history(logs):
+ """Try to extract chat history from logs"""
+ try:
+ chat_json_str = ""
+ capture_json = False
+
+ for log in logs:
+ if "chat_history" in log:
+ # Start capturing JSON
+ start_idx = log.find("[")
+ if start_idx != -1:
+ capture_json = True
+ chat_json_str = log[start_idx:]
+ elif capture_json:
+ # Continue capturing JSON until finding the matching closing bracket
+ chat_json_str += log
+ if "]" in log:
+ # Found closing bracket, try to parse JSON
+ end_idx = chat_json_str.rfind("]") + 1
+ if end_idx > 0:
+ try:
+ # Clean up possible extra text
+ json_str = chat_json_str[:end_idx].strip()
+ chat_data = json.loads(json_str)
+
+ # Format for use with Gradio chat component
+ formatted_chat = []
+ for msg in chat_data:
+ if "role" in msg and "content" in msg:
+ role = (
+ "User" if msg["role"] == "user" else "Assistant"
+ )
+ formatted_chat.append([role, msg["content"]])
+ return formatted_chat
+ except json.JSONDecodeError:
+ # If parsing fails, continue capturing
+ pass
+ except Exception:
+ # Other errors, stop capturing
+ capture_json = False
+ except Exception:
+ pass
+ return None
+
+
+def create_ui():
+ """Create Gradio interface"""
+ # Load environment variables
+ env_vars = load_env_vars()
+
+ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue")) as app:
+ gr.Markdown(
+ """
+ # 🦉 OWL Intelligent Assistant Platform
+
+ Select a model and enter your question, the system will run the corresponding script and display the results.
+ """
+ )
+
+ with gr.Tabs():
+ with gr.TabItem("Run Mode"):
+ with gr.Row():
+ with gr.Column(scale=1):
+ # Ensure default value is a key that exists in SCRIPTS
+ default_script = list(SCRIPTS.keys())[0] if SCRIPTS else None
+ script_dropdown = gr.Dropdown(
+ choices=list(SCRIPTS.keys()),
+ value=default_script,
+ label="Select Mode",
+ )
+
+ script_info = gr.Textbox(
+ value=get_script_info(default_script)
+ if default_script
+ else "",
+ label="Model Description",
+ interactive=False,
+ )
+
+ script_dropdown.change(
+ fn=lambda x: get_script_info(x),
+ inputs=script_dropdown,
+ outputs=script_info,
+ )
+
+ question_input = gr.Textbox(
+ lines=8,
+ placeholder="Please enter your question...",
+ label="Question",
+ elem_id="question_input",
+ show_copy_button=True,
+ )
+
+ gr.Markdown(
+ """
+ > **Note**: Your question will replace the default question in the script. The system will automatically handle the replacement, ensuring your question is used correctly.
+ > Multi-line input is supported, line breaks will be preserved.
+ """
+ )
+
+ with gr.Row():
+ run_button = gr.Button("Run", variant="primary")
+ stop_button = gr.Button("Stop", variant="stop")
+
+ with gr.Column(scale=2):
+ with gr.Tabs():
+ with gr.TabItem("Results"):
+ status_output = gr.Textbox(label="Status")
+ answer_output = gr.Textbox(label="Answer", lines=10)
+ log_file_output = gr.Textbox(label="Log File Path")
+
+ with gr.TabItem("Run Logs"):
+ log_output = gr.Textbox(label="Complete Logs", lines=25)
+
+ with gr.TabItem("Chat History"):
+ chat_output = gr.Chatbot(label="Conversation History")
+
+ # Example questions
+ examples = [
+ [
+ "Qwen Mini (Chinese)",
+ "Browse Amazon and find a product that is attractive to programmers. Please provide the product name and price.",
+ ],
+ [
+ "DeepSeek (Chinese)",
+ "Please analyze the latest statistics of the CAMEL-AI project on GitHub. Find out the number of stars, number of contributors, and recent activity of the project. Then, create a simple Excel spreadsheet to display this data and generate a bar chart to visualize these metrics. Finally, summarize the popularity and development trends of the CAMEL project.",
+ ],
+ [
+ "Default",
+ "Navigate to Amazon.com and identify one product that is attractive to coders. Please provide me with the product name and price. No need to verify your answer.",
+ ],
+ ]
+
+ gr.Examples(examples=examples, inputs=[script_dropdown, question_input])
+
+ with gr.TabItem("Environment Variable Configuration"):
+ env_inputs = {}
+ save_status = gr.Textbox(label="Save Status", interactive=False)
+
+ # Add custom environment variables section
+ with gr.Accordion("Add Custom Environment Variables", open=True):
+ with gr.Row():
+ new_var_name = gr.Textbox(
+ label="Environment Variable Name",
+ placeholder="Example: MY_CUSTOM_API_KEY",
+ )
+ new_var_value = gr.Textbox(
+ label="Environment Variable Value",
+ placeholder="Enter value",
+ )
+ new_var_type = gr.Dropdown(
+ choices=["text", "password"], value="text", label="Type"
+ )
+
+ add_var_button = gr.Button(
+ "Add Environment Variable", variant="primary"
+ )
+ add_var_status = gr.Textbox(label="Add Status", interactive=False)
+
+ # Custom environment variables list
+ custom_vars_list = gr.JSON(
+ value=ENV_GROUPS["Custom Environment Variables"],
+ label="Added Custom Environment Variables",
+ visible=len(ENV_GROUPS["Custom Environment Variables"]) > 0,
+ )
+
+ # Update and delete custom environment variables section
+ with gr.Accordion(
+ "Update or Delete Custom Environment Variables",
+ open=True,
+ visible=len(ENV_GROUPS["Custom Environment Variables"]) > 0,
+ ) as update_delete_accordion:
+ with gr.Row():
+ # Create dropdown menu to display all custom environment variables
+ custom_var_dropdown = gr.Dropdown(
+ choices=[
+ var["name"]
+ for var in ENV_GROUPS["Custom Environment Variables"]
+ ],
+ label="Select Environment Variable",
+ interactive=True,
+ )
+ update_var_value = gr.Textbox(
+ label="New Environment Variable Value",
+ placeholder="Enter new value",
+ )
+ update_var_type = gr.Dropdown(
+ choices=["text", "password"], value="text", label="Type"
+ )
+
+ with gr.Row():
+ update_var_button = gr.Button(
+ "Update Environment Variable", variant="primary"
+ )
+ delete_var_button = gr.Button(
+ "Delete Environment Variable", variant="stop"
+ )
+
+ update_var_status = gr.Textbox(
+ label="Operation Status", interactive=False
+ )
+
+ # Add environment variable button click event
+ add_var_button.click(
+ fn=add_custom_env_var,
+ inputs=[new_var_name, new_var_value, new_var_type],
+ outputs=[add_var_status, custom_vars_list],
+ ).then(
+ fn=lambda vars: {"visible": len(vars) > 0},
+ inputs=[custom_vars_list],
+ outputs=[update_delete_accordion],
+ )
+
+ # Update environment variable button click event
+ update_var_button.click(
+ fn=update_custom_env_var,
+ inputs=[custom_var_dropdown, update_var_value, update_var_type],
+ outputs=[update_var_status, custom_vars_list],
+ )
+
+ # Delete environment variable button click event
+ delete_var_button.click(
+ fn=delete_custom_env_var,
+ inputs=[custom_var_dropdown],
+ outputs=[update_var_status, custom_vars_list],
+ ).then(
+ fn=lambda vars: {"visible": len(vars) > 0},
+ inputs=[custom_vars_list],
+ outputs=[update_delete_accordion],
+ )
+
+ # When custom environment variables list is updated, update dropdown menu options
+ custom_vars_list.change(
+ fn=lambda vars: {
+ "choices": [var["name"] for var in vars],
+ "value": None,
+ },
+ inputs=[custom_vars_list],
+ outputs=[custom_var_dropdown],
+ )
+
+ # Existing environment variable configuration
+ for group_name, vars in ENV_GROUPS.items():
+ if (
+ group_name != "Custom Environment Variables" or len(vars) > 0
+ ): # Only show non-empty custom environment variable groups
+ with gr.Accordion(
+ group_name,
+ open=(group_name != "Custom Environment Variables"),
+ ):
+ for var in vars:
+ # Add help information
+ gr.Markdown(f"**{var['help']}**")
+
+ if var["type"] == "password":
+ env_inputs[var["name"]] = gr.Textbox(
+ value=env_vars.get(var["name"], ""),
+ label=var["label"],
+ placeholder=f"Please enter {var['label']}",
+ type="password",
+ )
+ else:
+ env_inputs[var["name"]] = gr.Textbox(
+ value=env_vars.get(var["name"], ""),
+ label=var["label"],
+ placeholder=f"Please enter {var['label']}",
+ )
+
+ save_button = gr.Button("Save Environment Variables", variant="primary")
+
+ # Save environment variables
+ save_inputs = [
+ env_inputs[var_name]
+ for group in ENV_GROUPS.values()
+ for var in group
+ for var_name in [var["name"]]
+ if var_name in env_inputs
+ ]
+ save_button.click(
+ fn=lambda *values: save_env_vars(
+ dict(
+ zip(
+ [
+ var["name"]
+ for group in ENV_GROUPS.values()
+ for var in group
+ if var["name"] in env_inputs
+ ],
+ values,
+ )
+ )
+ ),
+ inputs=save_inputs,
+ outputs=save_status,
+ )
+
+ # Run script
+ run_button.click(
+ fn=run_script,
+ inputs=[script_dropdown, question_input],
+ outputs=[
+ status_output,
+ answer_output,
+ log_output,
+ log_file_output,
+ chat_output,
+ ],
+ show_progress=True,
+ )
+
+ # Terminate execution
+ stop_button.click(fn=terminate_process, inputs=[], outputs=[status_output])
+
+ # Add footer
+ gr.Markdown(
+ """
+ ### 📝 Instructions
+
+ - Select a model and enter your question
+ - Click the "Run" button to start execution
+ - To stop execution, click the "Stop" button
+ - View execution status and answers in the "Results" tab
+ - View complete logs in the "Run Logs" tab
+ - View conversation history in the "Chat History" tab (if available)
+ - Configure API keys and other environment variables in the "Environment Variable Configuration" tab
+ - You can add custom environment variables to meet special requirements
+
+ ### ⚠️ Notes
+
+ - Running some models may require API keys, please make sure you have set the corresponding environment variables in the "Environment Variable Configuration" tab
+ - Some scripts may take a long time to run, please be patient
+ - If execution exceeds 30 minutes, the process will automatically terminate
+ - Your question will replace the default question in the script, ensure the question is compatible with the selected model
+ """
+ )
+
+ return app
+
+
+if __name__ == "__main__":
+ # Create and launch the application
+ app = create_ui()
+ app.queue().launch(share=True)
diff --git a/owl/run.py b/owl/run.py
index 3ba9206..823dc08 100644
--- a/owl/run.py
+++ b/owl/run.py
@@ -21,6 +21,7 @@ from camel.toolkits import (
SearchToolkit,
VideoAnalysisToolkit,
WebToolkit,
+ FileWriteToolkit,
)
from camel.types import ModelPlatformType, ModelType
from camel.logger import set_log_level
@@ -97,6 +98,7 @@ def construct_society(question: str) -> OwlRolePlaying:
SearchToolkit().search_wiki,
*ExcelToolkit().get_tools(),
*DocumentProcessingToolkit(model=models["document"]).get_tools(),
+ *FileWriteToolkit(output_dir="./").get_tools(),
]
# Configure agent roles and parameters
diff --git a/owl/run_deepseek_zh.py b/owl/run_deepseek_zh.py
index e7bad12..52b4c34 100644
--- a/owl/run_deepseek_zh.py
+++ b/owl/run_deepseek_zh.py
@@ -23,9 +23,10 @@ from dotenv import load_dotenv
from camel.models import ModelFactory
from camel.toolkits import (
- CodeExecutionToolkit,
ExcelToolkit,
SearchToolkit,
+ FileWriteToolkit,
+ CodeExecutionToolkit,
)
from camel.types import ModelPlatformType, ModelType
@@ -61,31 +62,6 @@ def construct_society(question: str) -> OwlRolePlaying:
model_type=ModelType.DEEPSEEK_CHAT,
model_config_dict={"temperature": 0},
),
- "web": ModelFactory.create(
- model_platform=ModelPlatformType.DEEPSEEK,
- model_type=ModelType.DEEPSEEK_CHAT,
- model_config_dict={"temperature": 0},
- ),
- "planning": ModelFactory.create(
- model_platform=ModelPlatformType.DEEPSEEK,
- model_type=ModelType.DEEPSEEK_CHAT,
- model_config_dict={"temperature": 0},
- ),
- "video": ModelFactory.create(
- model_platform=ModelPlatformType.DEEPSEEK,
- model_type=ModelType.DEEPSEEK_CHAT,
- model_config_dict={"temperature": 0},
- ),
- "image": ModelFactory.create(
- model_platform=ModelPlatformType.DEEPSEEK,
- model_type=ModelType.DEEPSEEK_CHAT,
- model_config_dict={"temperature": 0},
- ),
- "document": ModelFactory.create(
- model_platform=ModelPlatformType.DEEPSEEK,
- model_type=ModelType.DEEPSEEK_CHAT,
- model_config_dict={"temperature": 0},
- ),
}
# Configure toolkits
@@ -94,7 +70,7 @@ def construct_society(question: str) -> OwlRolePlaying:
SearchToolkit().search_duckduckgo,
SearchToolkit().search_wiki,
*ExcelToolkit().get_tools(),
- *DocumentProcessingToolkit(model=models["document"]).get_tools(),
+ *FileWriteToolkit(output_dir="./").get_tools(),
]
# Configure agent roles and parameters
@@ -124,9 +100,7 @@ def main():
r"""Main function to run the OWL system with an example question."""
# Example research question
question = (
- "请分析GitHub上CAMEL-AI项目的最新统计数据。找出该项目的星标数量、"
- "贡献者数量和最近的活跃度。然后,创建一个简单的Excel表格来展示这些数据,"
- "并生成一个柱状图来可视化这些指标。最后,总结CAMEL项目的受欢迎程度和发展趋势。"
+ "搜索OWL项目最近的新闻并生成一篇报告,最后保存到本地。"
)
# Construct and run the society
diff --git a/owl/run_gaia_roleplaying.py b/owl/run_gaia_roleplaying.py
index 652ccc2..d375c4c 100644
--- a/owl/run_gaia_roleplaying.py
+++ b/owl/run_gaia_roleplaying.py
@@ -27,6 +27,7 @@ from camel.toolkits import (
SearchToolkit,
VideoAnalysisToolkit,
WebToolkit,
+ FileWriteToolkit,
)
from camel.types import ModelPlatformType, ModelType
from camel.configs import ChatGPTConfig
@@ -51,6 +52,8 @@ def main():
# Create cache directory
cache_dir = "tmp/"
os.makedirs(cache_dir, exist_ok=True)
+ result_dir = "results/"
+ os.makedirs(result_dir, exist_ok=True)
# Create models for different components
models = {
@@ -101,6 +104,7 @@ def main():
*ImageAnalysisToolkit(model=models["image"]).get_tools(),
*SearchToolkit().get_tools(),
*ExcelToolkit().get_tools(),
+ *FileWriteToolkit(output_dir="./").get_tools(),
]
# Configure agent roles and parameters
@@ -127,8 +131,8 @@ def main():
)
# Output results
- logger.success(f"Correct: {result['correct']}, Total: {result['total']}")
- logger.success(f"Accuracy: {result['accuracy']}")
+ logger.info(f"Correct: {result['correct']}, Total: {result['total']}")
+ logger.info(f"Accuracy: {result['accuracy']}")
if __name__ == "__main__":
diff --git a/owl/run_mini.py b/owl/run_mini.py
index 22539b3..82fa2b7 100644
--- a/owl/run_mini.py
+++ b/owl/run_mini.py
@@ -17,6 +17,7 @@ from camel.models import ModelFactory
from camel.toolkits import (
SearchToolkit,
WebToolkit,
+ FileWriteToolkit,
)
from camel.types import ModelPlatformType, ModelType
from camel.logger import set_log_level
@@ -71,6 +72,7 @@ def construct_society(question: str) -> OwlRolePlaying:
).get_tools(),
SearchToolkit().search_duckduckgo,
SearchToolkit().search_wiki,
+ *FileWriteToolkit(output_dir="./").get_tools(),
]
# Configure agent roles and parameters
diff --git a/owl/run_ollama.py b/owl/run_ollama.py
new file mode 100644
index 0000000..5f45090
--- /dev/null
+++ b/owl/run_ollama.py
@@ -0,0 +1,133 @@
+# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
+# run_ollama.py by tj-scripts(https://github.com/tj-scripts)
+
+from dotenv import load_dotenv
+from camel.models import ModelFactory
+from camel.toolkits import (
+ CodeExecutionToolkit,
+ ExcelToolkit,
+ ImageAnalysisToolkit,
+ SearchToolkit,
+ WebToolkit,
+ FileWriteToolkit,
+)
+from camel.types import ModelPlatformType
+
+from utils import OwlRolePlaying, run_society
+
+from camel.logger import set_log_level
+
+set_log_level(level="DEBUG")
+
+load_dotenv()
+
+
+def construct_society(question: str) -> OwlRolePlaying:
+ r"""Construct a society of agents based on the given question.
+
+ Args:
+ question (str): The task or question to be addressed by the society.
+
+ Returns:
+ OwlRolePlaying: A configured society of agents ready to address the question.
+ """
+
+ # Create models for different components
+ models = {
+ "user": ModelFactory.create(
+ model_platform=ModelPlatformType.OLLAMA,
+ model_type="qwen2.5:72b",
+ url="http://localhost:11434/v1",
+ model_config_dict={"temperature": 0.8, "max_tokens": 1000000},
+ ),
+ "assistant": ModelFactory.create(
+ model_platform=ModelPlatformType.OLLAMA,
+ model_type="qwen2.5:72b",
+ url="http://localhost:11434/v1",
+ model_config_dict={"temperature": 0.2, "max_tokens": 1000000},
+ ),
+ "web": ModelFactory.create(
+ model_platform=ModelPlatformType.OLLAMA,
+ model_type="llava:latest",
+ url="http://localhost:11434/v1",
+ model_config_dict={"temperature": 0.4, "max_tokens": 1000000},
+ ),
+ "planning": ModelFactory.create(
+ model_platform=ModelPlatformType.OLLAMA,
+ model_type="qwen2.5:72b",
+ url="http://localhost:11434/v1",
+ model_config_dict={"temperature": 0.4, "max_tokens": 1000000},
+ ),
+ "image": ModelFactory.create(
+ model_platform=ModelPlatformType.OLLAMA,
+ model_type="llava:latest",
+ url="http://localhost:11434/v1",
+ model_config_dict={"temperature": 0.4, "max_tokens": 1000000},
+ ),
+ }
+
+ # Configure toolkits
+ tools = [
+ *WebToolkit(
+ headless=False, # Set to True for headless mode (e.g., on remote servers)
+ web_agent_model=models["web"],
+ planning_agent_model=models["planning"],
+ ).get_tools(),
+ *CodeExecutionToolkit(sandbox="subprocess", verbose=True).get_tools(),
+ *ImageAnalysisToolkit(model=models["image"]).get_tools(),
+ SearchToolkit().search_duckduckgo,
+ # SearchToolkit().search_google, # Comment this out if you don't have google search
+ SearchToolkit().search_wiki,
+ *ExcelToolkit().get_tools(),
+ *FileWriteToolkit(output_dir="./").get_tools(),
+ ]
+
+ # Configure agent roles and parameters
+ user_agent_kwargs = {"model": models["user"]}
+ assistant_agent_kwargs = {"model": models["assistant"], "tools": tools}
+
+ # Configure task parameters
+ task_kwargs = {
+ "task_prompt": question,
+ "with_task_specify": False,
+ }
+
+ # Create and return the society
+ society = OwlRolePlaying(
+ **task_kwargs,
+ user_role_name="user",
+ user_agent_kwargs=user_agent_kwargs,
+ assistant_role_name="assistant",
+ assistant_agent_kwargs=assistant_agent_kwargs,
+ )
+
+ return society
+
+
+def main():
+ r"""Main function to run the OWL system with an example question."""
+ # Example research question
+ question = "Navigate to Amazon.com and identify one product that is attractive to coders. Please provide me with the product name and price. No need to verify your answer."
+
+ # Construct and run the society
+ society = construct_society(question)
+ answer, chat_history, token_count = run_society(society)
+
+ # Output the result
+ print(f"\033[94mAnswer: {answer}\033[0m")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/owl/run_openai_compatiable_model.py b/owl/run_openai_compatiable_model.py
index a9cab9a..fa8a08e 100644
--- a/owl/run_openai_compatiable_model.py
+++ b/owl/run_openai_compatiable_model.py
@@ -21,6 +21,7 @@ from camel.toolkits import (
ImageAnalysisToolkit,
SearchToolkit,
WebToolkit,
+ FileWriteToolkit,
)
from camel.types import ModelPlatformType
@@ -95,6 +96,7 @@ def construct_society(question: str) -> OwlRolePlaying:
SearchToolkit().search_google, # Comment this out if you don't have google search
SearchToolkit().search_wiki,
*ExcelToolkit().get_tools(),
+ *FileWriteToolkit(output_dir="./").get_tools(),
]
# Configure agent roles and parameters
diff --git a/owl/run_qwen_mini_zh.py b/owl/run_qwen_mini_zh.py
index 884c041..d48298a 100644
--- a/owl/run_qwen_mini_zh.py
+++ b/owl/run_qwen_mini_zh.py
@@ -19,7 +19,7 @@
from dotenv import load_dotenv
from camel.models import ModelFactory
-from camel.toolkits import WebToolkit, SearchToolkit
+from camel.toolkits import WebToolkit, SearchToolkit, FileWriteToolkit
from camel.types import ModelPlatformType, ModelType
from utils import OwlRolePlaying, run_society
@@ -39,19 +39,19 @@ def construct_society(question: str) -> OwlRolePlaying:
user_model = ModelFactory.create(
model_platform=ModelPlatformType.QWEN,
- model_type=ModelType.QWEN_VL_MAX,
+ model_type=ModelType.QWEN_MAX,
model_config_dict={"temperature": 0},
)
assistant_model = ModelFactory.create(
model_platform=ModelPlatformType.QWEN,
- model_type=ModelType.QWEN_VL_MAX,
+ model_type=ModelType.QWEN_MAX,
model_config_dict={"temperature": 0},
)
planning_model = ModelFactory.create(
model_platform=ModelPlatformType.QWEN,
- model_type=ModelType.QWEN_VL_MAX,
+ model_type=ModelType.QWEN_MAX,
model_config_dict={"temperature": 0},
)
@@ -69,6 +69,7 @@ def construct_society(question: str) -> OwlRolePlaying:
output_language="Chinese",
).get_tools(),
SearchToolkit().search_duckduckgo,
+ *FileWriteToolkit(output_dir="./").get_tools(),
]
user_role_name = "user"
diff --git a/owl/run_qwen_zh.py b/owl/run_qwen_zh.py
index 2271a45..fb3106f 100644
--- a/owl/run_qwen_zh.py
+++ b/owl/run_qwen_zh.py
@@ -25,6 +25,7 @@ from camel.toolkits import (
SearchToolkit,
VideoAnalysisToolkit,
WebToolkit,
+ FileWriteToolkit,
)
from camel.types import ModelPlatformType, ModelType
@@ -52,12 +53,12 @@ def construct_society(question: str) -> OwlRolePlaying:
models = {
"user": ModelFactory.create(
model_platform=ModelPlatformType.QWEN,
- model_type=ModelType.QWEN_VL_MAX,
+ model_type=ModelType.QWEN_MAX,
model_config_dict={"temperature": 0},
),
"assistant": ModelFactory.create(
model_platform=ModelPlatformType.QWEN,
- model_type=ModelType.QWEN_VL_MAX,
+ model_type=ModelType.QWEN_MAX,
model_config_dict={"temperature": 0},
),
"web": ModelFactory.create(
@@ -67,7 +68,7 @@ def construct_society(question: str) -> OwlRolePlaying:
),
"planning": ModelFactory.create(
model_platform=ModelPlatformType.QWEN,
- model_type=ModelType.QWEN_VL_MAX,
+ model_type=ModelType.QWEN_MAX,
model_config_dict={"temperature": 0},
),
"video": ModelFactory.create(
@@ -103,6 +104,7 @@ def construct_society(question: str) -> OwlRolePlaying:
SearchToolkit().search_wiki,
*ExcelToolkit().get_tools(),
*DocumentProcessingToolkit(model=models["document"]).get_tools(),
+ *FileWriteToolkit(output_dir="./").get_tools(),
]
# Configure agent roles and parameters
diff --git a/owl/run_terminal.py b/owl/run_terminal.py
new file mode 100644
index 0000000..94a0b26
--- /dev/null
+++ b/owl/run_terminal.py
@@ -0,0 +1,120 @@
+# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
+from dotenv import load_dotenv
+import os
+from camel.models import ModelFactory
+from camel.toolkits import (
+ SearchToolkit,
+ WebToolkit,
+ FileWriteToolkit,
+ TerminalToolkit
+)
+from camel.types import ModelPlatformType, ModelType
+from camel.logger import set_log_level
+
+from utils import OwlRolePlaying, run_society
+
+load_dotenv()
+set_log_level(level="DEBUG")
+# Get current script directory
+base_dir = os.path.dirname(os.path.abspath(__file__))
+
+def construct_society(question: str) -> OwlRolePlaying:
+ r"""Construct a society of agents based on the given question.
+
+ Args:
+ question (str): The task or question to be addressed by the society.
+
+ Returns:
+ OwlRolePlaying: A configured society of agents ready to address the
+ question.
+ """
+
+ # Create models for different components
+ models = {
+ "user": ModelFactory.create(
+ model_platform=ModelPlatformType.OPENAI,
+ model_type=ModelType.GPT_4O,
+ model_config_dict={"temperature": 0},
+ ),
+ "assistant": ModelFactory.create(
+ model_platform=ModelPlatformType.OPENAI,
+ model_type=ModelType.GPT_4O,
+ model_config_dict={"temperature": 0},
+ ),
+ "web": ModelFactory.create(
+ model_platform=ModelPlatformType.OPENAI,
+ model_type=ModelType.GPT_4O,
+ model_config_dict={"temperature": 0},
+ ),
+ "planning": ModelFactory.create(
+ model_platform=ModelPlatformType.OPENAI,
+ model_type=ModelType.GPT_4O,
+ model_config_dict={"temperature": 0},
+ ),
+ }
+
+ # Configure toolkits
+ tools = [
+ *WebToolkit(
+ headless=False, # Set to True for headless mode (e.g., on remote servers)
+ web_agent_model=models["web"],
+ planning_agent_model=models["planning"],
+ ).get_tools(),
+ SearchToolkit().search_duckduckgo,
+ SearchToolkit().search_wiki,
+ *FileWriteToolkit(output_dir="./").get_tools(),
+ *TerminalToolkit().get_tools(),
+ ]
+
+ # Configure agent roles and parameters
+ user_agent_kwargs = {"model": models["user"]}
+ assistant_agent_kwargs = {"model": models["assistant"], "tools": tools}
+
+ # Configure task parameters
+ task_kwargs = {
+ "task_prompt": question,
+ "with_task_specify": False,
+ }
+
+ # Create and return the society
+ society = OwlRolePlaying(
+ **task_kwargs,
+ user_role_name="user",
+ user_agent_kwargs=user_agent_kwargs,
+ assistant_role_name="assistant",
+ assistant_agent_kwargs=assistant_agent_kwargs,
+ )
+
+ return society
+
+
+def main():
+ r"""Main function to run the OWL system with an example question."""
+ # Example research question
+ question = f"""Open Google Search, summarize the number of GitHub stars, forks, etc., of the camel framework of camel-ai,
+ and write the numbers into a Python file using the plot package,
+ save it to "+{os.path.join(base_dir, 'final_output')}+",
+ and execute the Python file with the local terminal to display the graph for me."""
+
+ # Construct and run the society
+ society = construct_society(question)
+ answer, chat_history, token_count = run_society(society)
+
+ # Output the result
+ print(f"\033[94mAnswer: {answer}\nChat History: {chat_history}\ntoken_count:{token_count}\033[0m")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/owl/run_terminal_zh.py b/owl/run_terminal_zh.py
new file mode 100644
index 0000000..48fc1ed
--- /dev/null
+++ b/owl/run_terminal_zh.py
@@ -0,0 +1,119 @@
+# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
+from dotenv import load_dotenv
+
+from camel.models import ModelFactory
+from camel.toolkits import (
+ SearchToolkit,
+ WebToolkit,
+ FileWriteToolkit,
+ TerminalToolkit
+)
+from camel.types import ModelPlatformType, ModelType
+from camel.logger import set_log_level
+
+from utils import OwlRolePlaying, run_society
+
+load_dotenv()
+set_log_level(level="DEBUG")
+import os
+# Get current script directory
+base_dir = os.path.dirname(os.path.abspath(__file__))
+
+def construct_society(question: str) -> OwlRolePlaying:
+ r"""Construct a society of agents based on the given question.
+
+ Args:
+ question (str): The task or question to be addressed by the society.
+
+ Returns:
+ OwlRolePlaying: A configured society of agents ready to address the
+ question.
+ """
+
+ # Create models for different components
+ models = {
+ "user": ModelFactory.create(
+ model_platform=ModelPlatformType.OPENAI,
+ model_type=ModelType.GPT_4O,
+ model_config_dict={"temperature": 0},
+ ),
+ "assistant": ModelFactory.create(
+ model_platform=ModelPlatformType.OPENAI,
+ model_type=ModelType.GPT_4O,
+ model_config_dict={"temperature": 0},
+ ),
+ "web": ModelFactory.create(
+ model_platform=ModelPlatformType.OPENAI,
+ model_type=ModelType.GPT_4O,
+ model_config_dict={"temperature": 0},
+ ),
+ "planning": ModelFactory.create(
+ model_platform=ModelPlatformType.OPENAI,
+ model_type=ModelType.GPT_4O,
+ model_config_dict={"temperature": 0},
+ ),
+ }
+
+ # Configure toolkits
+ tools = [
+ *WebToolkit(
+ headless=False, # Set to True for headless mode (e.g., on remote servers)
+ web_agent_model=models["web"],
+ planning_agent_model=models["planning"],
+ ).get_tools(),
+ SearchToolkit().search_duckduckgo,
+ SearchToolkit().search_wiki,
+ *FileWriteToolkit(output_dir="./").get_tools(),
+ *TerminalToolkit().get_tools(),
+ ]
+
+ # Configure agent roles and parameters
+ user_agent_kwargs = {"model": models["user"]}
+ assistant_agent_kwargs = {"model": models["assistant"], "tools": tools}
+
+ # Configure task parameters
+ task_kwargs = {
+ "task_prompt": question,
+ "with_task_specify": False,
+ }
+
+ # Create and return the society
+ society = OwlRolePlaying(
+ **task_kwargs,
+ user_role_name="user",
+ user_agent_kwargs=user_agent_kwargs,
+ assistant_role_name="assistant",
+ assistant_agent_kwargs=assistant_agent_kwargs,
+ )
+
+ return society
+
+
+def main():
+ r"""Main function to run the OWL system with an example question."""
+ # Example research question
+ question = f"""打开百度搜索,总结一下camel-ai的camel框架的github star、fork数目等,并把数字用plot包写成python文件保存到"+{os.path.join
+(base_dir, 'final_output')}+",用本地终端执行python文件显示图出来给我"""
+
+ # Construct and run the society
+ society = construct_society(question)
+ answer, chat_history, token_count = run_society(society)
+
+ # Output the result
+ print(f"\033[94mAnswer: {answer}\nChat History: {chat_history}\ntoken_count:{token_count}\033[0m")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/owl/script_adapter.py b/owl/script_adapter.py
index 4f796dc..fff8ddb 100644
--- a/owl/script_adapter.py
+++ b/owl/script_adapter.py
@@ -68,7 +68,11 @@ def run_script_with_env_question(script_name):
# 转义问题中的特殊字符
escaped_question = (
- question.replace("\\", "\\\\").replace('"', '\\"').replace("'", "\\'")
+ question.replace("\\", "\\\\")
+ .replace('"', '\\"')
+ .replace("'", "\\'")
+ .replace("\n", "\\n") # 转义换行符
+ .replace("\r", "\\r") # 转义回车符
)
# 查找脚本中所有的question赋值 - 改进的正则表达式
diff --git a/owl/utils/enhanced_role_playing.py b/owl/utils/enhanced_role_playing.py
index 0382773..fe14efe 100644
--- a/owl/utils/enhanced_role_playing.py
+++ b/owl/utils/enhanced_role_playing.py
@@ -193,7 +193,7 @@ Please note that our overall task may be very complicated. Here are some tips th
- When trying to solve math problems, you can try to write python code and use sympy library to solve the problem.
- Always verify the accuracy of your final answers! Try cross-checking the answers by other ways. (e.g., screenshots, webpage analysis, etc.).
- Do not be overly confident in your own knowledge. Searching can provide a broader perspective and help validate existing knowledge.
-- After writing codes, do not forget to run the code and get the result. If it encounters an error, try to debug it.
+- After writing codes, do not forget to run the code and get the result. If it encounters an error, try to debug it. Also, bear in mind that the code execution environment does not support interactive input.
- When a tool fails to run, or the code does not run correctly, never assume that it returns the correct result and continue to reason based on the assumption, because the assumed result cannot lead you to the correct answer. The right way is to think about the reason for the error and try again.
- Search results typically do not provide precise answers. It is not likely to find the answer directly using search toolkit only, the search query should be concise and focuses on finding sources rather than direct answers, as it always need to use other tools to further process the url, e.g. interact with the webpage, extract webpage content, etc.
- For downloading files, you can either use the web browser simulation toolkit or write codes.
@@ -369,11 +369,6 @@ class OwlGAIARolePlaying(OwlRolePlaying):
),
)
user_msg = self._reduce_message_options(user_response.msgs)
- if (
- "n" in self.user_agent.model_config_dict.keys()
- and self.user_agent.model_config_dict["n"] > 1
- ):
- self.user_agent.record_message(user_msg)
modified_user_msg = deepcopy(user_msg)
diff --git a/owl/utils/gaia.py b/owl/utils/gaia.py
index ec12ce6..07f1827 100644
--- a/owl/utils/gaia.py
+++ b/owl/utils/gaia.py
@@ -195,7 +195,7 @@ class GAIABenchmark(BaseBenchmark):
# Process tasks
for task in tqdm(datas, desc="Running"):
if self._check_task_completed(task["task_id"]):
- logger.success(
+ logger.info(
f"The following task is already completed:\n task id: {task['task_id']}, question: {task['Question']}"
)
continue
diff --git a/pyproject.toml b/pyproject.toml
index 92bd475..2fa6908 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -21,7 +21,7 @@ keywords = [
"learning-systems"
]
dependencies = [
- "camel-ai[all]==0.2.23",
+ "camel-ai[all]==0.2.27",
"chunkr-ai>=0.0.41",
"docx2markdown>=0.1.1",
"gradio>=3.50.2",
diff --git a/requirements.txt b/requirements.txt
index d281407..644a765 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,4 @@
-camel-ai[all]==0.2.26
+camel-ai[all]==0.2.27
chunkr-ai>=0.0.41
docx2markdown>=0.1.1
gradio>=3.50.2
diff --git a/run_app.py b/run_app.py
index f33f8f6..ccea485 100644
--- a/run_app.py
+++ b/run_app.py
@@ -15,40 +15,43 @@
# -*- coding: utf-8 -*-
"""
-OWL 智能助手运行平台启动脚本
+OWL Intelligent Assistant Platform Launch Script
"""
import os
import sys
from pathlib import Path
+os.environ['PYTHONIOENCODING'] = 'utf-8'
def main():
- """主函数,启动OWL智能助手运行平台"""
- # 确保当前目录是项目根目录
+ """Main function to launch the OWL Intelligent Assistant Platform"""
+ # Ensure the current directory is the project root
project_root = Path(__file__).resolve().parent
os.chdir(project_root)
- # 创建日志目录
+ # Create log directory
log_dir = project_root / "logs"
log_dir.mkdir(exist_ok=True)
- # 导入并运行应用
+ # Add project root to Python path
sys.path.insert(0, str(project_root))
try:
- from owl.app import create_ui
+ from owl.app_en import create_ui
- # 创建并启动应用
+ # Create and launch the application
app = create_ui()
app.queue().launch(share=False)
except ImportError as e:
- print(f"错误: 无法导入必要的模块。请确保已安装所有依赖项: {e}")
- print("提示: 运行 'pip install -r requirements.txt' 安装所有依赖项")
+ print(
+ f"Error: Unable to import necessary modules. Please ensure all dependencies are installed: {e}"
+ )
+ print("Tip: Run 'pip install -r requirements.txt' to install all dependencies")
sys.exit(1)
except Exception as e:
- print(f"启动应用程序时出错: {e}")
+ print(f"Error occurred while starting the application: {e}")
import traceback
traceback.print_exc()
diff --git a/run_app_zh.py b/run_app_zh.py
new file mode 100644
index 0000000..0ec4e7b
--- /dev/null
+++ b/run_app_zh.py
@@ -0,0 +1,60 @@
+# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+OWL 智能助手运行平台启动脚本
+"""
+
+import os
+import sys
+from pathlib import Path
+
+os.environ['PYTHONIOENCODING'] = 'utf-8'
+
+def main():
+ """主函数,启动OWL智能助手运行平台"""
+ # 确保当前目录是项目根目录
+ project_root = Path(__file__).resolve().parent
+ os.chdir(project_root)
+
+ # 创建日志目录
+ log_dir = project_root / "logs"
+ log_dir.mkdir(exist_ok=True)
+
+ # 导入并运行应用
+ sys.path.insert(0, str(project_root))
+
+ try:
+ from owl.app import create_ui
+
+ # 创建并启动应用
+ app = create_ui()
+ app.queue().launch(share=False)
+
+ except ImportError as e:
+ print(f"错误: 无法导入必要的模块。请确保已安装所有依赖项: {e}")
+ print("提示: 运行 'pip install -r requirements.txt' 安装所有依赖项")
+ sys.exit(1)
+ except Exception as e:
+ print(f"启动应用程序时出错: {e}")
+ import traceback
+
+ traceback.print_exc()
+ sys.exit(1)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/uv.lock b/uv.lock
index 633a78e..5bb2dee 100644
--- a/uv.lock
+++ b/uv.lock
@@ -204,7 +204,7 @@ wheels = [
[[package]]
name = "anthropic"
-version = "0.42.0"
+version = "0.49.0"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "anyio" },
@@ -215,9 +215,9 @@ dependencies = [
{ name = "sniffio" },
{ name = "typing-extensions" },
]
-sdist = { url = "https://files.pythonhosted.org/packages/e7/7c/91b79f5ae4a52497a4e330d66ea5929aec2878ee2c9f8a998dbe4f4c7f01/anthropic-0.42.0.tar.gz", hash = "sha256:bf8b0ed8c8cb2c2118038f29c58099d2f99f7847296cafdaa853910bfff4edf4", size = 192361 }
+sdist = { url = "https://files.pythonhosted.org/packages/86/e3/a88c8494ce4d1a88252b9e053607e885f9b14d0a32273d47b727cbee4228/anthropic-0.49.0.tar.gz", hash = "sha256:c09e885b0f674b9119b4f296d8508907f6cff0009bc20d5cf6b35936c40b4398", size = 210016 }
wheels = [
- { url = "https://files.pythonhosted.org/packages/ba/33/b907a6d27dd0d8d3adb4edb5c9e9c85a189719ec6855051cce3814c8ef13/anthropic-0.42.0-py3-none-any.whl", hash = "sha256:46775f65b723c078a2ac9e9de44a46db5c6a4fabeacfd165e5ea78e6817f4eff", size = 203365 },
+ { url = "https://files.pythonhosted.org/packages/76/74/5d90ad14d55fbe3f9c474fdcb6e34b4bed99e3be8efac98734a5ddce88c1/anthropic-0.49.0-py3-none-any.whl", hash = "sha256:bbc17ad4e7094988d2fa86b87753ded8dce12498f4b85fe5810f208f454a8375", size = 243368 },
]
[[package]]
@@ -482,7 +482,7 @@ wheels = [
[[package]]
name = "camel-ai"
-version = "0.2.23"
+version = "0.2.27"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "colorama" },
@@ -499,9 +499,9 @@ dependencies = [
{ name = "pyyaml" },
{ name = "tiktoken" },
]
-sdist = { url = "https://files.pythonhosted.org/packages/3d/9a/1f84038e2a3a1a84fdfb3a0218218cd239b9847943b20be2566e579359b6/camel_ai-0.2.23.tar.gz", hash = "sha256:a951d89426134c1a505e43850671abb154ff4e1a338fb65a56478843280f45d5", size = 423182 }
+sdist = { url = "https://files.pythonhosted.org/packages/ff/27/2bce666ae7f7d0db276d037b3afe84a460e782438e5cacc08de20417233b/camel_ai-0.2.27.tar.gz", hash = "sha256:4689245ad48f51e5e602d2651cf463afe212bcf046633a19c2189574c1f3481a", size = 441363 }
wheels = [
- { url = "https://files.pythonhosted.org/packages/3a/0f/e1868fd7bf60846df657610c7d061b0516f5f87b05007d426ae6ab590754/camel_ai-0.2.23-py3-none-any.whl", hash = "sha256:b19af2a102370ac2ef77fa1ae99e7f291d01c84e8c4f42b2b31c6930db78b8c0", size = 722446 },
+ { url = "https://files.pythonhosted.org/packages/b0/fa/94f5b41cb6babc81aac00494b170ec2bea058b6c00f477ceb3e886c49177/camel_ai-0.2.27-py3-none-any.whl", hash = "sha256:c4a6597791faf2f2161c56c2579e60850557b126135b29af77ebd08fa0774e0b", size = 746387 },
]
[package.optional-dependencies]
@@ -524,6 +524,7 @@ all = [
{ name = "diffusers" },
{ name = "discord-py" },
{ name = "docker" },
+ { name = "docx" },
{ name = "docx2txt" },
{ name = "duckduckgo-search" },
{ name = "e2b-code-interpreter" },
@@ -531,6 +532,7 @@ all = [
{ name = "ffmpeg-python" },
{ name = "firecrawl-py" },
{ name = "fish-audio-sdk" },
+ { name = "fpdf" },
{ name = "google-cloud-storage" },
{ name = "googlemaps" },
{ name = "gradio" },
@@ -540,6 +542,7 @@ all = [
{ name = "jupyter-client" },
{ name = "linkup-sdk" },
{ name = "litellm" },
+ { name = "mcp" },
{ name = "mistralai" },
{ name = "mock" },
{ name = "mypy" },
@@ -592,6 +595,7 @@ all = [
{ name = "transformers" },
{ name = "tree-sitter" },
{ name = "tree-sitter-python" },
+ { name = "typer" },
{ name = "types-colorama" },
{ name = "types-mock" },
{ name = "types-pyyaml" },
@@ -1213,6 +1217,16 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/8f/d7/9322c609343d929e75e7e5e6255e614fcc67572cfd083959cdef3b7aad79/docutils-0.21.2-py3-none-any.whl", hash = "sha256:dafca5b9e384f0e419294eb4d2ff9fa826435bf15f15b7bd45723e8ad76811b2", size = 587408 },
]
+[[package]]
+name = "docx"
+version = "0.2.4"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "lxml" },
+ { name = "pillow" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/4a/8e/5a01644697b03016de339ef444cfff28367f92984dc74eddaab1ed60eada/docx-0.2.4.tar.gz", hash = "sha256:9d7595eac6e86cda0b7136a2995318d039c1f3eaa368a3300805abbbe5dc8877", size = 54925 }
+
[[package]]
name = "docx2markdown"
version = "0.1.1"
@@ -1540,6 +1554,12 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/bf/ff/44934a031ce5a39125415eb405b9efb76fe7f9586b75291d66ae5cbfc4e6/fonttools-4.56.0-py3-none-any.whl", hash = "sha256:1088182f68c303b50ca4dc0c82d42083d176cba37af1937e1a976a31149d4d14", size = 1089800 },
]
+[[package]]
+name = "fpdf"
+version = "1.7.2"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/37/c6/608a9e6c172bf9124aa687ec8b9f0e8e5d697d59a5f4fad0e2d5ec2a7556/fpdf-1.7.2.tar.gz", hash = "sha256:125840783289e7d12552b1e86ab692c37322e7a65b96a99e0ea86cca041b6779", size = 39504 }
+
[[package]]
name = "free-proxy"
version = "1.1.3"
@@ -2653,6 +2673,18 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/83/29/00b9b0322a473aee6cda87473401c9abb19506cd650cc69a8aa38277ea74/lxml-5.3.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:48fd46bf7155def2e15287c6f2b133a2f78e2d22cdf55647269977b873c65499", size = 3487718 },
]
+[[package]]
+name = "markdown-it-py"
+version = "3.0.0"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "mdurl" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/38/71/3b932df36c1a044d397a1f92d1cf91ee0a503d91e470cbd670aa66b07ed0/markdown-it-py-3.0.0.tar.gz", hash = "sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb", size = 74596 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/42/d7/1ec15b46af6af88f19b8e5ffea08fa375d433c998b8a7639e76935c14f1f/markdown_it_py-3.0.0-py3-none-any.whl", hash = "sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1", size = 87528 },
+]
+
[[package]]
name = "markupsafe"
version = "2.1.5"
@@ -2755,6 +2787,34 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/8f/8e/9ad090d3553c280a8060fbf6e24dc1c0c29704ee7d1c372f0c174aa59285/matplotlib_inline-0.1.7-py3-none-any.whl", hash = "sha256:df192d39a4ff8f21b1895d72e6a13f5fcc5099f00fa84384e0ea28c2cc0653ca", size = 9899 },
]
+[[package]]
+name = "mcp"
+version = "1.3.0"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "anyio" },
+ { name = "httpx" },
+ { name = "httpx-sse" },
+ { name = "pydantic" },
+ { name = "pydantic-settings" },
+ { name = "sse-starlette" },
+ { name = "starlette" },
+ { name = "uvicorn" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/6b/b6/81e5f2490290351fc97bf46c24ff935128cb7d34d68e3987b522f26f7ada/mcp-1.3.0.tar.gz", hash = "sha256:f409ae4482ce9d53e7ac03f3f7808bcab735bdfc0fba937453782efb43882d45", size = 150235 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/d0/d2/a9e87b506b2094f5aa9becc1af5178842701b27217fa43877353da2577e3/mcp-1.3.0-py3-none-any.whl", hash = "sha256:2829d67ce339a249f803f22eba5e90385eafcac45c94b00cab6cef7e8f217211", size = 70672 },
+]
+
+[[package]]
+name = "mdurl"
+version = "0.1.2"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/d6/54/cfe61301667036ec958cb99bd3efefba235e65cdeb9c84d24a8293ba1d90/mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba", size = 8729 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8", size = 9979 },
+]
+
[[package]]
name = "milvus-lite"
version = "2.4.11"
@@ -3515,7 +3575,7 @@ dependencies = [
[package.metadata]
requires-dist = [
- { name = "camel-ai", extras = ["all"], specifier = "==0.2.23" },
+ { name = "camel-ai", extras = ["all"], specifier = "==0.2.27" },
{ name = "chunkr-ai", specifier = ">=0.0.41" },
{ name = "docx2markdown", specifier = ">=0.1.1" },
{ name = "gradio", specifier = ">=3.50.2" },
@@ -4097,6 +4157,19 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/a9/f9/b6bcaf874f410564a78908739c80861a171788ef4d4f76f5009656672dfe/pydantic_core-2.23.4-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:9a5bce9d23aac8f0cf0836ecfc033896aa8443b501c58d0602dbfd5bd5b37753", size = 1920344 },
]
+[[package]]
+name = "pydantic-settings"
+version = "2.8.1"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "pydantic" },
+ { name = "python-dotenv" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/88/82/c79424d7d8c29b994fb01d277da57b0a9b09cc03c3ff875f9bd8a86b2145/pydantic_settings-2.8.1.tar.gz", hash = "sha256:d5c663dfbe9db9d5e1c646b2e161da12f0d734d422ee56f567d0ea2cee4e8585", size = 83550 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/0b/53/a64f03044927dc47aafe029c42a5b7aabc38dfb813475e0e1bf71c4a59d0/pydantic_settings-2.8.1-py3-none-any.whl", hash = "sha256:81942d5ac3d905f7f3ee1a70df5dfb62d5569c12f51a5a647defc1c3d9ee2e9c", size = 30839 },
+]
+
[[package]]
name = "pydub"
version = "0.25.1"
@@ -4184,6 +4257,7 @@ sdist = { url = "https://files.pythonhosted.org/packages/06/47/b61c1c44b87cbdaee
wheels = [
{ url = "https://files.pythonhosted.org/packages/61/9b/98ef4b98309e9db3baa9fe572f0e61b6130bb9852d13189970f35b703499/pymupdf-1.25.3-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:96878e1b748f9c2011aecb2028c5f96b5a347a9a91169130ad0133053d97915e", size = 19343576 },
{ url = "https://files.pythonhosted.org/packages/14/62/4e12126db174c8cfbf692281cda971cc4046c5f5226032c2cfaa6f83e08d/pymupdf-1.25.3-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:6ef753005b72ebfd23470f72f7e30f61e21b0b5e748045ec5b8f89e6e3068d62", size = 18580114 },
+ { url = "https://files.pythonhosted.org/packages/ec/c5/cf7ecf005e4f8ba3664d6aaa0613adeba4c2ab524832c452c69857e7184f/pymupdf-1.25.3-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:cbff443d899f37b17f1e67563cc03673d50b4bf33ccc237e73d34f18f3a07ccf", size = 19442580 },
{ url = "https://files.pythonhosted.org/packages/52/de/bd1418e31f73d37b8381cd5deacfd681e6be702b8890e123e83724569ee1/pymupdf-1.25.3-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:46d90c4f9e62d1856e8db4b9f04a202ff4a7f086a816af73abdc86adb7f5e25a", size = 19999825 },
{ url = "https://files.pythonhosted.org/packages/42/ee/3c449b0de061440ba1ac984aa845315e9e2dca0ff2003c5adfc6febff203/pymupdf-1.25.3-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:a5de51efdbe4d486b6c1111c84e8a231cbfb426f3d6ff31ab530ad70e6f39756", size = 21123157 },
{ url = "https://files.pythonhosted.org/packages/83/53/71faaaf91c56f2883b13f3dd849bf2697f012eb35eb7b952d62734cff41f/pymupdf-1.25.3-cp39-abi3-win32.whl", hash = "sha256:bca72e6089f985d800596e22973f79cc08af6cbff1d93e5bda9248326a03857c", size = 15094211 },
@@ -4766,6 +4840,20 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/7b/44/4e421b96b67b2daff264473f7465db72fbdf36a07e05494f50300cc7b0c6/rfc3339_validator-0.1.4-py2.py3-none-any.whl", hash = "sha256:24f6ec1eda14ef823da9e36ec7113124b39c04d50a4d3d3a3c2859577e7791fa", size = 3490 },
]
+[[package]]
+name = "rich"
+version = "13.9.4"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "markdown-it-py" },
+ { name = "pygments" },
+ { name = "typing-extensions", marker = "python_full_version < '3.11'" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/ab/3a/0316b28d0761c6734d6bc14e770d85506c986c85ffb239e688eeaab2c2bc/rich-13.9.4.tar.gz", hash = "sha256:439594978a49a09530cff7ebc4b5c7103ef57baf48d5ea3184f21d9a2befa098", size = 223149 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/19/71/39c7c0d87f8d4e6c020a393182060eaefeeae6c01dab6a84ec346f2567df/rich-13.9.4-py3-none-any.whl", hash = "sha256:6049d5e6ec054bf2779ab3358186963bac2ea89175919d699e378b99738c2a90", size = 242424 },
+]
+
[[package]]
name = "roman-numerals-py"
version = "3.1.0"
@@ -5129,6 +5217,15 @@ version = "1.0.0"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/9e/bd/3704a8c3e0942d711c1299ebf7b9091930adae6675d7c8f476a7ce48653c/sgmllib3k-1.0.0.tar.gz", hash = "sha256:7868fb1c8bfa764c1ac563d3cf369c381d1325d36124933a726f29fcdaa812e9", size = 5750 }
+[[package]]
+name = "shellingham"
+version = "1.5.4"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/58/15/8b3609fd3830ef7b27b655beb4b4e9c62313a4e8da8c676e142cc210d58e/shellingham-1.5.4.tar.gz", hash = "sha256:8dbca0739d487e5bd35ab3ca4b36e11c4078f3a234bfce294b0a0291363404de", size = 10310 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/e0/f9/0595336914c5619e5f28a1fb793285925a8cd4b432c9da0a987836c7f822/shellingham-1.5.4-py2.py3-none-any.whl", hash = "sha256:7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686", size = 9755 },
+]
+
[[package]]
name = "six"
version = "1.17.0"
@@ -5454,6 +5551,19 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/6b/ed/8bc1d54387434f4c1b99a54721691444e9e249bb728a0da47b3150c756d6/sqlglotrs-0.3.0-cp312-none-win_amd64.whl", hash = "sha256:b9f308732f12331f06c53fcb1d7c2b135a43aa22486b4c88c26d42710f329448", size = 190557 },
]
+[[package]]
+name = "sse-starlette"
+version = "2.2.1"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "anyio" },
+ { name = "starlette" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/71/a4/80d2a11af59fe75b48230846989e93979c892d3a20016b42bb44edb9e398/sse_starlette-2.2.1.tar.gz", hash = "sha256:54470d5f19274aeed6b2d473430b08b4b379ea851d953b11d7f1c4a2c118b419", size = 17376 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/d9/e0/5b8bd393f27f4a62461c5cf2479c75a2cc2ffa330976f9f00f5f6e4f50eb/sse_starlette-2.2.1-py3-none-any.whl", hash = "sha256:6410a3d3ba0c89e7675d4c273a301d64649c03a5ef1ca101f10b47f895fd0e99", size = 10120 },
+]
+
[[package]]
name = "stack-data"
version = "0.6.3"
@@ -5898,6 +6008,21 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/fe/7b/7757205dee3628f75e7991021d15cd1bd0c9b044ca9affe99b50879fc0e1/triton-3.0.0-1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:34e509deb77f1c067d8640725ef00c5cbfcb2052a1a3cb6a6d343841f92624eb", size = 209464695 },
]
+[[package]]
+name = "typer"
+version = "0.15.2"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "click" },
+ { name = "rich" },
+ { name = "shellingham" },
+ { name = "typing-extensions" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/8b/6f/3991f0f1c7fcb2df31aef28e0594d8d54b05393a0e4e34c65e475c2a5d41/typer-0.15.2.tar.gz", hash = "sha256:ab2fab47533a813c49fe1f16b1a370fd5819099c00b119e0633df65f22144ba5", size = 100711 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/7f/fc/5b29fea8cee020515ca82cc68e3b8e1e34bb19a3535ad854cac9257b414c/typer-0.15.2-py3-none-any.whl", hash = "sha256:46a499c6107d645a9c13f7ee46c5d5096cae6f5fc57dd11eccbbb9ae3e44ddfc", size = 45061 },
+]
+
[[package]]
name = "types-colorama"
version = "0.4.15.20240311"