diff --git a/Html/__pycache__/backboardManager.cpython-310.pyc b/Html/__pycache__/backboardManager.cpython-310.pyc
index 638913c..876200f 100644
Binary files a/Html/__pycache__/backboardManager.cpython-310.pyc and b/Html/__pycache__/backboardManager.cpython-310.pyc differ
diff --git a/Html/app.py b/Html/app.py
index 529e251..0341522 100644
--- a/Html/app.py
+++ b/Html/app.py
@@ -9,7 +9,8 @@ import sys
import json
parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.insert(0, parent_dir)
-student_workspace_root_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../study'))
+student_workspace_root_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../study'))
+
current_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '.'))
sys.path.insert(0, current_dir)
from AlgoriAgent.projects.algoriAgent.agent_manager import AgentManager
@@ -276,11 +277,14 @@ def desktop(user_id, course_id, chapter_id):
os.makedirs(path_dir, exist_ok=True)
# 在此文件夹内部创建一个.config文件,并写入 user_id=user_id\n path=path
config_path = os.path.join(path_dir, '.config')
- print('---------------------')
- print(config_path)
- with open(config_path, 'w') as f:
+ if GLOBAL_CONFIG['VSCODE_WEB_PATH']['is_wsl']: # 如果是在 WSL 中运行,则将路径转换为 WSL 路径
+ path_dir = path_dir.replace('\\', '/')
+ path_dir = path_dir.replace(GLOBAL_CONFIG['VSCODE_WEB_PATH']['windows_path'] , GLOBAL_CONFIG['VSCODE_WEB_PATH']['wsl_path'])
+ with open(config_path, 'w', encoding='utf-8') as f:
tmpd = {'user_id': user_id, 'course_id': course_id, 'chapter_id': chapter_id, 'path': path_dir}
json.dump(tmpd, f)
+ print('---------------------')
+ print(config_path)
return render_template('desktop.html', vscode_web_url=VSCODE_WEB_URL, user_id=user_id, course_id=course_id, chapter_id=chapter_id, workspace_path=path_dir)
@app.route('/desktop_nouser//')
diff --git a/Html/config.ini b/Html/config.ini
index 3985d7d..6e4eecf 100644
--- a/Html/config.ini
+++ b/Html/config.ini
@@ -1,22 +1,14 @@
[Global]
-base_chat_url1 = http://58.198.177.26:8000/v1
base_chat_url = https://api.zyai.online/v1
-api_key1 = ollama
api_key = sk-B31NVWeWuvbkEnUgA5913e4c63Ac40E7A1B084742299E57f
-target_path = C:/CAKE/Game/Unity/Repositorys/auto-ucg-game
-project_name = auto-ucg-game
-writeable_file_folder = Assets/HotUpdate/Gurouce/
-terminal_name = Windows PowerShell
-[WebSocket]
-listen_port = 3001
-server_address = ws://localhost:3000/myService
-agent_process_provider_host = localhost
-agent_process_provider_port = 3002
-
[VSCODE_WEB]
-url = http://59.78.194.131:9090
+url = http://127.0.0.1:8181
+[VSCODE_WEB_PATH]
+is_wsl = true
+windows_path = F:/
+wsl_path = /mnt/f/
[USER_DATA]
dir = db/data/user/
[COURSE_DATA]
diff --git a/Html/db/course.py b/Html/db/course.py
index 0010b41..586206d 100644
--- a/Html/db/course.py
+++ b/Html/db/course.py
@@ -28,7 +28,7 @@ class Course:
def load_course_from_json(course_id, course_data_dir = None)-> Course:
try:
COURSE_DATA_DIR = course_data_dir if course_data_dir else LOCAL_COURSE_DATA_DIR
- with open(os.path.join(COURSE_DATA_DIR, f'{course_id}.json'), "r") as f:
+ with open(os.path.join(COURSE_DATA_DIR, f'{course_id}.json'), "r", encoding='utf-8') as f:
raw_json = f.read()
user_data = json.loads(raw_json)
return Course(**user_data)
diff --git a/Html/db/course_list.py b/Html/db/course_list.py
index db23004..801d259 100644
--- a/Html/db/course_list.py
+++ b/Html/db/course_list.py
@@ -4,7 +4,7 @@ import re
class CourseList:
def __init__(self, db_file='db/data/course/course_list.json'):
self.db_file = db_file
- with open(self.db_file, 'r') as f:
+ with open(self.db_file, 'r', encoding='utf-8') as f:
self.db = json.load(f)
def add_course(self, course_id, course_name, course_create_date, course_update_data, course_img_path):
@@ -17,7 +17,7 @@ class CourseList:
self.db[course_id]['course_update_data'] = course_update_data
self.db[course_id]['course_img_path'] = course_img_path
- with open(self.db_file, 'w') as f:
+ with open(self.db_file, 'w', encoding='utf-8') as f:
json.dump(self.db, f, indent=4)
@@ -44,7 +44,7 @@ class CourseList:
self.db[course_id]['course_update_data'] = course_update_data
self.db[course_id]['course_img_path'] = course_img_path
- with open(self.db_file, 'w') as f:
+ with open(self.db_file, 'w', encoding='utf-8') as f:
json.dump(self.db, f, indent=4)
def delete_course(self, course_id):
diff --git a/Html/db/user.py b/Html/db/user.py
index 5ceb16b..ce5f93c 100644
--- a/Html/db/user.py
+++ b/Html/db/user.py
@@ -71,13 +71,13 @@ class User:
self.course_process_dict[course_id]['lesson_processs'].append(([], lesson['lesson_id']))
- with open(self.save_path, 'w') as f:
+ with open(self.save_path, 'w', encoding='utf-8') as f:
json.dump(self.__json__(), f, indent=4)
def save_to_file(self):
print(f"saved at {self.save_path}")
self.get_course_progress()
- with open(self.save_path, 'w') as f:
+ with open(self.save_path, 'w', encoding='utf-8') as f:
json.dump(self.__json__(), f, indent=4)
def __json__(self):
@@ -106,14 +106,14 @@ class User:
def load_user_from_json(user_id, user_data_dir = None)-> User:
USER_DATA_DIR = user_data_dir if user_data_dir else LOCAL_USER_DATA_DIR
- with open(os.path.join(USER_DATA_DIR, f'{user_id}.json'), "r") as f:
+ with open(os.path.join(USER_DATA_DIR, f'{user_id}.json'), "r", encoding='utf-8') as f:
raw_json = f.read()
user_data = json.loads(raw_json)
return User(save_path = os.path.join(USER_DATA_DIR, f'{user_id}.json'), **user_data)
def create_user_json(user_id, user_data_dir = None):
USER_DATA_DIR = user_data_dir if user_data_dir else LOCAL_USER_DATA_DIR
- with open(os.path.join(USER_DATA_DIR, f'{user_id}.json'), "w") as f:
+ with open(os.path.join(USER_DATA_DIR, f'{user_id}.json'), "w", encoding='utf-8') as f:
f.write(json.dumps({
'user_id': user_id,
'select_course': [],
diff --git a/Html/db/user_list.py b/Html/db/user_list.py
index b6f0c25..0e86806 100644
--- a/Html/db/user_list.py
+++ b/Html/db/user_list.py
@@ -4,7 +4,7 @@ class UserList:
def __init__(self, db_file='db/data/user/user_id_list.json'):
"""初始化用户管理,自动打开并加载 JSON 数据文件。"""
self.db_file = db_file
- with open(self.db_file, 'r') as f:
+ with open(self.db_file, 'r', encoding='utf-8') as f:
self.db = json.load(f)
def add_user(self, user_id, password):
@@ -12,7 +12,7 @@ class UserList:
# 检查是否已经有该用户
if user_id not in self.db:
self.db[user_id] = password
- with open(self.db_file, 'w') as f:
+ with open(self.db_file, 'w', encoding='utf-8') as f:
json.dump(self.db, f, indent=4)
else:
print(f"User with ID {user_id} already exists.")
@@ -32,7 +32,7 @@ class UserList:
"""更新用户的密码"""
assert self.db.get(user_id) is not None, f"User with ID {user_id} does not exist."
self.db[user_id] = new_password
- with open(self.db_file, 'w') as f:
+ with open(self.db_file, 'w', encoding='utf-8') as f:
json.dump(self.db, f, indent=4)
def delete_user(self, user_id):