浏览代码

Display thinking for deepseek r1 (#4904)

### What problem does this PR solve?
#4903
### Type of change

- [x] New Feature (non-breaking change which adds functionality)
tags/v0.17.0
Kevin Hu 8 个月前
父节点
当前提交
b08bb56f6c
没有帐户链接到提交者的电子邮件
共有 2 个文件被更改,包括 8 次插入2 次删除
  1. 1
    1
      deepdoc/vision/operators.py
  2. 7
    1
      rag/llm/chat_model.py

+ 1
- 1
deepdoc/vision/operators.py 查看文件



def __init__(self, scale=None, mean=None, std=None, order='chw', **kwargs): def __init__(self, scale=None, mean=None, std=None, order='chw', **kwargs):
if isinstance(scale, str): if isinstance(scale, str):
scale = np.float32(scale) if scale != 'None' else None
scale = eval(scale)
self.scale = np.float32(scale if scale is not None else 1.0 / 255.0) self.scale = np.float32(scale if scale is not None else 1.0 / 255.0)
mean = mean if mean is not None else [0.485, 0.456, 0.406] mean = mean if mean is not None else [0.485, 0.456, 0.406]
std = std if std is not None else [0.229, 0.224, 0.225] std = std if std is not None else [0.229, 0.224, 0.225]

+ 7
- 1
rag/llm/chat_model.py 查看文件

continue continue
if not resp.choices[0].delta.content: if not resp.choices[0].delta.content:
resp.choices[0].delta.content = "" resp.choices[0].delta.content = ""
ans += resp.choices[0].delta.content
if hasattr(resp.choices[0].delta, "reasoning_content") and resp.choices[0].delta.reasoning_content:
if ans.find("<think>") < 0:
ans += "<think>"
ans = ans.replace("</think>", "")
ans += resp.choices[0].delta.reasoning_content + "</think>"
else:
ans += resp.choices[0].delta.content


tol = self.total_token_count(resp) tol = self.total_token_count(resp)
if not tol: if not tol:

正在加载...
取消
保存