F17:MarkArtifactFetched 与已验证内容复用都在同一事务内经过策略、来源启用、 过滤、superseded 和当前绑定的复核后,自动把 planned 转 pending 并入队唯一 test.upload;确认与作业幂等,失败整笔回滚。356 已卡记录可对同一文件再次保存 当前策略,经同一路径恢复,不做全库补扫或手工补队列。来源页提示改为自动接续。 F14:来源→监控定位清空未结束/动作/阶段/时间筛选;来源目录定位改为一次性请求 并由父消费,revision/sources 重载不再重放旧请求,手工换目录保持。 F13:抽出 readiness.Resolver 作为端点/绑定/凭据唯一来源;worker 上传/轮询/ 校验/移除改用动态客户端,每次调用重读有效配置,不再固化启动 env 客户端。 验证:隔离 PG 的 F17 正负例与恢复用例、前端挂载定位回归、全量 Go/前端测试 及 make verify 17 项通过。未部署、未做 8088 UI 验收。
This commit is contained in:
@@ -36,6 +36,43 @@ type Result struct {
|
||||
|
||||
// Prober 每次 Check 都重新解析目标并新建客户端:端点、凭据、绑定都允许
|
||||
// 在进程运行期间变化,不能缓存成启动快照。
|
||||
// Resolver is the single source for the effective WeKnora target: endpoint
|
||||
// saved in the console (env fallback), current persisted binding (env fallback)
|
||||
// and the same key file. API probes and worker clients both use it, so a
|
||||
// runtime settings/binding change cannot leave one side on the old value.
|
||||
type Resolver struct {
|
||||
Endpoint func(context.Context) string
|
||||
LoadBinding func(context.Context) (string, error)
|
||||
ReadKey func() (string, error)
|
||||
DefaultKB string
|
||||
}
|
||||
|
||||
func (resolver Resolver) Resolve(ctx context.Context) (Target, error) {
|
||||
knowledgeBaseID := strings.TrimSpace(resolver.DefaultKB)
|
||||
if resolver.LoadBinding != nil {
|
||||
stored, err := resolver.LoadBinding(ctx)
|
||||
if err != nil {
|
||||
return Target{}, fmt.Errorf("读取当前知识库绑定失败")
|
||||
}
|
||||
if stored = strings.TrimSpace(stored); stored != "" {
|
||||
knowledgeBaseID = stored
|
||||
}
|
||||
}
|
||||
apiKey := ""
|
||||
if resolver.ReadKey != nil {
|
||||
value, err := resolver.ReadKey()
|
||||
if err != nil {
|
||||
return Target{}, fmt.Errorf("读取 WeKnora API 凭据失败")
|
||||
}
|
||||
apiKey = strings.TrimSpace(value)
|
||||
}
|
||||
baseURL := ""
|
||||
if resolver.Endpoint != nil {
|
||||
baseURL = strings.TrimSpace(resolver.Endpoint(ctx))
|
||||
}
|
||||
return Target{BaseURL: baseURL, KnowledgeBaseID: knowledgeBaseID, APIKey: apiKey}, nil
|
||||
}
|
||||
|
||||
type Prober struct {
|
||||
Resolve func(context.Context) (Target, error)
|
||||
Timeout time.Duration
|
||||
|
||||
Reference in New Issue
Block a user