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]
|
||||
|
||||
if ask == "" {
|
||||
return "不问问题你说个屁!"
|
||||
}
|
||||
|
@ -48,6 +49,7 @@ func (a *AI) GetMsg() string {
|
|||
if strings.ToLower(a.Parms[1]) == "models" {
|
||||
|
||||
OPENAI_BaseURL = OPENAI_BaseURL + "/models"
|
||||
|
||||
request := gorequest.New()
|
||||
resp, body, errs := request.Get(OPENAI_BaseURL).
|
||||
Set("Content-Type", "application/json").
|
||||
|
@ -63,6 +65,7 @@ func (a *AI) GetMsg() string {
|
|||
log.Println(err)
|
||||
return "解析模型列表失败"
|
||||
}
|
||||
|
||||
choices := responseBody["data"].([]interface{})
|
||||
var models []interface{}
|
||||
if len(choices) > 0 {
|
||||
|
@ -113,7 +116,8 @@ func (a *AI) GetMsg() string {
|
|||
PROMPT = ""
|
||||
}
|
||||
// PROMPT = ""
|
||||
// println("PROMPT:", PROMPT)
|
||||
println("PROMPT:", PROMPT)
|
||||
println("ask:", ask)
|
||||
requestBody := map[string]interface{}{
|
||||
"model": MODEL,
|
||||
"stream": false,
|
||||
|
@ -123,7 +127,7 @@ func (a *AI) GetMsg() string {
|
|||
"content": PROMPT,
|
||||
},
|
||||
{"role": "user", "content": ask}},
|
||||
"max_tokens": 200,
|
||||
// "max_tokens": 200,
|
||||
"temperature": 0.7,
|
||||
}
|
||||
request := gorequest.New()
|
||||
|
@ -146,6 +150,8 @@ func (a *AI) GetMsg() string {
|
|||
if len(choices) > 0 {
|
||||
choice := choices[0].(map[string]interface{})
|
||||
msg = choice["message"].(map[string]interface{})["content"].(string)
|
||||
// println("msg:", msg)
|
||||
|
||||
} else {
|
||||
log.Println("choices为空")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue