Skip to content

Commit

Permalink
Merge pull request lich0821#2 from yudong521/develop
Browse files Browse the repository at this point in the history
补充requirements.txt,优化代码
  • Loading branch information
yudong521 authored Feb 20, 2024
2 parents 36f1f9e + b5ee4bf commit 4981ad5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
12 changes: 4 additions & 8 deletions base/func_zhipu.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
from pyexpat import model
from zhipuai import ZhipuAI

class ZhiPu():
def __init__(self, conf: dict) -> None:
api_key = conf.get("api_key")
model = conf.get("model", "glm-4") # 默认使用 glm-4 模型
self.api_key = api_key
self.model = model
self.client = ZhipuAI(api_key=api_key)
self.api_key = conf.get("api_key")
self.model = conf.get("model", "glm-4") # 默认使用 glm-4 模型
self.client = ZhipuAI(api_key=self.api_key)
self.converstion_list = {}

@staticmethod
def value_check(conf: dict) -> bool:
if conf:
if conf.get("api_key") :
if conf and conf.get("api_key") :
return True
return False

Expand Down
2 changes: 1 addition & 1 deletion config.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ bard: # -----bard配置这行不填-----

zhipu: # -----zhipu配置这行不填-----
api_key: #api key
model: glm-4 # 模型类型
model: # 模型类型
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ jupyter_client
zhdate
ipykernel
google-generativeai
zhipuai

0 comments on commit 4981ad5

Please sign in to comment.