Skip to content

Commit 991a903

Browse files
authored
fix: f-string expression part cannot include a backslash (#2139)
1 parent cf7c811 commit 991a903

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

request_llms/oai_std_model_template.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,9 @@ def predict_no_ui_long_connection(
252252
logger.error(error_msg)
253253
raise RuntimeError("Json解析不合常规")
254254
if reasoning:
255-
return f'''<div style="padding: 1em; line-height: 1.5; text-wrap: wrap; opacity: 0.8">
256-
{''.join([f'<p style="margin: 1.25em 0;">{line}</p>' for line in reasoning_buffer.split('\n')])}
257-
</div>\n\n''' + result
255+
style = 'padding: 1em; line-height: 1.5; text-wrap: wrap; opacity: 0.8'
256+
paragraphs = ''.join([f'<p style="margin: 1.25em 0;">{line}</p>' for line in reasoning_buffer.split('\n')])
257+
return f'''<div style="{style}">{paragraphs}</div>\n\n''' + result
258258
return result
259259

260260
def predict(
@@ -390,9 +390,9 @@ def predict(
390390
if reasoning:
391391
gpt_replying_buffer += response_text
392392
gpt_reasoning_buffer += reasoning_content
393-
history[-1] = f'''<div style="padding: 1em; line-height: 1.5; text-wrap: wrap; opacity: 0.8">
394-
{''.join([f'<p style="margin: 1.25em 0;">{line}</p>' for line in gpt_reasoning_buffer.split('\n')])}
395-
</div>\n\n''' + gpt_replying_buffer
393+
style = 'padding: 1em; line-height: 1.5; text-wrap: wrap; opacity: 0.8'
394+
paragraphs = ''.join([f'<p style="margin: 1.25em 0;">{line}</p>' for line in gpt_reasoning_buffer.split('\n')])
395+
history[-1] = f'<div style="{style}">{paragraphs}</div>\n\n' + gpt_replying_buffer
396396
else:
397397
gpt_replying_buffer += response_text
398398
# 如果这里抛出异常,一般是文本过长,详情见get_full_error的输出

0 commit comments

Comments
 (0)