Skip to content

Commit

Permalink
bugfix: bulk response from Claude 3
Browse files Browse the repository at this point in the history
  • Loading branch information
GaiZhenbiao committed Mar 16, 2024
1 parent e9ac109 commit c24712b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions modules/models/Claude.py
Expand Up @@ -91,8 +91,6 @@ def get_answer_stream_iter(self):
def get_answer_at_once(self):
system_prompt = self.system_prompt
history = self._get_claude_style_history()
if system_prompt is not None:
history = [construct_system(system_prompt), *history]

response = self.claude_client.messages.create(
model=self.model_name,
Expand All @@ -101,6 +99,6 @@ def get_answer_at_once(self):
system=system_prompt,
)
if response is not None:
return response["content"][0]["text"], response["usage"]["output_tokens"]
return response.content[0].text, response.usage.output_tokens
else:
return i18n("获取资源错误"), 0
6 changes: 3 additions & 3 deletions modules/presets.py
Expand Up @@ -63,6 +63,9 @@
"GPT4 32K",
"GPT4 Turbo",
"GPT4 Vision",
"Claude 3 Haiku",
"Claude 3 Sonnet",
"Claude 3 Opus",
"川虎助理",
"川虎助理 Pro",
"DALL-E 3",
Expand All @@ -82,9 +85,6 @@
"讯飞星火大模型V3.0",
"讯飞星火大模型V2.0",
"讯飞星火大模型V1.5",
"Claude 3 Haiku",
"Claude 3 Sonnet",
"Claude 3 Opus",
"ERNIE-Bot-turbo",
"ERNIE-Bot",
"ERNIE-Bot-4",
Expand Down

0 comments on commit c24712b

Please sign in to comment.