Spaces:
Running
Running
fix history commit problem
Browse files
request_llm/bridge_stackclaude.py
CHANGED
|
@@ -112,39 +112,18 @@ class ClaudeHandle(Process):
|
|
| 112 |
kwargs = self.child.recv()
|
| 113 |
question = kwargs['query']
|
| 114 |
history = kwargs['history']
|
| 115 |
-
# system_prompt=kwargs['system_prompt']
|
| 116 |
-
|
| 117 |
-
# 是否重置
|
| 118 |
-
if len(self.local_history) > 0 and len(history) == 0:
|
| 119 |
-
# await self.claude_model.reset()
|
| 120 |
-
self.local_history = []
|
| 121 |
|
| 122 |
# 开始问问题
|
| 123 |
prompt = ""
|
| 124 |
-
# Slack API最好不要添加系统提示
|
| 125 |
-
# if system_prompt not in self.local_history:
|
| 126 |
-
# self.local_history.append(system_prompt)
|
| 127 |
-
# prompt += system_prompt + '\n'
|
| 128 |
-
|
| 129 |
-
# 追加历史
|
| 130 |
-
for ab in history:
|
| 131 |
-
a, b = ab
|
| 132 |
-
if a not in self.local_history:
|
| 133 |
-
self.local_history.append(a)
|
| 134 |
-
prompt += a + '\n'
|
| 135 |
-
# if b not in self.local_history:
|
| 136 |
-
# self.local_history.append(b)
|
| 137 |
-
# prompt += b + '\n'
|
| 138 |
|
| 139 |
# 问题
|
| 140 |
prompt += question
|
| 141 |
-
self.local_history.append(question)
|
| 142 |
print('question:', prompt)
|
|
|
|
| 143 |
# 提交
|
| 144 |
await self.claude_model.chat(prompt)
|
|
|
|
| 145 |
# 获取回复
|
| 146 |
-
# async for final, response in self.claude_model.get_reply():
|
| 147 |
-
# await self.handle_claude_response(final, response)
|
| 148 |
async for final, response in self.claude_model.get_reply():
|
| 149 |
if not final:
|
| 150 |
print(response)
|
|
|
|
| 112 |
kwargs = self.child.recv()
|
| 113 |
question = kwargs['query']
|
| 114 |
history = kwargs['history']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
|
| 116 |
# 开始问问题
|
| 117 |
prompt = ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
|
| 119 |
# 问题
|
| 120 |
prompt += question
|
|
|
|
| 121 |
print('question:', prompt)
|
| 122 |
+
|
| 123 |
# 提交
|
| 124 |
await self.claude_model.chat(prompt)
|
| 125 |
+
|
| 126 |
# 获取回复
|
|
|
|
|
|
|
| 127 |
async for final, response in self.claude_model.get_reply():
|
| 128 |
if not final:
|
| 129 |
print(response)
|