镜像自地址
https://github.com/binary-husky/gpt_academic.git
已同步 2025-12-06 06:26:47 +00:00
fix: f-string expression part cannot include a backslash (#2139)
这个提交包含在:
@@ -252,9 +252,9 @@ def get_predict_function(
|
|||||||
logger.error(error_msg)
|
logger.error(error_msg)
|
||||||
raise RuntimeError("Json解析不合常规")
|
raise RuntimeError("Json解析不合常规")
|
||||||
if reasoning:
|
if reasoning:
|
||||||
return f'''<div style="padding: 1em; line-height: 1.5; text-wrap: wrap; opacity: 0.8">
|
style = 'padding: 1em; line-height: 1.5; text-wrap: wrap; opacity: 0.8'
|
||||||
{''.join([f'<p style="margin: 1.25em 0;">{line}</p>' for line in reasoning_buffer.split('\n')])}
|
paragraphs = ''.join([f'<p style="margin: 1.25em 0;">{line}</p>' for line in reasoning_buffer.split('\n')])
|
||||||
</div>\n\n''' + result
|
return f'''<div style="{style}">{paragraphs}</div>\n\n''' + result
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def predict(
|
def predict(
|
||||||
@@ -390,9 +390,9 @@ def get_predict_function(
|
|||||||
if reasoning:
|
if reasoning:
|
||||||
gpt_replying_buffer += response_text
|
gpt_replying_buffer += response_text
|
||||||
gpt_reasoning_buffer += reasoning_content
|
gpt_reasoning_buffer += reasoning_content
|
||||||
history[-1] = f'''<div style="padding: 1em; line-height: 1.5; text-wrap: wrap; opacity: 0.8">
|
style = 'padding: 1em; line-height: 1.5; text-wrap: wrap; opacity: 0.8'
|
||||||
{''.join([f'<p style="margin: 1.25em 0;">{line}</p>' for line in gpt_reasoning_buffer.split('\n')])}
|
paragraphs = ''.join([f'<p style="margin: 1.25em 0;">{line}</p>' for line in gpt_reasoning_buffer.split('\n')])
|
||||||
</div>\n\n''' + gpt_replying_buffer
|
history[-1] = f'<div style="{style}">{paragraphs}</div>\n\n' + gpt_replying_buffer
|
||||||
else:
|
else:
|
||||||
gpt_replying_buffer += response_text
|
gpt_replying_buffer += response_text
|
||||||
# 如果这里抛出异常,一般是文本过长,详情见get_full_error的输出
|
# 如果这里抛出异常,一般是文本过长,详情见get_full_error的输出
|
||||||
|
|||||||
在新工单中引用
屏蔽一个用户