From e475d84f30a7ce88f9ff90ba3487ef73b946acb9 Mon Sep 17 00:00:00 2001 From: CakeCN Date: Sat, 10 May 2025 12:13:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backboardManager.cpython-310.pyc | Bin 3122 -> 3125 bytes Html/app.py | 12 ++++++++---- Html/config.ini | 18 +++++------------- Html/db/course.py | 2 +- Html/db/course_list.py | 6 +++--- Html/db/user.py | 8 ++++---- Html/db/user_list.py | 6 +++--- 7 files changed, 24 insertions(+), 28 deletions(-) diff --git a/Html/__pycache__/backboardManager.cpython-310.pyc b/Html/__pycache__/backboardManager.cpython-310.pyc index 638913c3c160a743857c999419c966a374d62172..876200fc7c7b7a7e2e2bcdf9328d5ef1c081caf4 100644 GIT binary patch delta 76 zcmdlau~mXEpO=@50SKIr%4Jw{Z{$;E(sy*TigEW0$tX</') 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):