重构了模型抽象,用来更好的支持gpt-3.5-turbo

This commit is contained in:
LINSTCL
2023-03-02 15:31:12 +08:00
parent 6f5802551f
commit fd25d61b56
6 changed files with 140 additions and 90 deletions

View File

@@ -206,7 +206,7 @@ class DatabaseManager:
}
# 列出与某个对象的所有对话session
def list_history(self, session_name: str, capacity: int, page: int, replace: str = ""):
def list_history(self, session_name: str, capacity: int, page: int):
self.execute("""
select `name`, `type`, `number`, `create_timestamp`, `last_interact_timestamp`, `prompt`, `status`
from `sessions` where `name` = '{}' order by `last_interact_timestamp` desc limit {} offset {}
@@ -227,7 +227,7 @@ class DatabaseManager:
'subject_number': subject_number,
'create_timestamp': create_timestamp,
'last_interact_timestamp': last_interact_timestamp,
'prompt': prompt if replace == "" else prompt.replace(replace, "")
'prompt': json.loads(prompt)
})
return sessions