mirror of
https://github.com/RockChinQ/QChatGPT.git
synced 2024-11-16 11:42:44 +08:00
fix: !list时会显示预设消息 #48
This commit is contained in:
parent
8c588c5c1d
commit
03a5f15a58
|
@ -198,7 +198,7 @@ class DatabaseManager:
|
|||
}
|
||||
|
||||
# 列出与某个对象的所有对话session
|
||||
def list_history(self, session_name: str, capacity: int, page: int):
|
||||
def list_history(self, session_name: str, capacity: int, page: int, replace: str = ""):
|
||||
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 {}
|
||||
|
@ -219,7 +219,7 @@ class DatabaseManager:
|
|||
'subject_number': subject_number,
|
||||
'create_timestamp': create_timestamp,
|
||||
'last_interact_timestamp': last_interact_timestamp,
|
||||
'prompt': prompt
|
||||
'prompt': prompt if replace == "" else prompt.replace(replace, "")
|
||||
})
|
||||
|
||||
return sessions
|
||||
|
|
|
@ -262,4 +262,6 @@ class Session:
|
|||
return self
|
||||
|
||||
def list_history(self, capacity: int = 10, page: int = 0):
|
||||
return pkg.database.manager.get_inst().list_history(self.name, capacity, page)
|
||||
return pkg.database.manager.get_inst().list_history(self.name, capacity, page,
|
||||
(self.user_name + ":" + get_default_prompt() + "\n" +
|
||||
self.bot_name + ":") if get_default_prompt() != "" else "")
|
||||
|
|
Loading…
Reference in New Issue
Block a user