Commit
·
97bea5b
1
Parent(s):
194e16b
fix: path join bug
Browse files- owl/app.py +9 -6
- owl/app_en.py +7 -6
owl/app.py
CHANGED
@@ -426,10 +426,13 @@ def run_script(script_dropdown, question, progress=gr.Progress()):
|
|
426 |
log_file = log_dir / f"{script_name.replace('.py', '')}_{timestamp}.log"
|
427 |
|
428 |
# 构建命令
|
|
|
|
|
|
|
429 |
cmd = [
|
430 |
sys.executable,
|
431 |
-
os.path.join("owl", "script_adapter.py"),
|
432 |
-
os.path.join("owl", script_name),
|
433 |
]
|
434 |
|
435 |
# 创建环境变量副本并添加问题
|
@@ -610,7 +613,7 @@ def create_ui():
|
|
610 |
gr.Markdown(
|
611 |
"""
|
612 |
# 🦉 OWL 智能助手运行平台
|
613 |
-
|
614 |
选择一个模型并输入您的问题,系统将运行相应的脚本并显示结果。
|
615 |
"""
|
616 |
)
|
@@ -860,7 +863,7 @@ def create_ui():
|
|
860 |
gr.Markdown(
|
861 |
"""
|
862 |
### 📝 使用说明
|
863 |
-
|
864 |
- 选择一个模型并输入您的问题
|
865 |
- 点击"运行"按钮开始执行
|
866 |
- 如需终止运行,点击"终止"按钮
|
@@ -869,9 +872,9 @@ def create_ui():
|
|
869 |
- 在"聊天历史"标签页查看对话历史(如果有)
|
870 |
- 在"环境变量配置"标签页配置API密钥和其他环境变量
|
871 |
- 您可以添加自定义环境变量,满足特殊需求
|
872 |
-
|
873 |
### ⚠️ 注意事项
|
874 |
-
|
875 |
- 运行某些模型可能需要API密钥,请确保在"环境变量配置"标签页中设置了相应的环境变量
|
876 |
- 某些脚本可能需要较长时间运行,请耐心等待
|
877 |
- 如果运行超过30分钟,进程将自动终止
|
|
|
426 |
log_file = log_dir / f"{script_name.replace('.py', '')}_{timestamp}.log"
|
427 |
|
428 |
# 构建命令
|
429 |
+
# 获取当前脚本所在的基础路径
|
430 |
+
base_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
431 |
+
|
432 |
cmd = [
|
433 |
sys.executable,
|
434 |
+
os.path.join(base_path, "owl", "script_adapter.py"),
|
435 |
+
os.path.join(base_path, "owl", script_name),
|
436 |
]
|
437 |
|
438 |
# 创建环境变量副本并添加问题
|
|
|
613 |
gr.Markdown(
|
614 |
"""
|
615 |
# 🦉 OWL 智能助手运行平台
|
616 |
+
|
617 |
选择一个模型并输入您的问题,系统将运行相应的脚本并显示结果。
|
618 |
"""
|
619 |
)
|
|
|
863 |
gr.Markdown(
|
864 |
"""
|
865 |
### 📝 使用说明
|
866 |
+
|
867 |
- 选择一个模型并输入您的问题
|
868 |
- 点击"运行"按钮开始执行
|
869 |
- 如需终止运行,点击"终止"按钮
|
|
|
872 |
- 在"聊天历史"标签页查看对话历史(如果有)
|
873 |
- 在"环境变量配置"标签页配置API密钥和其他环境变量
|
874 |
- 您可以添加自定义环境变量,满足特殊需求
|
875 |
+
|
876 |
### ⚠️ 注意事项
|
877 |
+
|
878 |
- 运行某些模型可能需要API密钥,请确保在"环境变量配置"标签页中设置了相应的环境变量
|
879 |
- 某些脚本可能需要较长时间运行,请耐心等待
|
880 |
- 如果运行超过30分钟,进程将自动终止
|
owl/app_en.py
CHANGED
@@ -440,10 +440,11 @@ def run_script(script_dropdown, question, progress=gr.Progress()):
|
|
440 |
log_file = log_dir / f"{script_name.replace('.py', '')}_{timestamp}.log"
|
441 |
|
442 |
# Build command
|
|
|
443 |
cmd = [
|
444 |
sys.executable,
|
445 |
-
os.path.join("owl", "script_adapter.py"),
|
446 |
-
os.path.join("owl", script_name),
|
447 |
]
|
448 |
|
449 |
# Create a copy of environment variables and add the question
|
@@ -626,7 +627,7 @@ def create_ui():
|
|
626 |
gr.Markdown(
|
627 |
"""
|
628 |
# 🦉 OWL Intelligent Assistant Platform
|
629 |
-
|
630 |
Select a model and enter your question, the system will run the corresponding script and display the results.
|
631 |
"""
|
632 |
)
|
@@ -889,7 +890,7 @@ def create_ui():
|
|
889 |
gr.Markdown(
|
890 |
"""
|
891 |
### 📝 Instructions
|
892 |
-
|
893 |
- Select a model and enter your question
|
894 |
- Click the "Run" button to start execution
|
895 |
- To stop execution, click the "Stop" button
|
@@ -898,9 +899,9 @@ def create_ui():
|
|
898 |
- View conversation history in the "Chat History" tab (if available)
|
899 |
- Configure API keys and other environment variables in the "Environment Variable Configuration" tab
|
900 |
- You can add custom environment variables to meet special requirements
|
901 |
-
|
902 |
### ⚠️ Notes
|
903 |
-
|
904 |
- Running some models may require API keys, please make sure you have set the corresponding environment variables in the "Environment Variable Configuration" tab
|
905 |
- Some scripts may take a long time to run, please be patient
|
906 |
- If execution exceeds 30 minutes, the process will automatically terminate
|
|
|
440 |
log_file = log_dir / f"{script_name.replace('.py', '')}_{timestamp}.log"
|
441 |
|
442 |
# Build command
|
443 |
+
base_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
444 |
cmd = [
|
445 |
sys.executable,
|
446 |
+
os.path.join(base_path, "owl", "script_adapter.py"),
|
447 |
+
os.path.join(base_path, "owl", script_name),
|
448 |
]
|
449 |
|
450 |
# Create a copy of environment variables and add the question
|
|
|
627 |
gr.Markdown(
|
628 |
"""
|
629 |
# 🦉 OWL Intelligent Assistant Platform
|
630 |
+
|
631 |
Select a model and enter your question, the system will run the corresponding script and display the results.
|
632 |
"""
|
633 |
)
|
|
|
890 |
gr.Markdown(
|
891 |
"""
|
892 |
### 📝 Instructions
|
893 |
+
|
894 |
- Select a model and enter your question
|
895 |
- Click the "Run" button to start execution
|
896 |
- To stop execution, click the "Stop" button
|
|
|
899 |
- View conversation history in the "Chat History" tab (if available)
|
900 |
- Configure API keys and other environment variables in the "Environment Variable Configuration" tab
|
901 |
- You can add custom environment variables to meet special requirements
|
902 |
+
|
903 |
### ⚠️ Notes
|
904 |
+
|
905 |
- Running some models may require API keys, please make sure you have set the corresponding environment variables in the "Environment Variable Configuration" tab
|
906 |
- Some scripts may take a long time to run, please be patient
|
907 |
- If execution exceeds 30 minutes, the process will automatically terminate
|