diff --git a/src/ai_chat/ai_chat.py b/src/ai_chat/ai_chat.py index acb3216..795a707 100644 --- a/src/ai_chat/ai_chat.py +++ b/src/ai_chat/ai_chat.py @@ -2,13 +2,14 @@ import os import yaml import openai -# with open(os.getcwd() +'/src/ai_chat/config/openai.yaml', 'r', encoding='utf-8') as f: -# chat = yaml.load(f.read(), Loader=yaml.FullLoader).get('openai') -# base_url = chat.get('base_url') -# api_key = chat.get('api_key') +with open(os.getcwd() +'/src/ai_chat/config/openai.yaml', 'r', encoding='utf-8') as f: + chat = yaml.load(f.read(), Loader=yaml.FullLoader).get('openai') + base_url = chat.get('base_url') + api_key = chat.get('api_key') + +openai.base_url = base_url +openai.api_key = api_key -openai.api_key = "sk-iFEJzlBCdcq3OCvIFaF6797865854f729eA0B3CcEb406bAb" -openai.base_url = "https://free.v36.cm" openai.default_headers = {"x-foo": "true"} setting = "接下来,你将进行模拟一个扮演动漫角色。你不再是一个语言模型," \ diff --git a/src/ai_chat/config/example.openai.yaml b/src/ai_chat/config/example.openai.yaml index b453769..34f892a 100644 --- a/src/ai_chat/config/example.openai.yaml +++ b/src/ai_chat/config/example.openai.yaml @@ -1,6 +1,6 @@ openai: - url: "" - key: "" + base_url: "" + api_key: "" diff --git a/src/my_sqlite/data_init/data_init.py b/src/my_sqlite/data_init/data_init.py index c77f5de..297fb65 100644 --- a/src/my_sqlite/data_init/data_init.py +++ b/src/my_sqlite/data_init/data_init.py @@ -28,7 +28,7 @@ def QrFortune_init(): """ def execute_init_file(): # 拼接文件的完整路径 - file_path = os.getcwd() + "\\src\\my_sqlite\\data_init\\fortune_init_data.py" + file_path = os.getcwd() + "/src/my_sqlite/data_init/fortune_init_data.py" init_file_path = os.path.join(os.path.dirname(__file__), file_path) try: # 执行初始化文件 @@ -53,7 +53,7 @@ def touch_init(): """ def execute_init_file2(): # 拼接文件的完整路径 - file_path = os.getcwd() + "\\src\\my_sqlite\\data_init\\touch_init_data.py" + file_path = os.getcwd() + "/src/my_sqlite/data_init/touch_init_data.py" init_file_path = os.path.join(os.path.dirname(__file__), file_path) try: # 执行初始化文件 @@ -81,7 +81,7 @@ def todo_init(): """ def execute_init_file3(): # 拼接文件的完整路径 - file_path = os.getcwd() + "\\src\\my_sqlite\\data_init\\todo_init.py" + file_path = os.getcwd() + "/src/my_sqlite/data_init/todo_init.py" init_file_path = os.path.join(os.path.dirname(__file__), file_path) try: # 执行初始化文件