7/7
Browse files- app.py +10 -10
- modules/llm/DeepSeek.py +1 -4
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -16,8 +16,8 @@ app = FastAPI()
|
|
| 16 |
default_icon_path = './frontend/assets/images/default-icon.jpg'
|
| 17 |
config = load_json_file('config.json')
|
| 18 |
experiment_name = config["preset_path"].split("/")[-1].split(".")[0]
|
| 19 |
-
save_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'experiment_saves', experiment_name)
|
| 20 |
-
config["save_dir"] = os.path.join(save_dir, get_grandchild_folders(save_dir)[0])
|
| 21 |
|
| 22 |
for key in config:
|
| 23 |
if "API_KEY" in key and config[key]:
|
|
@@ -115,16 +115,16 @@ class ConnectionManager:
|
|
| 115 |
# 'history_messages':self.bw.get_history_messages(save_dir = config["save_dir"]),
|
| 116 |
'history_messages':[],
|
| 117 |
}
|
| 118 |
-
self.bw.get_history_messages(save_dir = config["save_dir"])
|
| 119 |
return data
|
| 120 |
|
| 121 |
async def get_next_message(self):
|
| 122 |
"""从BookWorld获取下一条消息"""
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
message,status = self.bw.load_next_message_status()
|
| 128 |
return message,status
|
| 129 |
|
| 130 |
manager = ConnectionManager()
|
|
@@ -184,8 +184,8 @@ async def load_preset(request: Request):
|
|
| 184 |
)
|
| 185 |
config["preset_path"] = preset_path
|
| 186 |
experiment_name = preset_path.split("/")[-1].split(".")[0]
|
| 187 |
-
save_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'experiment_saves', experiment_name)
|
| 188 |
-
config["save_dir"] = os.path.join(save_dir, get_grandchild_folders(save_dir)[0])
|
| 189 |
manager.bw.set_generator(
|
| 190 |
rounds=config["rounds"],
|
| 191 |
save_dir=config["save_dir"],
|
|
|
|
| 16 |
default_icon_path = './frontend/assets/images/default-icon.jpg'
|
| 17 |
config = load_json_file('config.json')
|
| 18 |
experiment_name = config["preset_path"].split("/")[-1].split(".")[0]
|
| 19 |
+
# save_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'experiment_saves', experiment_name)
|
| 20 |
+
# config["save_dir"] = os.path.join(save_dir, get_grandchild_folders(save_dir)[0])
|
| 21 |
|
| 22 |
for key in config:
|
| 23 |
if "API_KEY" in key and config[key]:
|
|
|
|
| 115 |
# 'history_messages':self.bw.get_history_messages(save_dir = config["save_dir"]),
|
| 116 |
'history_messages':[],
|
| 117 |
}
|
| 118 |
+
# self.bw.get_history_messages(save_dir = config["save_dir"])
|
| 119 |
return data
|
| 120 |
|
| 121 |
async def get_next_message(self):
|
| 122 |
"""从BookWorld获取下一条消息"""
|
| 123 |
+
message = self.bw.generate_next_message()
|
| 124 |
+
if not os.path.exists(message["icon"]) or not is_image(message["icon"]):
|
| 125 |
+
message["icon"] = default_icon_path
|
| 126 |
+
status = self.bw.get_current_status()
|
| 127 |
+
# message,status = self.bw.load_next_message_status()
|
| 128 |
return message,status
|
| 129 |
|
| 130 |
manager = ConnectionManager()
|
|
|
|
| 184 |
)
|
| 185 |
config["preset_path"] = preset_path
|
| 186 |
experiment_name = preset_path.split("/")[-1].split(".")[0]
|
| 187 |
+
# save_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'experiment_saves', experiment_name)
|
| 188 |
+
# config["save_dir"] = os.path.join(save_dir, get_grandchild_folders(save_dir)[0])
|
| 189 |
manager.bw.set_generator(
|
| 190 |
rounds=config["rounds"],
|
| 191 |
save_dir=config["save_dir"],
|
modules/llm/DeepSeek.py
CHANGED
|
@@ -30,10 +30,7 @@ class DeepSeek(BaseLLM):
|
|
| 30 |
|
| 31 |
response = self.client.chat.completions.create(
|
| 32 |
model="deepseek-chat",
|
| 33 |
-
messages=
|
| 34 |
-
{"role": "system", "content": "You are a helpful assistant"},
|
| 35 |
-
{"role": "user", "content": "Hello"},
|
| 36 |
-
],
|
| 37 |
stream=False
|
| 38 |
)
|
| 39 |
return response.choices[0].message.content
|
|
|
|
| 30 |
|
| 31 |
response = self.client.chat.completions.create(
|
| 32 |
model="deepseek-chat",
|
| 33 |
+
messages=self.messages,
|
|
|
|
|
|
|
|
|
|
| 34 |
stream=False
|
| 35 |
)
|
| 36 |
return response.choices[0].message.content
|
requirements.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
anthropic
|
| 2 |
beautifulsoup4
|
| 3 |
-
chromadb
|
| 4 |
fastapi
|
| 5 |
langchain
|
| 6 |
langchain_experimental
|
|
|
|
| 1 |
anthropic
|
| 2 |
beautifulsoup4
|
| 3 |
+
chromadb==1.0.0
|
| 4 |
fastapi
|
| 5 |
langchain
|
| 6 |
langchain_experimental
|