From eedb68a282cf5bd9a24687f5dd54f338fd8efa2a Mon Sep 17 00:00:00 2001 From: liyp Date: Mon, 1 Jul 2024 00:26:26 +0800 Subject: [PATCH] =?UTF-8?q?feat(workers):=20=E6=94=B9=E8=BF=9BAI=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- config example.toml | 3 +-- workers/ai.go | 12 ++++++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 2666aab..96107ec 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ data.db test.json +*.exe + config.toml -*.exe \ No newline at end of file diff --git a/config example.toml b/config example.toml index fc3a200..13f6038 100644 --- a/config example.toml +++ b/config example.toml @@ -1,8 +1,7 @@ -[Server] APIURL = "0.0.0.0:5580" POSTURL = "http://0.0.0.0:5700" -[Group] + AllowGroup = [] AllowUser = [] AllowRole = [] diff --git a/workers/ai.go b/workers/ai.go index 4abacac..45dbf9c 100644 --- a/workers/ai.go +++ b/workers/ai.go @@ -65,7 +65,13 @@ func (a *AI) GetMsg() string { if len(choices) > 0 { msg = "支持的模型列表:\n" for _, choice := range choices { - msg = msg + choice.(map[string]interface{})["id"].(string) + "\n" + models := choice.(map[string]interface{})["id"].(string) + if models == MODEL { + msg = msg + models + "\t ✔\n" + } else { + msg = msg + models + "\n" + } + } } else { msg = "没查到支持模型列表" @@ -85,12 +91,14 @@ func (a *AI) GetMsg() string { } // println("PROMPT:", PROMPT) requestBody := map[string]interface{}{ - "model": MODEL, + "model": MODEL, + "stream": false, "messages": []map[string]string{{ "role": "system", "content": PROMPT, }, {"role": "user", "content": ask}}, + "max_tokens": 75, "temperature": 0.7, } request := gorequest.New()