kefu/lib/glmv3_test.go

27 lines
556 B
Go
Raw Permalink Normal View History

2024-12-10 02:50:12 +00:00
package lib
import (
"log"
"testing"
)
func TestChatGLM_ChatStream(t *testing.T) {
chatglm, err := NewChatGLM("0ca00a2167291d1ae977c2b88ffdab57.JHEkjkBxyjkFiJ43")
if err != nil {
log.Println(err)
}
//res, err := chatglm.ChatGLM6B()
//log.Println(res, err)
prompt := []map[string]string{{"role": "user", "content": "你是谁?"}}
res, err := chatglm.StreamChatGLM6B(prompt, 0.79, 0.7, false)
for {
str, err := chatglm.StreamRecv(res)
if err != nil {
log.Println(err)
break
}
log.Println(str, err)
}
//log.Println(res, err)
}