chore(workers): 移除无用注释并添加调试输出
This commit is contained in:
parent
803332d69d
commit
82f93e455b
1 changed files with 8 additions and 2 deletions
|
@ -19,6 +19,7 @@ func (a *AI) GetMsg() string {
|
||||||
|
|
||||||
}
|
}
|
||||||
ask := a.Parms[1]
|
ask := a.Parms[1]
|
||||||
|
|
||||||
if ask == "" {
|
if ask == "" {
|
||||||
return "不问问题你说个屁!"
|
return "不问问题你说个屁!"
|
||||||
}
|
}
|
||||||
|
@ -48,6 +49,7 @@ func (a *AI) GetMsg() string {
|
||||||
if strings.ToLower(a.Parms[1]) == "models" {
|
if strings.ToLower(a.Parms[1]) == "models" {
|
||||||
|
|
||||||
OPENAI_BaseURL = OPENAI_BaseURL + "/models"
|
OPENAI_BaseURL = OPENAI_BaseURL + "/models"
|
||||||
|
|
||||||
request := gorequest.New()
|
request := gorequest.New()
|
||||||
resp, body, errs := request.Get(OPENAI_BaseURL).
|
resp, body, errs := request.Get(OPENAI_BaseURL).
|
||||||
Set("Content-Type", "application/json").
|
Set("Content-Type", "application/json").
|
||||||
|
@ -63,6 +65,7 @@ func (a *AI) GetMsg() string {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
return "解析模型列表失败"
|
return "解析模型列表失败"
|
||||||
}
|
}
|
||||||
|
|
||||||
choices := responseBody["data"].([]interface{})
|
choices := responseBody["data"].([]interface{})
|
||||||
var models []interface{}
|
var models []interface{}
|
||||||
if len(choices) > 0 {
|
if len(choices) > 0 {
|
||||||
|
@ -113,7 +116,8 @@ func (a *AI) GetMsg() string {
|
||||||
PROMPT = ""
|
PROMPT = ""
|
||||||
}
|
}
|
||||||
// PROMPT = ""
|
// PROMPT = ""
|
||||||
// println("PROMPT:", PROMPT)
|
println("PROMPT:", PROMPT)
|
||||||
|
println("ask:", ask)
|
||||||
requestBody := map[string]interface{}{
|
requestBody := map[string]interface{}{
|
||||||
"model": MODEL,
|
"model": MODEL,
|
||||||
"stream": false,
|
"stream": false,
|
||||||
|
@ -123,7 +127,7 @@ func (a *AI) GetMsg() string {
|
||||||
"content": PROMPT,
|
"content": PROMPT,
|
||||||
},
|
},
|
||||||
{"role": "user", "content": ask}},
|
{"role": "user", "content": ask}},
|
||||||
"max_tokens": 200,
|
// "max_tokens": 200,
|
||||||
"temperature": 0.7,
|
"temperature": 0.7,
|
||||||
}
|
}
|
||||||
request := gorequest.New()
|
request := gorequest.New()
|
||||||
|
@ -146,6 +150,8 @@ func (a *AI) GetMsg() string {
|
||||||
if len(choices) > 0 {
|
if len(choices) > 0 {
|
||||||
choice := choices[0].(map[string]interface{})
|
choice := choices[0].(map[string]interface{})
|
||||||
msg = choice["message"].(map[string]interface{})["content"].(string)
|
msg = choice["message"].(map[string]interface{})["content"].(string)
|
||||||
|
// println("msg:", msg)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
log.Println("choices为空")
|
log.Println("choices为空")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue