From b5ee4bf449389fb43c6644e3d8e4c2200d768304 Mon Sep 17 00:00:00 2001 From: yudong <1721464347@qq.com> Date: Tue, 20 Feb 2024 12:38:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85requirements.txt=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base/func_zhipu.py | 12 ++++-------- config.yaml.template | 2 +- requirements.txt | 1 + 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/base/func_zhipu.py b/base/func_zhipu.py index 6efb5a0..75d1a3f 100644 --- a/base/func_zhipu.py +++ b/base/func_zhipu.py @@ -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 diff --git a/config.yaml.template b/config.yaml.template index ddaf102..5fcc8ea 100644 --- a/config.yaml.template +++ b/config.yaml.template @@ -81,4 +81,4 @@ bard: # -----bard配置这行不填----- zhipu: # -----zhipu配置这行不填----- api_key: #api key - model: glm-4 # 模型类型 \ No newline at end of file + model: # 模型类型 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 0872810..857621b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,3 +14,4 @@ jupyter_client zhdate ipykernel google-generativeai +zhipuai \ No newline at end of file