diff --git a/src/Server/chatglmTurbo.py b/src/Server/chatglmTurbo.py index a63e2ca..3a58ce0 100644 --- a/src/Server/chatglmTurbo.py +++ b/src/Server/chatglmTurbo.py @@ -1,6 +1,6 @@ -import zhipuai +import zhipuai , config -zhipuai.api_key = "83f977afedc7f414dea579a2551298c2.sydItr1sZT8UPXWb" +zhipuai.api_key = config.readConf()["chatglmturbo"]["Authorization"] def service(prompt,history = ""): if history == "": diff --git a/src/Server/config.py b/src/Server/config.py new file mode 100644 index 0000000..012db0c --- /dev/null +++ b/src/Server/config.py @@ -0,0 +1,5 @@ +import json + +def readConf(): + with open('config.json') as f: + return json.load(f) \ No newline at end of file diff --git a/src/Server/qwenTurbo.py b/src/Server/qwenTurbo.py index 77d76fb..70344dd 100644 --- a/src/Server/qwenTurbo.py +++ b/src/Server/qwenTurbo.py @@ -1,11 +1,10 @@ -import requests , json +import requests , json , config # 设置请求的目标URL -url = "https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation" # 替换为你的API端点URL - +url = config.readConf()["qwenturbo"]["url"] # 替换为你的API端点URL header = { "Content-Type":"application/json", - "Authorization":"Bearer sk-69129a5d7fc6468a9f6f30d6935254c6" + "Authorization":config.readConf()["qwenturbo"]["Authorization"] } def service(prompt,history = ""):