avoid adding the same file multiple times
to the chatbot's files_to_promote list
This commit is contained in:
parent
a0bfa7ba1c
commit
f7588d4776
@ -76,7 +76,7 @@ def cut(limit, get_token_fn, txt_tocut, must_break_at_empty_line, break_anyway=F
|
|||||||
remain_txt_to_cut = post
|
remain_txt_to_cut = post
|
||||||
remain_txt_to_cut, remain_txt_to_cut_storage = maintain_storage(remain_txt_to_cut, remain_txt_to_cut_storage)
|
remain_txt_to_cut, remain_txt_to_cut_storage = maintain_storage(remain_txt_to_cut, remain_txt_to_cut_storage)
|
||||||
process = fin_len/total_len
|
process = fin_len/total_len
|
||||||
print(f'\r正在文本切分 {int(process*100)}%', end='')
|
print(f'正在文本切分 {int(process*100)}%')
|
||||||
if len(remain_txt_to_cut.strip()) == 0:
|
if len(remain_txt_to_cut.strip()) == 0:
|
||||||
break
|
break
|
||||||
return res
|
return res
|
||||||
|
@ -29,7 +29,6 @@ def 解析docx(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot
|
|||||||
except:
|
except:
|
||||||
raise RuntimeError('请先将.doc文档转换为.docx文档。')
|
raise RuntimeError('请先将.doc文档转换为.docx文档。')
|
||||||
|
|
||||||
print(file_content)
|
|
||||||
# private_upload里面的文件名在解压zip后容易出现乱码(rar和7z格式正常),故可以只分析文章内容,不输入文件名
|
# private_upload里面的文件名在解压zip后容易出现乱码(rar和7z格式正常),故可以只分析文章内容,不输入文件名
|
||||||
from crazy_functions.pdf_fns.breakdown_txt import breakdown_text_to_satisfy_token_limit
|
from crazy_functions.pdf_fns.breakdown_txt import breakdown_text_to_satisfy_token_limit
|
||||||
from request_llms.bridge_all import model_info
|
from request_llms.bridge_all import model_info
|
||||||
|
@ -583,7 +583,8 @@ def promote_file_to_downloadzone(file, rename_file=None, chatbot=None):
|
|||||||
if chatbot is not None:
|
if chatbot is not None:
|
||||||
if 'files_to_promote' in chatbot._cookies: current = chatbot._cookies['files_to_promote']
|
if 'files_to_promote' in chatbot._cookies: current = chatbot._cookies['files_to_promote']
|
||||||
else: current = []
|
else: current = []
|
||||||
chatbot._cookies.update({'files_to_promote': [new_path] + current})
|
if new_path not in current: # 避免把同一个文件添加多次
|
||||||
|
chatbot._cookies.update({'files_to_promote': [new_path] + current})
|
||||||
return new_path
|
return new_path
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user