Jack
|
e627f5d8c5
|
feat: implement POST /api/v1/searchbots/related_questions API (#15639)
## Summary
Implement the `POST /api/v1/searchbots/related_questions` endpoint in
Go, generating related search questions via LLM.
### Changes
- **New**: `internal/handler/related_questions.go` — Handler with
injectable LLM interface, prompt constant, and response parsing
- **New**: `internal/handler/related_questions_test.go` — 9 tests (4
handler + 5 parse)
- **Modified**: `internal/router/router.go` — Added route +
`RelatedQuestionsHandler` to struct
- **Modified**: `cmd/server_main.go` — Wired handler with
`SearchService` and `ModelProviderService`
### Testing
All 9 tests pass:
```
=== RUN TestRelatedQuestionsHandler_Success --- PASS
=== RUN TestRelatedQuestionsHandler_EmptyResponse --- PASS
=== RUN TestRelatedQuestionsHandler_LLMFailure --- PASS
=== RUN TestRelatedQuestionsHandler_MissingQuestion --- PASS
=== RUN TestParseRelatedQuestions_Standard --- PASS
=== RUN TestParseRelatedQuestions_Empty --- PASS
=== RUN TestParseRelatedQuestions_NoNumberedLines --- PASS
=== RUN TestParseRelatedQuestions_MixedContent --- PASS
=== RUN TestParseRelatedQuestions_MultiDigit --- PASS
```
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
|
2026-06-04 19:13:58 +08:00 |
|