feat(workers): 改进AI回复格式
This commit is contained in:
parent
21296b7878
commit
eedb68a282
3 changed files with 13 additions and 5 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
|||
data.db
|
||||
test.json
|
||||
config.toml
|
||||
*.exe
|
||||
|
||||
config.toml
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
[Server]
|
||||
APIURL = "0.0.0.0:5580"
|
||||
POSTURL = "http://0.0.0.0:5700"
|
||||
|
||||
[Group]
|
||||
|
||||
AllowGroup = []
|
||||
AllowUser = []
|
||||
AllowRole = []
|
||||
|
|
|
@ -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 = "没查到支持模型列表"
|
||||
|
@ -86,11 +92,13 @@ func (a *AI) GetMsg() string {
|
|||
// println("PROMPT:", PROMPT)
|
||||
requestBody := map[string]interface{}{
|
||||
"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()
|
||||
|
|
Loading…
Reference in a new issue