You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
494 B
26 lines
494 B
package ai
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
)
|
|
|
|
// AIClient AI 客户端接口
|
|
type AIClient interface {
|
|
Chat(ctx context.Context, messages []Message) (string, error)
|
|
ChatStream(ctx context.Context, messages []Message, writer io.Writer) error
|
|
}
|
|
|
|
// Message 对话消息
|
|
type Message struct {
|
|
Role string `json:"role"` // system, user, assistant
|
|
Content string `json:"content"`
|
|
}
|
|
|
|
// Config AI 配置
|
|
type Config struct {
|
|
Provider string
|
|
APIKey string
|
|
BaseURL string
|
|
Model string
|
|
}
|
|
|