refactor: restructure channel gateway and chat module architecture

- Refactor channel adapters (feishu, telegram, local) with enhanced descriptor and config
- Restructure channel manager, service, types, and outbound messaging
- Simplify chat module by removing normalize.go and chat.go, consolidating into resolver and types
- Update router channel handlers and tests
- Sync swagger documentation
This commit is contained in:
BBQ
2026-02-06 20:22:37 +08:00
parent c3cfdc4096
commit a246b79a4f
42 changed files with 1683 additions and 1745 deletions
+173 -65
View File
@@ -232,6 +232,41 @@
}
},
"/bots/{bot_id}/container": {
"get": {
"tags": [
"containerd"
],
"summary": "Get container info for bot",
"parameters": [
{
"type": "string",
"description": "Bot ID",
"name": "bot_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.GetContainerResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
},
"post": {
"tags": [
"containerd"
@@ -275,14 +310,12 @@
}
}
}
}
},
"/bots/{bot_id}/container/list": {
"get": {
},
"delete": {
"tags": [
"containerd"
],
"summary": "List containers for bot",
"summary": "Delete MCP container for bot",
"parameters": [
{
"type": "string",
@@ -293,10 +326,13 @@
}
],
"responses": {
"200": {
"description": "OK",
"204": {
"description": "No Content"
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ListContainersResponse"
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
@@ -342,7 +378,7 @@
"tags": [
"containerd"
],
"summary": "Create container snapshot",
"summary": "Create container snapshot for bot",
"parameters": [
{
"type": "string",
@@ -367,16 +403,28 @@
"schema": {
"$ref": "#/definitions/handlers.CreateSnapshotResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/bots/{bot_id}/container/{id}": {
"delete": {
"/bots/{bot_id}/container/start": {
"post": {
"tags": [
"containerd"
],
"summary": "Delete MCP container",
"summary": "Start container task for bot",
"parameters": [
{
"type": "string",
@@ -384,23 +432,50 @@
"name": "bot_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/bots/{bot_id}/container/stop": {
"post": {
"tags": [
"containerd"
],
"summary": "Stop container task for bot",
"parameters": [
{
"type": "string",
"description": "Container ID",
"name": "id",
"description": "Bot ID",
"name": "bot_id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
},
"400": {
"description": "Bad Request",
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
"type": "object"
}
},
"404": {
@@ -4485,7 +4560,7 @@
"messages": {
"type": "array",
"items": {
"$ref": "#/definitions/chat.GatewayMessage"
"$ref": "#/definitions/chat.ModelMessage"
}
},
"model": {
@@ -4511,7 +4586,7 @@
"messages": {
"type": "array",
"items": {
"$ref": "#/definitions/chat.GatewayMessage"
"$ref": "#/definitions/chat.ModelMessage"
}
},
"model": {
@@ -4528,9 +4603,56 @@
}
}
},
"chat.GatewayMessage": {
"chat.ModelMessage": {
"type": "object",
"additionalProperties": {}
"properties": {
"content": {
"type": "array",
"items": {
"type": "integer"
}
},
"name": {
"type": "string"
},
"role": {
"type": "string"
},
"tool_call_id": {
"type": "string"
},
"tool_calls": {
"type": "array",
"items": {
"$ref": "#/definitions/chat.ToolCall"
}
}
}
},
"chat.ToolCall": {
"type": "object",
"properties": {
"function": {
"$ref": "#/definitions/chat.ToolCallFunction"
},
"id": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"chat.ToolCallFunction": {
"type": "object",
"properties": {
"arguments": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"handlers.ChannelMeta": {
"type": "object",
@@ -4558,41 +4680,9 @@
}
}
},
"handlers.ContainerInfo": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"id": {
"type": "string"
},
"image": {
"type": "string"
},
"labels": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"snapshot_key": {
"type": "string"
},
"snapshotter": {
"type": "string"
},
"updated_at": {
"type": "string"
}
}
},
"handlers.CreateContainerRequest": {
"type": "object",
"properties": {
"container_id": {
"type": "string"
},
"image": {
"type": "string"
},
@@ -4621,9 +4711,6 @@
"handlers.CreateSnapshotRequest": {
"type": "object",
"properties": {
"container_id": {
"type": "string"
},
"snapshot_name": {
"type": "string"
}
@@ -4739,14 +4826,35 @@
}
}
},
"handlers.ListContainersResponse": {
"handlers.GetContainerResponse": {
"type": "object",
"properties": {
"containers": {
"type": "array",
"items": {
"$ref": "#/definitions/handlers.ContainerInfo"
}
"container_id": {
"type": "string"
},
"container_path": {
"type": "string"
},
"created_at": {
"type": "string"
},
"host_path": {
"type": "string"
},
"image": {
"type": "string"
},
"namespace": {
"type": "string"
},
"status": {
"type": "string"
},
"task_running": {
"type": "boolean"
},
"updated_at": {
"type": "string"
}
}
},