refactor: consolidate QA request handling and improve session service interface
- Introduced a new `QARequest` type to streamline parameters for KnowledgeQA and AgentQA service calls, replacing multiple parameters with a single structured request. - Updated the `KnowledgeQA` and `AgentQA` methods in the session service interface to accept the new `QARequest` type, enhancing clarity and maintainability. - Refactored the request parsing logic to utilize the new `buildQARequest` method, improving code organization and reducing redundancy. - Implemented a new `resolveAgent` method to simplify custom agent resolution logic, enhancing readability and maintainability. These changes improve the overall structure and usability of the QA request handling, facilitating easier updates and better code organization.
This commit is contained in:
+182
-231
@@ -355,7 +355,7 @@ func (h *Handler) KnowledgeQA(c *gin.Context) {
|
||||
}
|
||||
|
||||
// Execute normal mode QA, generate title unless disabled
|
||||
h.executeNormalModeQA(reqCtx, !request.DisableTitle)
|
||||
h.executeQA(reqCtx, qaModeNormal, !request.DisableTitle)
|
||||
}
|
||||
|
||||
// AgentQA godoc
|
||||
@@ -390,188 +390,42 @@ func (h *Handler) AgentQA(c *gin.Context) {
|
||||
|
||||
// Route to appropriate handler based on agent mode
|
||||
if agentModeEnabled {
|
||||
h.executeAgentModeQA(reqCtx)
|
||||
h.executeQA(reqCtx, qaModeAgent, true)
|
||||
} else {
|
||||
logger.Infof(reqCtx.ctx, "Agent mode disabled, delegating to normal mode for session: %s", reqCtx.sessionID)
|
||||
// Knowledge bases should be specified in request or from custom agent
|
||||
h.executeNormalModeQA(reqCtx, false)
|
||||
h.executeQA(reqCtx, qaModeNormal, false)
|
||||
}
|
||||
}
|
||||
|
||||
// executeNormalModeQA executes the normal (KnowledgeQA) mode
|
||||
func (h *Handler) executeNormalModeQA(reqCtx *qaRequestContext, generateTitle bool) {
|
||||
// qaMode determines which QA execution path to use.
|
||||
type qaMode int
|
||||
|
||||
const (
|
||||
qaModeNormal qaMode = iota // KnowledgeQA pipeline (RAG / pure chat)
|
||||
qaModeAgent // Agent engine with tool calling
|
||||
)
|
||||
|
||||
// executeQA is the unified execution flow for both KnowledgeQA and AgentQA modes.
|
||||
// It handles message creation, SSE setup, VLM analysis, service invocation, and error handling.
|
||||
func (h *Handler) executeQA(reqCtx *qaRequestContext, mode qaMode, generateTitle bool) {
|
||||
ctx := reqCtx.ctx
|
||||
sessionID := reqCtx.sessionID
|
||||
|
||||
// Create user message
|
||||
userMsg, err := h.createUserMessage(ctx, sessionID, reqCtx.query, reqCtx.requestID, reqCtx.mentionedItems, convertImageAttachments(reqCtx.images))
|
||||
if err != nil {
|
||||
reqCtx.c.Error(errors.NewInternalServerError(err.Error()))
|
||||
return
|
||||
}
|
||||
reqCtx.userMessageID = userMsg.ID
|
||||
|
||||
// Create assistant message
|
||||
if _, err := h.createAssistantMessage(ctx, reqCtx.assistantMessage); err != nil {
|
||||
reqCtx.c.Error(errors.NewInternalServerError(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
logger.Infof(ctx, "Using knowledge bases: %v", reqCtx.knowledgeBaseIDs)
|
||||
|
||||
// Setup SSE stream
|
||||
streamCtx := h.setupSSEStream(reqCtx, generateTitle)
|
||||
|
||||
// Setup completion handler for normal mode
|
||||
// Note: Thinking content is now embedded in answer stream with <think> tags
|
||||
// by chat_completion_stream.go, so we don't need separate thinking event handling
|
||||
var completionHandled bool // Prevent duplicate completion handling
|
||||
|
||||
streamCtx.eventBus.On(event.EventAgentFinalAnswer, func(ctx context.Context, evt event.Event) error {
|
||||
data, ok := evt.Data.(event.AgentFinalAnswerData)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
streamCtx.assistantMessage.Content += data.Content
|
||||
if data.IsFallback {
|
||||
streamCtx.assistantMessage.IsFallback = true
|
||||
}
|
||||
if data.Done {
|
||||
// Prevent duplicate completion handling
|
||||
if completionHandled {
|
||||
return nil
|
||||
}
|
||||
completionHandled = true
|
||||
|
||||
logger.Infof(streamCtx.asyncCtx, "Knowledge QA service completed for session: %s", sessionID)
|
||||
// Content already contains <think>...</think> tags from chat_completion_stream.go
|
||||
// Use session's tenant for message update (asyncCtx may have effectiveTenantID when using shared agent)
|
||||
updateCtx := context.WithValue(streamCtx.asyncCtx, types.TenantIDContextKey, reqCtx.session.TenantID)
|
||||
h.completeAssistantMessage(updateCtx, streamCtx.assistantMessage, reqCtx.query)
|
||||
// Emit EventAgentComplete - this will trigger handleComplete which sends the SSE complete event
|
||||
// Note: Don't cancel context here, let the SSE handler close naturally after receiving the complete event
|
||||
streamCtx.eventBus.Emit(streamCtx.asyncCtx, event.Event{
|
||||
Type: event.EventAgentComplete,
|
||||
SessionID: sessionID,
|
||||
Data: event.AgentCompleteData{FinalAnswer: streamCtx.assistantMessage.Content},
|
||||
})
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
// Execute KnowledgeQA asynchronously
|
||||
go func() {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
buf := make([]byte, 10240)
|
||||
runtime.Stack(buf, true)
|
||||
logger.ErrorWithFields(streamCtx.asyncCtx,
|
||||
errors.NewInternalServerError(fmt.Sprintf("Knowledge QA service panicked: %v\n%s", r, string(buf))), nil)
|
||||
}
|
||||
}()
|
||||
|
||||
// For pure-chat path (no KB, no web search), VLM analysis isn't handled by the
|
||||
// rewrite pipeline step, so run it here with progress events.
|
||||
// RAG paths (with KB/web search, including agent-resolved KBs) defer VLM analysis
|
||||
// to the rewrite step to avoid duplicate progress events.
|
||||
hasRequestKBs := len(reqCtx.knowledgeBaseIDs) > 0 || len(reqCtx.knowledgeIDs) > 0
|
||||
agentWillResolveKBs := false
|
||||
if !hasRequestKBs && reqCtx.customAgent != nil && !reqCtx.customAgent.Config.RetrieveKBOnlyWhenMentioned {
|
||||
mode := reqCtx.customAgent.Config.KBSelectionMode
|
||||
switch mode {
|
||||
case "all":
|
||||
agentWillResolveKBs = true
|
||||
case "selected", "":
|
||||
// "" keeps backward-compatible behavior (same as selected).
|
||||
agentWillResolveKBs = len(reqCtx.customAgent.Config.KnowledgeBases) > 0
|
||||
case "none":
|
||||
agentWillResolveKBs = false
|
||||
default:
|
||||
agentWillResolveKBs = len(reqCtx.customAgent.Config.KnowledgeBases) > 0
|
||||
}
|
||||
}
|
||||
isPureChatPath := !hasRequestKBs && !agentWillResolveKBs && !reqCtx.webSearchEnabled
|
||||
if isPureChatPath && len(reqCtx.images) > 0 &&
|
||||
reqCtx.customAgent != nil && reqCtx.customAgent.Config.VLMModelID != "" {
|
||||
toolCallID := uuid.New().String()
|
||||
streamCtx.eventBus.Emit(streamCtx.asyncCtx, event.Event{
|
||||
Type: event.EventAgentToolCall,
|
||||
SessionID: sessionID,
|
||||
Data: event.AgentToolCallData{
|
||||
ToolCallID: toolCallID,
|
||||
ToolName: "image_analysis",
|
||||
},
|
||||
})
|
||||
vlmStart := time.Now()
|
||||
h.analyzeImageAttachments(streamCtx.asyncCtx, reqCtx.images,
|
||||
reqCtx.customAgent.Config.VLMModelID, reqCtx.query)
|
||||
streamCtx.eventBus.Emit(streamCtx.asyncCtx, event.Event{
|
||||
Type: event.EventAgentToolResult,
|
||||
SessionID: sessionID,
|
||||
Data: event.AgentToolResultData{
|
||||
ToolCallID: toolCallID,
|
||||
ToolName: "image_analysis",
|
||||
Output: "已分析图片内容",
|
||||
Success: true,
|
||||
Duration: time.Since(vlmStart).Milliseconds(),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
imageURLs, imageDescription := extractImageURLsAndOCRText(reqCtx.images)
|
||||
err := h.sessionService.KnowledgeQA(
|
||||
streamCtx.asyncCtx,
|
||||
reqCtx.session,
|
||||
reqCtx.query,
|
||||
reqCtx.knowledgeBaseIDs,
|
||||
reqCtx.knowledgeIDs,
|
||||
reqCtx.assistantMessage.ID,
|
||||
reqCtx.summaryModelID,
|
||||
reqCtx.webSearchEnabled,
|
||||
streamCtx.eventBus,
|
||||
reqCtx.customAgent,
|
||||
reqCtx.enableMemory,
|
||||
imageURLs, imageDescription,
|
||||
reqCtx.userMessageID,
|
||||
)
|
||||
if err != nil {
|
||||
logger.ErrorWithFields(streamCtx.asyncCtx, err, nil)
|
||||
streamCtx.eventBus.Emit(streamCtx.asyncCtx, event.Event{
|
||||
Type: event.EventError,
|
||||
SessionID: sessionID,
|
||||
Data: event.ErrorData{
|
||||
Error: err.Error(),
|
||||
Stage: "knowledge_qa_execution",
|
||||
SessionID: sessionID,
|
||||
},
|
||||
})
|
||||
}
|
||||
}()
|
||||
|
||||
// Handle SSE events (blocking)
|
||||
shouldWaitForTitle := generateTitle && reqCtx.session.Title == ""
|
||||
h.handleAgentEventsForSSE(ctx, reqCtx.c, sessionID, reqCtx.assistantMessage.ID,
|
||||
reqCtx.requestID, streamCtx.eventBus, shouldWaitForTitle)
|
||||
}
|
||||
|
||||
// executeAgentModeQA executes the agent mode
|
||||
func (h *Handler) executeAgentModeQA(reqCtx *qaRequestContext) {
|
||||
ctx := reqCtx.ctx
|
||||
sessionID := reqCtx.sessionID
|
||||
|
||||
// Emit agent query event
|
||||
if err := event.Emit(ctx, event.Event{
|
||||
Type: event.EventAgentQuery,
|
||||
SessionID: sessionID,
|
||||
RequestID: reqCtx.requestID,
|
||||
Data: event.AgentQueryData{
|
||||
// Agent mode: emit agent query event before message creation
|
||||
if mode == qaModeAgent {
|
||||
if err := event.Emit(ctx, event.Event{
|
||||
Type: event.EventAgentQuery,
|
||||
SessionID: sessionID,
|
||||
Query: reqCtx.query,
|
||||
RequestID: reqCtx.requestID,
|
||||
},
|
||||
}); err != nil {
|
||||
logger.Errorf(ctx, "Failed to emit agent query event: %v", err)
|
||||
return
|
||||
Data: event.AgentQueryData{
|
||||
SessionID: sessionID,
|
||||
Query: reqCtx.query,
|
||||
RequestID: reqCtx.requestID,
|
||||
},
|
||||
}); err != nil {
|
||||
logger.Errorf(ctx, "Failed to emit agent query event: %v", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Create user message
|
||||
@@ -590,80 +444,107 @@ func (h *Handler) executeAgentModeQA(reqCtx *qaRequestContext) {
|
||||
}
|
||||
reqCtx.assistantMessage = assistantMessagePtr
|
||||
|
||||
logger.Infof(ctx, "Calling agent QA service, session ID: %s", sessionID)
|
||||
if mode == qaModeNormal {
|
||||
logger.Infof(ctx, "Using knowledge bases: %v", reqCtx.knowledgeBaseIDs)
|
||||
} else {
|
||||
logger.Infof(ctx, "Calling agent QA service, session ID: %s", sessionID)
|
||||
}
|
||||
|
||||
// Setup SSE stream (agent mode always generates title)
|
||||
streamCtx := h.setupSSEStream(reqCtx, true)
|
||||
// Setup SSE stream
|
||||
streamCtx := h.setupSSEStream(reqCtx, generateTitle)
|
||||
|
||||
// Execute AgentQA asynchronously
|
||||
// Normal mode: register completion handler on EventAgentFinalAnswer
|
||||
// (Agent mode handles completion in the defer block instead)
|
||||
if mode == qaModeNormal {
|
||||
var completionHandled bool
|
||||
streamCtx.eventBus.On(event.EventAgentFinalAnswer, func(ctx context.Context, evt event.Event) error {
|
||||
data, ok := evt.Data.(event.AgentFinalAnswerData)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
streamCtx.assistantMessage.Content += data.Content
|
||||
if data.IsFallback {
|
||||
streamCtx.assistantMessage.IsFallback = true
|
||||
}
|
||||
if data.Done {
|
||||
if completionHandled {
|
||||
return nil
|
||||
}
|
||||
completionHandled = true
|
||||
|
||||
logger.Infof(streamCtx.asyncCtx, "Knowledge QA service completed for session: %s", sessionID)
|
||||
updateCtx := context.WithValue(streamCtx.asyncCtx, types.TenantIDContextKey, reqCtx.session.TenantID)
|
||||
h.completeAssistantMessage(updateCtx, streamCtx.assistantMessage, reqCtx.query)
|
||||
streamCtx.eventBus.Emit(streamCtx.asyncCtx, event.Event{
|
||||
Type: event.EventAgentComplete,
|
||||
SessionID: sessionID,
|
||||
Data: event.AgentCompleteData{FinalAnswer: streamCtx.assistantMessage.Content},
|
||||
})
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// Execute QA asynchronously
|
||||
go func() {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
buf := make([]byte, 1024)
|
||||
buf := make([]byte, 10240)
|
||||
runtime.Stack(buf, true)
|
||||
stageName := "Knowledge QA"
|
||||
if mode == qaModeAgent {
|
||||
stageName = "Agent QA"
|
||||
}
|
||||
logger.ErrorWithFields(streamCtx.asyncCtx,
|
||||
errors.NewInternalServerError(fmt.Sprintf("Agent QA service panicked: %v\n%s", r, string(buf))),
|
||||
errors.NewInternalServerError(fmt.Sprintf("%s service panicked: %v\n%s", stageName, r, string(buf))),
|
||||
map[string]interface{}{"session_id": sessionID})
|
||||
}
|
||||
// Use session's tenant for message update (session belongs to session.TenantID; asyncCtx may have effectiveTenantID when using shared agent)
|
||||
updateCtx := context.WithValue(streamCtx.asyncCtx, types.TenantIDContextKey, reqCtx.session.TenantID)
|
||||
h.completeAssistantMessage(updateCtx, streamCtx.assistantMessage, reqCtx.query)
|
||||
logger.Infof(streamCtx.asyncCtx, "Agent QA service completed for session: %s", sessionID)
|
||||
// Agent mode: complete the assistant message in defer (normal mode does it via event handler)
|
||||
if mode == qaModeAgent {
|
||||
updateCtx := context.WithValue(streamCtx.asyncCtx, types.TenantIDContextKey, reqCtx.session.TenantID)
|
||||
h.completeAssistantMessage(updateCtx, streamCtx.assistantMessage, reqCtx.query)
|
||||
logger.Infof(streamCtx.asyncCtx, "Agent QA service completed for session: %s", sessionID)
|
||||
}
|
||||
}()
|
||||
|
||||
// Run VLM analysis inside the async flow so SSE stream is already up
|
||||
// and the user can see progress. Emit tool_call/tool_result events.
|
||||
if len(reqCtx.images) > 0 && reqCtx.customAgent != nil && reqCtx.customAgent.Config.VLMModelID != "" {
|
||||
toolCallID := uuid.New().String()
|
||||
streamCtx.eventBus.Emit(streamCtx.asyncCtx, event.Event{
|
||||
Type: event.EventAgentToolCall,
|
||||
SessionID: sessionID,
|
||||
Data: event.AgentToolCallData{
|
||||
ToolCallID: toolCallID,
|
||||
ToolName: "image_analysis",
|
||||
Iteration: 0,
|
||||
},
|
||||
})
|
||||
vlmStart := time.Now()
|
||||
h.analyzeImageAttachments(streamCtx.asyncCtx, reqCtx.images,
|
||||
reqCtx.customAgent.Config.VLMModelID, reqCtx.query)
|
||||
streamCtx.eventBus.Emit(streamCtx.asyncCtx, event.Event{
|
||||
Type: event.EventAgentToolResult,
|
||||
SessionID: sessionID,
|
||||
Data: event.AgentToolResultData{
|
||||
ToolCallID: toolCallID,
|
||||
ToolName: "image_analysis",
|
||||
Output: "已查看图片内容",
|
||||
Success: true,
|
||||
Duration: time.Since(vlmStart).Milliseconds(),
|
||||
Iteration: 0,
|
||||
},
|
||||
})
|
||||
// Run VLM image analysis if applicable
|
||||
h.runVLMAnalysisIfNeeded(streamCtx, reqCtx, mode)
|
||||
|
||||
// Build QA request and invoke the appropriate service
|
||||
imageURLs, imageDescription := extractImageURLsAndOCRText(reqCtx.images)
|
||||
qaReq := &types.QARequest{
|
||||
Session: reqCtx.session,
|
||||
Query: reqCtx.query,
|
||||
AssistantMessageID: reqCtx.assistantMessage.ID,
|
||||
SummaryModelID: reqCtx.summaryModelID,
|
||||
CustomAgent: reqCtx.customAgent,
|
||||
KnowledgeBaseIDs: reqCtx.knowledgeBaseIDs,
|
||||
KnowledgeIDs: reqCtx.knowledgeIDs,
|
||||
ImageURLs: imageURLs,
|
||||
ImageDescription: imageDescription,
|
||||
UserMessageID: reqCtx.userMessageID,
|
||||
WebSearchEnabled: reqCtx.webSearchEnabled,
|
||||
EnableMemory: reqCtx.enableMemory,
|
||||
}
|
||||
|
||||
imageURLs, imageDescription := extractImageURLsAndOCRText(reqCtx.images)
|
||||
err := h.sessionService.AgentQA(
|
||||
streamCtx.asyncCtx,
|
||||
reqCtx.session,
|
||||
reqCtx.query,
|
||||
reqCtx.assistantMessage.ID,
|
||||
reqCtx.summaryModelID,
|
||||
streamCtx.eventBus,
|
||||
reqCtx.customAgent,
|
||||
reqCtx.knowledgeBaseIDs,
|
||||
reqCtx.knowledgeIDs,
|
||||
imageURLs, imageDescription,
|
||||
reqCtx.userMessageID,
|
||||
reqCtx.webSearchEnabled,
|
||||
)
|
||||
if err != nil {
|
||||
logger.ErrorWithFields(streamCtx.asyncCtx, err, nil)
|
||||
var serviceErr error
|
||||
var stageName string
|
||||
if mode == qaModeNormal {
|
||||
stageName = "knowledge_qa_execution"
|
||||
serviceErr = h.sessionService.KnowledgeQA(streamCtx.asyncCtx, qaReq, streamCtx.eventBus)
|
||||
} else {
|
||||
stageName = "agent_execution"
|
||||
serviceErr = h.sessionService.AgentQA(streamCtx.asyncCtx, qaReq, streamCtx.eventBus)
|
||||
}
|
||||
|
||||
if serviceErr != nil {
|
||||
logger.ErrorWithFields(streamCtx.asyncCtx, serviceErr, nil)
|
||||
streamCtx.eventBus.Emit(streamCtx.asyncCtx, event.Event{
|
||||
Type: event.EventError,
|
||||
SessionID: sessionID,
|
||||
Data: event.ErrorData{
|
||||
Error: err.Error(),
|
||||
Stage: "agent_execution",
|
||||
Error: serviceErr.Error(),
|
||||
Stage: stageName,
|
||||
SessionID: sessionID,
|
||||
},
|
||||
})
|
||||
@@ -671,8 +552,78 @@ func (h *Handler) executeAgentModeQA(reqCtx *qaRequestContext) {
|
||||
}()
|
||||
|
||||
// Handle SSE events (blocking)
|
||||
shouldWaitForTitle := generateTitle && reqCtx.session.Title == ""
|
||||
h.handleAgentEventsForSSE(ctx, reqCtx.c, sessionID, reqCtx.assistantMessage.ID,
|
||||
reqCtx.requestID, streamCtx.eventBus, reqCtx.session.Title == "")
|
||||
reqCtx.requestID, streamCtx.eventBus, shouldWaitForTitle)
|
||||
}
|
||||
|
||||
// runVLMAnalysisIfNeeded runs VLM image analysis within the async goroutine,
|
||||
// emitting tool_call/tool_result events so the user can see progress.
|
||||
// For normal mode, VLM only runs on the pure-chat path (no KB, no web search);
|
||||
// RAG paths defer VLM to the pipeline rewrite step.
|
||||
// For agent mode, VLM always runs when images and a VLM model are present.
|
||||
func (h *Handler) runVLMAnalysisIfNeeded(streamCtx *sseStreamContext, reqCtx *qaRequestContext, mode qaMode) {
|
||||
if len(reqCtx.images) == 0 || reqCtx.customAgent == nil || reqCtx.customAgent.Config.VLMModelID == "" {
|
||||
return
|
||||
}
|
||||
|
||||
sessionID := reqCtx.sessionID
|
||||
|
||||
// In normal mode, only run VLM for pure-chat path
|
||||
if mode == qaModeNormal {
|
||||
hasRequestKBs := len(reqCtx.knowledgeBaseIDs) > 0 || len(reqCtx.knowledgeIDs) > 0
|
||||
agentWillResolveKBs := false
|
||||
if !hasRequestKBs && reqCtx.customAgent != nil && !reqCtx.customAgent.Config.RetrieveKBOnlyWhenMentioned {
|
||||
switch reqCtx.customAgent.Config.KBSelectionMode {
|
||||
case "all":
|
||||
agentWillResolveKBs = true
|
||||
case "selected", "":
|
||||
agentWillResolveKBs = len(reqCtx.customAgent.Config.KnowledgeBases) > 0
|
||||
case "none":
|
||||
agentWillResolveKBs = false
|
||||
default:
|
||||
agentWillResolveKBs = len(reqCtx.customAgent.Config.KnowledgeBases) > 0
|
||||
}
|
||||
}
|
||||
if hasRequestKBs || agentWillResolveKBs || reqCtx.webSearchEnabled {
|
||||
return // VLM will be handled by the pipeline rewrite step
|
||||
}
|
||||
}
|
||||
|
||||
// Emit VLM tool call/result events
|
||||
toolCallID := uuid.New().String()
|
||||
iteration := 0 // agent mode uses iteration field
|
||||
|
||||
streamCtx.eventBus.Emit(streamCtx.asyncCtx, event.Event{
|
||||
Type: event.EventAgentToolCall,
|
||||
SessionID: sessionID,
|
||||
Data: event.AgentToolCallData{
|
||||
ToolCallID: toolCallID,
|
||||
ToolName: "image_analysis",
|
||||
Iteration: iteration,
|
||||
},
|
||||
})
|
||||
|
||||
vlmStart := time.Now()
|
||||
h.analyzeImageAttachments(streamCtx.asyncCtx, reqCtx.images,
|
||||
reqCtx.customAgent.Config.VLMModelID, reqCtx.query)
|
||||
|
||||
outputMsg := "已分析图片内容"
|
||||
if mode == qaModeAgent {
|
||||
outputMsg = "已查看图片内容"
|
||||
}
|
||||
streamCtx.eventBus.Emit(streamCtx.asyncCtx, event.Event{
|
||||
Type: event.EventAgentToolResult,
|
||||
SessionID: sessionID,
|
||||
Data: event.AgentToolResultData{
|
||||
ToolCallID: toolCallID,
|
||||
ToolName: "image_analysis",
|
||||
Output: outputMsg,
|
||||
Success: true,
|
||||
Duration: time.Since(vlmStart).Milliseconds(),
|
||||
Iteration: iteration,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// completeAssistantMessage marks an assistant message as complete, updates it,
|
||||
|
||||
Reference in New Issue
Block a user