fix: resolve merge conflicts with main, adapt transcriber to interface
This commit is contained in:
parent
9118879d59
commit
dfe65da016
2 changed files with 28 additions and 34 deletions
|
|
@ -624,24 +624,18 @@ func (al *AgentLoop) processMessage(ctx context.Context, msg bus.InboundMessage)
|
|||
|
||||
// Transcribe any audio media refs before passing to the agent.
|
||||
userMessage := msg.Content
|
||||
|
||||
if al.transcriber != nil && len(msg.Media) > 0 && al.mediaStore != nil {
|
||||
logger.DebugCF("agent", "Checking media for transcription", map[string]any{
|
||||
"media_count": len(msg.Media),
|
||||
})
|
||||
for _, ref := range msg.Media {
|
||||
localPath, meta, err := al.mediaStore.ResolveWithMeta(ref)
|
||||
if err != nil {
|
||||
logger.WarnCF("agent", "Failed to resolve media ref for transcription", map[string]any{
|
||||
"ref": ref, "error": err.Error(),
|
||||
})
|
||||
continue
|
||||
}
|
||||
if inferMediaType(meta.Filename, meta.ContentType) != "audio" {
|
||||
logger.DebugCF("agent", "Skipping non-audio media", map[string]any{
|
||||
"ref": ref, "filename": meta.Filename,
|
||||
})
|
||||
continue
|
||||
}
|
||||
|
||||
mediaType := inferMediaType(meta.Filename, meta.ContentType)
|
||||
|
||||
// Handle audio transcription
|
||||
if mediaType == "audio" {
|
||||
logger.InfoCF("agent", "Transcribing audio", map[string]any{
|
||||
"ref": ref, "path": localPath, "filename": meta.Filename,
|
||||
})
|
||||
|
|
@ -664,10 +658,7 @@ func (al *AgentLoop) processMessage(ctx context.Context, msg bus.InboundMessage)
|
|||
userMessage = result.Text
|
||||
}
|
||||
}
|
||||
} else if al.transcriber == nil && len(msg.Media) > 0 {
|
||||
logger.WarnCF("agent", "Transcriber not configured, skipping media", map[string]any{
|
||||
"media_count": len(msg.Media),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return al.runAgentLoop(ctx, agent, processOptions{
|
||||
|
|
@ -1759,3 +1750,5 @@ func extractParentPeer(msg bus.InboundMessage) *routing.RoutePeer {
|
|||
}
|
||||
return &routing.RoutePeer{Kind: parentKind, ID: parentID}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -364,6 +364,7 @@ func parseResponse(body io.Reader) (*LLMResponse, error) {
|
|||
// openaiMessage is the wire-format message for OpenAI-compatible APIs.
|
||||
// It mirrors protocoltypes.Message but omits SystemParts, which is an
|
||||
// internal field that would be unknown to third-party endpoints.
|
||||
// Content can be either a string or an array of content blocks for multimodal messages.
|
||||
type openaiMessage struct {
|
||||
Role string `json:"role"`
|
||||
Content string `json:"content"`
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue