feat(ai-core): real vision image analysis
- llm: Adapter.Vision sends multimodal chat requests (text + image_url, data URLs supported) and logs the call as purpose 'vision' - gateway /images/analyze now accepts image_url or image_base64 and returns real analysis instead of a placeholder message - main wires the default LLM adapter as the vision analyzer - httptest coverage for the vision request/response shape
This commit is contained in:
1 parent
2104fc0c6c
commit
ac0c2b2c73
5 files changed
+117
-7
No files matched your search
@@ -315,6 +315,7 @@ func main() {
|
||||
gwDeps.ChatStore = chatStore
|
||||
}
|
||||
gwDeps.VoiceSvc = voiceSvc
|
||||
gwDeps.Vision = visionAdapter{llmSelector.DefaultAdapter()}
|
||||
|
||||
wsHub := ws.NewHub(orch)
|
||||
gwDeps.WSHub = wsHub
|
||||
@@ -462,6 +463,17 @@ func (a *perfAdapter) History() []map[string]any {
|
||||
return result
|
||||
}
|
||||
|
||||
// visionAdapter adapts the LLM adapter to api.VisionAnalyzer.
|
||||
type visionAdapter struct{ llm *llm.Adapter }
|
||||
|
||||
func (v visionAdapter) AnalyzeImage(ctx context.Context, prompt, imageRef string) (string, error) {
|
||||
resp, err := v.llm.Vision(ctx, prompt, imageRef)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return resp.Content, nil
|
||||
}
|
||||
|
||||
// automationSourceAdapter adapts api.AutomationStore to engine.RuleSource.
|
||||
type automationSourceAdapter struct{ s *api.AutomationStore }
|
||||
|
||||
|
||||
Reference in new issue
Block a user