feat: enhance agent and user information structures
- Added support for image attachments in agent Q&A requests, enabling multimodal chat capabilities. - Introduced a new UserInfo struct to represent user information in API responses, improving user data management. - Updated existing request structures to include image handling, enhancing the overall functionality of the chat system. These changes significantly improve the application's ability to handle multimodal interactions and manage user data effectively.
This commit is contained in:
@@ -32,6 +32,7 @@ type AgentQARequest struct {
|
|||||||
MentionedItems []MentionedItem `json:"mentioned_items,omitempty"` // @mentioned knowledge bases and files
|
MentionedItems []MentionedItem `json:"mentioned_items,omitempty"` // @mentioned knowledge bases and files
|
||||||
DisableTitle bool `json:"disable_title,omitempty"` // Whether to disable auto title generation
|
DisableTitle bool `json:"disable_title,omitempty"` // Whether to disable auto title generation
|
||||||
MCPServiceIDs []string `json:"mcp_service_ids,omitempty"` // Optional MCP service allow list (deprecated)
|
MCPServiceIDs []string `json:"mcp_service_ids,omitempty"` // Optional MCP service allow list (deprecated)
|
||||||
|
Images []ImageAttachment `json:"images,omitempty"` // Attached images for multimodal chat
|
||||||
}
|
}
|
||||||
|
|
||||||
// AgentResponseType defines the type of agent response
|
// AgentResponseType defines the type of agent response
|
||||||
|
|||||||
@@ -126,6 +126,19 @@ type JoinRequestResponse struct {
|
|||||||
ReviewedAt *time.Time `json:"reviewed_at,omitempty"`
|
ReviewedAt *time.Time `json:"reviewed_at,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UserInfo represents user information for API responses
|
||||||
|
type UserInfo struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Username string `json:"username"`
|
||||||
|
Email string `json:"email"`
|
||||||
|
Avatar string `json:"avatar"`
|
||||||
|
TenantID uint64 `json:"tenant_id"`
|
||||||
|
IsActive bool `json:"is_active"`
|
||||||
|
CanAccessAllTenants bool `json:"can_access_all_tenants"`
|
||||||
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
|
}
|
||||||
|
|
||||||
// SharedKnowledgeBaseInfo represents a shared knowledge base
|
// SharedKnowledgeBaseInfo represents a shared knowledge base
|
||||||
type SharedKnowledgeBaseInfo struct {
|
type SharedKnowledgeBaseInfo struct {
|
||||||
ShareID string `json:"share_id"`
|
ShareID string `json:"share_id"`
|
||||||
|
|||||||
@@ -198,6 +198,15 @@ func (c *Client) GenerateTitle(ctx context.Context, sessionID string, request *G
|
|||||||
return response.Data, nil
|
return response.Data, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ImageAttachment represents an image in a chat request.
|
||||||
|
// Frontend sends base64 data in the Data field; the backend saves, runs VLM analysis,
|
||||||
|
// and populates URL/Caption before proceeding with the chat pipeline.
|
||||||
|
type ImageAttachment struct {
|
||||||
|
Data string `json:"data,omitempty"` // base64 data URI (data:image/png;base64,...)
|
||||||
|
URL string `json:"url,omitempty"` // serving URL after saving to storage
|
||||||
|
Caption string `json:"caption,omitempty"` // VLM analysis result
|
||||||
|
}
|
||||||
|
|
||||||
// KnowledgeQARequest knowledge Q&A request
|
// KnowledgeQARequest knowledge Q&A request
|
||||||
type KnowledgeQARequest struct {
|
type KnowledgeQARequest struct {
|
||||||
Query string `json:"query"` // Query text for knowledge base search
|
Query string `json:"query"` // Query text for knowledge base search
|
||||||
@@ -208,6 +217,7 @@ type KnowledgeQARequest struct {
|
|||||||
WebSearchEnabled bool `json:"web_search_enabled"` // Whether web search is enabled for this request
|
WebSearchEnabled bool `json:"web_search_enabled"` // Whether web search is enabled for this request
|
||||||
SummaryModelID string `json:"summary_model_id"` // Optional summary model ID (overrides session default)
|
SummaryModelID string `json:"summary_model_id"` // Optional summary model ID (overrides session default)
|
||||||
DisableTitle bool `json:"disable_title"` // Whether to disable auto title generation
|
DisableTitle bool `json:"disable_title"` // Whether to disable auto title generation
|
||||||
|
Images []ImageAttachment `json:"images,omitempty"` // Attached images for multimodal chat
|
||||||
}
|
}
|
||||||
|
|
||||||
// LLMToolCall represents a function/tool call from the LLM
|
// LLMToolCall represents a function/tool call from the LLM
|
||||||
|
|||||||
Reference in New Issue
Block a user