QLWD commited on
Commit
cd70784
·
verified ·
1 Parent(s): cbe9961

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -47,11 +47,11 @@ def stream_chat(message: str, history: list, temperature: float, max_new_tokens:
47
  conversation = []
48
 
49
  # 添加系统提示,定义模型的角色
50
- conversation.append({"role": "system", "content": "你是一个检测代码漏洞的AI助手,帮助用户找到并修复代码中的安全问题,给出代码漏洞的具体片段,指出类型,给出修复建议。"})
51
 
52
  # 将历史对话内容添加到会话中
53
  for prompt, answer in history:
54
- conversation.extend([{"role": "user", "content": prompt}, {"role": "assistant", "content": answer}])
55
 
56
  # 添加当前用户的输入到对话中
57
  conversation.append({"role": "user", "content": message})
 
47
  conversation = []
48
 
49
  # 添加系统提示,定义模型的角色
50
+ conversation.append({"role": "system", "content": "你是一个名为'漏洞助手'的检测代码漏洞的AI助手,帮助用户找到并修复代码中的安全问题,给出代码漏洞的具体片段,指出类型,给出修复建议。"})
51
 
52
  # 将历史对话内容添加到会话中
53
  for prompt, answer in history:
54
+ conversation.extend([{"role": "user", "content": prompt}, {"role": "漏洞助手", "content": answer}])
55
 
56
  # 添加当前用户的输入到对话中
57
  conversation.append({"role": "user", "content": message})