修复system prompt 对于 DeepSeek 接口要求 system prompt 必须在第一个的 bug
This commit is contained in:
parent
67a15229f4
commit
044de7e8fd
@ -3,11 +3,14 @@ from src.utils.logging_config import logger
|
|||||||
|
|
||||||
class HistoryManager():
|
class HistoryManager():
|
||||||
def __init__(self, history=None, system_prompt=None):
|
def __init__(self, history=None, system_prompt=None):
|
||||||
self.messages = history or []
|
self.messages = []
|
||||||
|
|
||||||
system_prompt = system_prompt or get_system_prompt()
|
system_prompt = system_prompt or get_system_prompt()
|
||||||
self.add_system(system_prompt)
|
self.add_system(system_prompt)
|
||||||
|
|
||||||
|
if history:
|
||||||
|
self.messages.extend(history)
|
||||||
|
|
||||||
def add(self, role, content):
|
def add(self, role, content):
|
||||||
self.messages.append({"role": role, "content": content})
|
self.messages.append({"role": role, "content": content})
|
||||||
return self.messages
|
return self.messages
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user