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:
+11
-10
@@ -22,16 +22,17 @@ type MentionedItem struct {
|
|||||||
|
|
||||||
// AgentQARequest agent Q&A request payload.
|
// AgentQARequest agent Q&A request payload.
|
||||||
type AgentQARequest struct {
|
type AgentQARequest struct {
|
||||||
Query string `json:"query"` // Required query text
|
Query string `json:"query"` // Required query text
|
||||||
KnowledgeBaseIDs []string `json:"knowledge_base_ids,omitempty"` // Optional KBs for this query
|
KnowledgeBaseIDs []string `json:"knowledge_base_ids,omitempty"` // Optional KBs for this query
|
||||||
KnowledgeIDs []string `json:"knowledge_ids,omitempty"` // Optional specific knowledge IDs for this query
|
KnowledgeIDs []string `json:"knowledge_ids,omitempty"` // Optional specific knowledge IDs for this query
|
||||||
AgentEnabled bool `json:"agent_enabled"` // Whether to run in agent mode
|
AgentEnabled bool `json:"agent_enabled"` // Whether to run in agent mode
|
||||||
AgentID string `json:"agent_id,omitempty"` // Optional custom agent ID
|
AgentID string `json:"agent_id,omitempty"` // Optional custom agent ID
|
||||||
WebSearchEnabled bool `json:"web_search_enabled"` // Whether to enable web search
|
WebSearchEnabled bool `json:"web_search_enabled"` // Whether to enable web search
|
||||||
SummaryModelID string `json:"summary_model_id,omitempty"` // Optional summary model override
|
SummaryModelID string `json:"summary_model_id,omitempty"` // Optional summary model override
|
||||||
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"`
|
||||||
|
|||||||
+18
-8
@@ -198,16 +198,26 @@ 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
|
||||||
KnowledgeBaseIDs []string `json:"knowledge_base_ids"` // Selected knowledge base IDs for this request
|
KnowledgeBaseIDs []string `json:"knowledge_base_ids"` // Selected knowledge base IDs for this request
|
||||||
KnowledgeIDs []string `json:"knowledge_ids"` // Selected knowledge IDs for this request
|
KnowledgeIDs []string `json:"knowledge_ids"` // Selected knowledge IDs for this request
|
||||||
AgentEnabled bool `json:"agent_enabled"` // Whether agent mode is enabled for this request
|
AgentEnabled bool `json:"agent_enabled"` // Whether agent mode is enabled for this request
|
||||||
AgentID string `json:"agent_id"` // Selected custom agent ID for this request
|
AgentID string `json:"agent_id"` // Selected custom agent ID for this request
|
||||||
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