yao/yao/models/agent/chat.mod.yao
Max 24ad563070 Add assistant info retrieval and chat mode management
- Introduced `GetInfo` method in the Assistant struct to return basic assistant information with optional locale support for internationalization.
- Implemented `GetInfoByIDs` function to retrieve information for multiple assistants based on their IDs, enhancing batch processing capabilities.
- Updated chat buffer management to include a mode parameter, allowing for dynamic switching between chat and task modes.
- Enhanced message handling to store and retrieve the mode associated with each message, improving context tracking during chat sessions.
- Revised tests to validate the new functionalities, ensuring accurate retrieval of assistant information and proper mode management in chat operations.
2025-12-10 12:15:55 +08:00

132 lines
3 KiB
Text

{
"name": "Chat",
"label": "Chat",
"description": "Chat session table for storing chat metadata and session information",
"tags": ["agent", "system"],
"builtin": true,
"readonly": true,
"sort": 9999,
"table": { "name": "agent_chat", "comment": "Agent chat session table" },
"columns": [
{
"name": "id",
"type": "ID",
"label": "ID",
"comment": "Auto-increment primary key"
},
{
"name": "chat_id",
"type": "string",
"label": "Chat ID",
"comment": "Unique chat identifier",
"length": 64,
"nullable": false,
"unique": true
},
{
"name": "title",
"type": "string",
"label": "Title",
"comment": "Chat title",
"length": 500,
"nullable": true
},
{
"name": "assistant_id",
"type": "string",
"label": "Assistant ID",
"comment": "Associated assistant ID",
"length": 200,
"nullable": false,
"index": true
},
{
"name": "last_connector",
"type": "string",
"label": "Last Connector",
"comment": "Last used connector ID (updated on each message)",
"length": 200,
"nullable": true,
"index": true
},
{
"name": "last_mode",
"type": "string",
"label": "Last Mode",
"comment": "Last used chat mode (updated on each message)",
"length": 50,
"nullable": true
},
{
"name": "status",
"type": "enum",
"label": "Status",
"comment": "Chat status",
"option": ["active", "archived"],
"default": "active",
"nullable": false,
"index": true
},
{
"name": "public",
"type": "boolean",
"label": "Public",
"comment": "Whether shared across all teams",
"default": false,
"nullable": false
},
{
"name": "share",
"type": "enum",
"label": "Share",
"comment": "Sharing scope",
"option": ["private", "team"],
"default": "private",
"nullable": false,
"index": true
},
{
"name": "sort",
"type": "integer",
"label": "Sort",
"comment": "Sort order for display",
"default": 9999
},
{
"name": "last_message_at",
"type": "datetime",
"label": "Last Message At",
"comment": "Timestamp of last message",
"nullable": true,
"index": true
},
{
"name": "metadata",
"type": "json",
"label": "Metadata",
"comment": "Additional metadata",
"nullable": true
}
],
"relations": {
"assistant": {
"type": "hasOne",
"model": "__yao.agent.assistant",
"key": "assistant_id",
"foreign": "assistant_id"
},
"messages": {
"type": "hasMany",
"model": "__yao.agent.message",
"key": "chat_id",
"foreign": "chat_id"
},
"resumes": {
"type": "hasMany",
"model": "__yao.agent.resume",
"key": "chat_id",
"foreign": "chat_id"
}
},
"option": { "timestamps": true, "soft_deletes": true, "permission": true }
}