32 lines
698 B
Go
32 lines
698 B
Go
package ai
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
|
|
"git.huangwc.com/pig/pig-farm-controller/internal/infra/logs"
|
|
"git.huangwc.com/pig/pig-farm-controller/internal/infra/models"
|
|
)
|
|
|
|
var NoneAIError = errors.New("当前没有配置AI, 暂不支持此功能")
|
|
|
|
type NoneAI struct {
|
|
ctx context.Context
|
|
}
|
|
|
|
func NewNoneAI(ctx context.Context) AI {
|
|
return &NoneAI{
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
func (n *NoneAI) GenerateReview(ctx context.Context, prompt string) (string, error) {
|
|
logger := logs.TraceLogger(ctx, n.ctx, "GenerateReview")
|
|
logger.Warnf("当前没有配置AI, 无法处理AI请求, 消息: %s", prompt)
|
|
return "", NoneAIError
|
|
}
|
|
|
|
func (n *NoneAI) AIModel() models.AIModel {
|
|
return models.AI_MODEL_NONE
|
|
}
|