第一个聊天ai
This commit is contained in:
24
chat/chatmodel.go
Normal file
24
chat/chatmodel.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package chat
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/cloudwego/eino-ext/components/model/openai"
|
||||
)
|
||||
|
||||
func CreateChatModel() (*openai.ChatModel, context.Context) {
|
||||
ctx := context.Background()
|
||||
timeout := 30 * time.Second
|
||||
chatModel, err := openai.NewChatModel(ctx, &openai.ChatModelConfig{
|
||||
BaseURL: "https://api-proxy.meowrain.cn/ai/v1",
|
||||
Model: "deepseek-v3.2",
|
||||
APIKey: "meowrain",
|
||||
Timeout: timeout,
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return chatModel, ctx
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user