mirror of
https://github.com/coaidev/coai.git
synced 2025-05-19 21:10:18 +09:00

feat: better stop signal (#181) Co-Authored-By: Minghan Zhang <112773885+zmh-program@users.noreply.github.com>
20 lines
421 B
Go
20 lines
421 B
Go
package web
|
|
|
|
import (
|
|
"chat/globals"
|
|
"chat/utils"
|
|
"fmt"
|
|
)
|
|
|
|
func SearchWebResult(q string) string {
|
|
res, err := CallDuckDuckGoAPI(q)
|
|
if err != nil {
|
|
globals.Warn(fmt.Sprintf("[web] failed to get search result: %s (query: %s)", err.Error(), q))
|
|
return ""
|
|
}
|
|
|
|
content := formatResponse(res)
|
|
globals.Debug(fmt.Sprintf("[web] search result: %s (query: %s)", utils.Extract(content, 50, "..."), q))
|
|
return content
|
|
}
|