Skip to content

Commit

Permalink
welcome glm4 from 智谱!
Browse files Browse the repository at this point in the history
  • Loading branch information
binary-husky committed Jan 16, 2024
1 parent 96832a8 commit 2c740fc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@

# 接入智谱大模型
ZHIPUAI_API_KEY = ""
ZHIPUAI_MODEL = "chatglm_turbo"
ZHIPUAI_MODEL = "glm-4" # 可选 "glm-3-turbo" "glm-4"


# Claude API KEY
Expand Down
2 changes: 2 additions & 0 deletions request_llms/com_zhipuapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def generate(self, inputs, llm_kwargs, history, system_prompt):
)
for event in response.events():
if event.event == "add":
# if self.result_buf == "" and event.data.startswith(" "):
# event.data = event.data.lstrip(" ") # 每次智谱为啥都要带个空格开头呢?
self.result_buf += event.data
yield self.result_buf
elif event.event == "error" or event.event == "interrupted":
Expand Down

0 comments on commit 2c740fc

Please sign in to comment.