入库prompt字符串从strip替换为正则表达式
This commit is contained in:
@ -481,8 +481,9 @@ def thread_write_chat(chatbot):
|
||||
"""
|
||||
private_key = toolbox.get_conf('private_key')[0]
|
||||
chat_title = chatbot[0][0].split()
|
||||
i_say = chatbot[-1][0].strip('<div class="markdown-body">/div<p>/p')
|
||||
gpt_result = chatbot[-1][1].strip('<div class="markdown-body">/div<p>/p')
|
||||
|
||||
i_say = re.sub(r'^<div class="markdown-body"><p>|<\/p><\/div>$', '', chatbot[-1][0])
|
||||
gpt_result = re.sub(r'^<div class="markdown-body"><p>|<\/p><\/div>$', '', chatbot[-1][1])
|
||||
if private_key in chat_title:
|
||||
SqliteHandle(f'ai_private_{chat_title[-2]}').inset_prompt({i_say: gpt_result})
|
||||
else:
|
||||
@ -543,4 +544,4 @@ class JsonHandle:
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(JsonHandle('/Users/kilig/Job/Python-project/academic_gpt/test.json').load())
|
||||
pass
|
||||
Reference in New Issue
Block a user