75 lines
2.0 KiB
Go
75 lines
2.0 KiB
Go
package collect
|
|
|
|
import (
|
|
"context"
|
|
"geo/internal/config"
|
|
|
|
"github.com/gofiber/fiber/v2/log"
|
|
)
|
|
|
|
// CollectorInterface AI平台收集器接口
|
|
type CollectorInterface interface {
|
|
// WaitLogin 等待登录
|
|
WaitLogin() (bool, string)
|
|
// AskQuestion 提问并获取答案
|
|
AskQuestion(question string) (*CollectResult, error)
|
|
}
|
|
|
|
// CollectResult 收集结果
|
|
type CollectResult struct {
|
|
Answer string `json:"answer"` // AI回答内容
|
|
ShareLink string `json:"share_link"` // 分享链接\
|
|
IsExposure bool `json:"is_exposure"` // 是否曝光
|
|
}
|
|
|
|
// NewCollector 创建收集器的工厂函数类型
|
|
type NewCollector func(
|
|
ctx context.Context,
|
|
param *CollectParams,
|
|
cfg *config.Config,
|
|
logger log.AllLogger) CollectorInterface
|
|
|
|
// CollectorValue 收集器配置信息
|
|
type CollectorValue struct {
|
|
Name string // 平台名称
|
|
InitMethod NewCollector // 初始化方法
|
|
Platform string // 平台标识: wenxin, deepseek, doubao, qianwen
|
|
Icon string
|
|
}
|
|
|
|
// CollectParams 收集任务参数
|
|
type CollectParams struct {
|
|
Headless bool // 是否无头模式
|
|
RequestID string // 请求ID
|
|
Platform string
|
|
KeyWords []string
|
|
}
|
|
|
|
// CollectorMap 收集器注册表
|
|
var CollectorMap = map[string]*CollectorValue{
|
|
"wenxin": {
|
|
Name: "文心一言",
|
|
InitMethod: NewWenxinCollector,
|
|
Platform: "wenxin",
|
|
Icon: "https://attachment-public.oss-cn-hangzhou.aliyuncs.com/geo/platform/wenxin.png",
|
|
},
|
|
"deepseek": {
|
|
Name: "DeepSeek",
|
|
InitMethod: NewDeepseekCollector,
|
|
Platform: "deepseek",
|
|
Icon: "https://attachment-public.oss-cn-hangzhou.aliyuncs.com/geo/platform/deepseek.png",
|
|
},
|
|
"doubao": {
|
|
Name: "豆包",
|
|
InitMethod: NewDoubaoCollector,
|
|
Platform: "doubao",
|
|
Icon: "https://attachment-public.oss-cn-hangzhou.aliyuncs.com/geo/platform/doubao.png",
|
|
},
|
|
"qianwen": {
|
|
Name: "通义千问",
|
|
InitMethod: NewQianwenCollector,
|
|
Platform: "qianwen",
|
|
Icon: "https://attachment-public.oss-cn-hangzhou.aliyuncs.com/geo/platform/qianwen.png",
|
|
},
|
|
}
|