feat(qa): add web search provider port (#60)

This commit is contained in:
2026-11-26 10:19:42 +01:00
parent 2747e857b1
commit 097164e657
20 changed files with 996 additions and 65 deletions

View File

@ -13,6 +13,7 @@ type fixtureRepo struct {
work Work
begins, finishes int
answer, code string
result AnswerResult
err error
}
@ -23,11 +24,12 @@ func (r *fixtureRepo) BeginQAQuestion(context.Context, string, string, Question,
r.begins++
return r.work, r.err
}
func (r *fixtureRepo) FinishQAQuestion(_ context.Context, _, _, _, answer, code string, _ time.Time) (Turn, error) {
func (r *fixtureRepo) FinishQAQuestion(_ context.Context, _, _, _ string, answer AnswerResult, code string, _ time.Time) (Turn, error) {
r.finishes++
r.answer = answer
r.answer = answer.Answer
r.result = answer
r.code = code
return Turn{Answer: answer, FailureCode: code}, nil
return Turn{Answer: answer.Answer, WebSearchPerformed: answer.WebSearchPerformed, Citations: answer.Citations, FailureCode: code}, nil
}
func (r *fixtureRepo) DeleteQAConversation(context.Context, string, string) error { return nil }
func (r *fixtureRepo) PurgeExpiredQASources(context.Context, time.Time) error { return nil }
@ -39,9 +41,9 @@ type fixtureProvider struct {
}
func (p *fixtureProvider) Capabilities() Capabilities { return Capabilities{} }
func (p *fixtureProvider) Answer(_ context.Context, r StatelessRequest) (string, error) {
func (p *fixtureProvider) Answer(_ context.Context, r StatelessRequest) (AnswerResult, error) {
p.requests = append(p.requests, r)
return p.answer, p.err
return AnswerResult{Answer: p.answer}, p.err
}
type fixtureResolver struct {