mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
feat(web): use generate sdk
This commit is contained in:
+360
@@ -162,6 +162,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Chat with AI",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Chat request",
|
||||
"name": "request",
|
||||
@@ -208,6 +215,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Stream chat with AI",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Chat request",
|
||||
"name": "request",
|
||||
@@ -1136,6 +1150,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "List history records",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Limit",
|
||||
@@ -1171,6 +1192,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Create history record",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "History payload",
|
||||
"name": "payload",
|
||||
@@ -1208,6 +1236,15 @@ const docTemplate = `{
|
||||
"history"
|
||||
],
|
||||
"summary": "Delete all history records",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": "No Content"
|
||||
@@ -1235,6 +1272,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Get history record",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "History ID",
|
||||
@@ -1277,6 +1321,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Delete history record",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "History ID",
|
||||
@@ -1317,6 +1368,15 @@ const docTemplate = `{
|
||||
"mcp"
|
||||
],
|
||||
"summary": "List MCP connections",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
@@ -1357,6 +1417,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Create MCP connection",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "MCP payload",
|
||||
"name": "payload",
|
||||
@@ -1522,6 +1589,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Get MCP connection",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "MCP ID",
|
||||
@@ -1570,6 +1644,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Update MCP connection",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "MCP ID",
|
||||
@@ -1627,6 +1708,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Delete MCP connection",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "MCP ID",
|
||||
@@ -1674,6 +1762,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Add memory",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Add request",
|
||||
"name": "payload",
|
||||
@@ -1714,6 +1809,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Embed and upsert memory",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Embed upsert request",
|
||||
"name": "payload",
|
||||
@@ -1754,6 +1856,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "List memories",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Run ID",
|
||||
@@ -1795,6 +1904,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Delete memories",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Delete all request",
|
||||
"name": "payload",
|
||||
@@ -1835,6 +1951,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Get memory",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Memory ID",
|
||||
@@ -1871,6 +1994,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Delete memory",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Memory ID",
|
||||
@@ -1909,6 +2039,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Search memories",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Search request",
|
||||
"name": "payload",
|
||||
@@ -1949,6 +2086,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Update memory",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Update request",
|
||||
"name": "payload",
|
||||
@@ -1988,6 +2132,15 @@ const docTemplate = `{
|
||||
"schedule"
|
||||
],
|
||||
"summary": "List schedules",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
@@ -2016,6 +2169,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Create schedule",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Schedule payload",
|
||||
"name": "payload",
|
||||
@@ -2056,6 +2216,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Get schedule",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Schedule ID",
|
||||
@@ -2098,6 +2265,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Update schedule",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Schedule ID",
|
||||
@@ -2143,6 +2317,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Delete schedule",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Schedule ID",
|
||||
@@ -2177,6 +2358,15 @@ const docTemplate = `{
|
||||
"settings"
|
||||
],
|
||||
"summary": "Get user settings",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
@@ -2205,6 +2395,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Update user settings",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Settings payload",
|
||||
"name": "payload",
|
||||
@@ -2243,6 +2440,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Update user settings",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Settings payload",
|
||||
"name": "payload",
|
||||
@@ -2280,6 +2484,15 @@ const docTemplate = `{
|
||||
"settings"
|
||||
],
|
||||
"summary": "Delete user settings",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": "No Content"
|
||||
@@ -2306,6 +2519,15 @@ const docTemplate = `{
|
||||
"subagent"
|
||||
],
|
||||
"summary": "List subagents",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
@@ -2334,6 +2556,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Create subagent",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Subagent payload",
|
||||
"name": "payload",
|
||||
@@ -2374,6 +2603,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Get subagent",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Subagent ID",
|
||||
@@ -2416,6 +2652,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Update subagent",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Subagent ID",
|
||||
@@ -2467,6 +2710,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Delete subagent",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Subagent ID",
|
||||
@@ -2508,6 +2758,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Get subagent context",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Subagent ID",
|
||||
@@ -2550,6 +2807,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Update subagent context",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Subagent ID",
|
||||
@@ -2603,6 +2867,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Get subagent skills",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Subagent ID",
|
||||
@@ -2645,6 +2916,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Update subagent skills",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Subagent ID",
|
||||
@@ -2696,6 +2974,13 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Add subagent skills",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Subagent ID",
|
||||
@@ -4744,6 +5029,15 @@ const docTemplate = `{
|
||||
"definitions": {
|
||||
"bots.Bot": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"created_at",
|
||||
"display_name",
|
||||
"id",
|
||||
"is_active",
|
||||
"owner_user_id",
|
||||
"type",
|
||||
"updated_at"
|
||||
],
|
||||
"properties": {
|
||||
"avatar_url": {
|
||||
"type": "string"
|
||||
@@ -4815,6 +5109,9 @@ const docTemplate = `{
|
||||
},
|
||||
"bots.ListBotsResponse": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"items"
|
||||
],
|
||||
"properties": {
|
||||
"items": {
|
||||
"type": "array",
|
||||
@@ -5459,6 +5756,16 @@ const docTemplate = `{
|
||||
},
|
||||
"github_com_memohai_memoh_internal_mcp.Connection": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"active",
|
||||
"bot_id",
|
||||
"config",
|
||||
"created_at",
|
||||
"id",
|
||||
"name",
|
||||
"type",
|
||||
"updated_at"
|
||||
],
|
||||
"properties": {
|
||||
"active": {
|
||||
"type": "boolean"
|
||||
@@ -5489,6 +5796,12 @@ const docTemplate = `{
|
||||
},
|
||||
"handlers.ChannelMeta": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"capabilities",
|
||||
"config_schema",
|
||||
"display_name",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"capabilities": {
|
||||
"$ref": "#/definitions/channel.ChannelCapabilities"
|
||||
@@ -5839,6 +6152,10 @@ const docTemplate = `{
|
||||
},
|
||||
"handlers.LoginRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"password",
|
||||
"username"
|
||||
],
|
||||
"properties": {
|
||||
"password": {
|
||||
"type": "string"
|
||||
@@ -5850,6 +6167,15 @@ const docTemplate = `{
|
||||
},
|
||||
"handlers.LoginResponse": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"access_token",
|
||||
"display_name",
|
||||
"expires_at",
|
||||
"role",
|
||||
"token_type",
|
||||
"user_id",
|
||||
"username"
|
||||
],
|
||||
"properties": {
|
||||
"access_token": {
|
||||
"type": "string"
|
||||
@@ -6318,6 +6644,12 @@ const docTemplate = `{
|
||||
},
|
||||
"models.AddRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"llm_provider_id",
|
||||
"model_id",
|
||||
"name",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"dimensions": {
|
||||
"type": "integer"
|
||||
@@ -6366,6 +6698,12 @@ const docTemplate = `{
|
||||
},
|
||||
"models.GetResponse": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"llm_provider_id",
|
||||
"model_id",
|
||||
"name",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"dimensions": {
|
||||
"type": "integer"
|
||||
@@ -6406,6 +6744,12 @@ const docTemplate = `{
|
||||
},
|
||||
"models.UpdateRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"llm_provider_id",
|
||||
"model_id",
|
||||
"name",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"dimensions": {
|
||||
"type": "integer"
|
||||
@@ -6486,6 +6830,14 @@ const docTemplate = `{
|
||||
},
|
||||
"providers.GetResponse": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"base_url",
|
||||
"client_type",
|
||||
"created_at",
|
||||
"id",
|
||||
"name",
|
||||
"updated_at"
|
||||
],
|
||||
"properties": {
|
||||
"api_key": {
|
||||
"description": "masked in response",
|
||||
@@ -6644,6 +6996,14 @@ const docTemplate = `{
|
||||
},
|
||||
"settings.Settings": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"allow_guest",
|
||||
"chat_model_id",
|
||||
"embedding_model_id",
|
||||
"language",
|
||||
"max_context_load_time",
|
||||
"memory_model_id"
|
||||
],
|
||||
"properties": {
|
||||
"allow_guest": {
|
||||
"type": "boolean"
|
||||
|
||||
@@ -153,6 +153,13 @@
|
||||
],
|
||||
"summary": "Chat with AI",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Chat request",
|
||||
"name": "request",
|
||||
@@ -199,6 +206,13 @@
|
||||
],
|
||||
"summary": "Stream chat with AI",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Chat request",
|
||||
"name": "request",
|
||||
@@ -1127,6 +1141,13 @@
|
||||
],
|
||||
"summary": "List history records",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Limit",
|
||||
@@ -1162,6 +1183,13 @@
|
||||
],
|
||||
"summary": "Create history record",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "History payload",
|
||||
"name": "payload",
|
||||
@@ -1199,6 +1227,15 @@
|
||||
"history"
|
||||
],
|
||||
"summary": "Delete all history records",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": "No Content"
|
||||
@@ -1226,6 +1263,13 @@
|
||||
],
|
||||
"summary": "Get history record",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "History ID",
|
||||
@@ -1268,6 +1312,13 @@
|
||||
],
|
||||
"summary": "Delete history record",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "History ID",
|
||||
@@ -1308,6 +1359,15 @@
|
||||
"mcp"
|
||||
],
|
||||
"summary": "List MCP connections",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
@@ -1348,6 +1408,13 @@
|
||||
],
|
||||
"summary": "Create MCP connection",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "MCP payload",
|
||||
"name": "payload",
|
||||
@@ -1513,6 +1580,13 @@
|
||||
],
|
||||
"summary": "Get MCP connection",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "MCP ID",
|
||||
@@ -1561,6 +1635,13 @@
|
||||
],
|
||||
"summary": "Update MCP connection",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "MCP ID",
|
||||
@@ -1618,6 +1699,13 @@
|
||||
],
|
||||
"summary": "Delete MCP connection",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "MCP ID",
|
||||
@@ -1665,6 +1753,13 @@
|
||||
],
|
||||
"summary": "Add memory",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Add request",
|
||||
"name": "payload",
|
||||
@@ -1705,6 +1800,13 @@
|
||||
],
|
||||
"summary": "Embed and upsert memory",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Embed upsert request",
|
||||
"name": "payload",
|
||||
@@ -1745,6 +1847,13 @@
|
||||
],
|
||||
"summary": "List memories",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Run ID",
|
||||
@@ -1786,6 +1895,13 @@
|
||||
],
|
||||
"summary": "Delete memories",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Delete all request",
|
||||
"name": "payload",
|
||||
@@ -1826,6 +1942,13 @@
|
||||
],
|
||||
"summary": "Get memory",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Memory ID",
|
||||
@@ -1862,6 +1985,13 @@
|
||||
],
|
||||
"summary": "Delete memory",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Memory ID",
|
||||
@@ -1900,6 +2030,13 @@
|
||||
],
|
||||
"summary": "Search memories",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Search request",
|
||||
"name": "payload",
|
||||
@@ -1940,6 +2077,13 @@
|
||||
],
|
||||
"summary": "Update memory",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Update request",
|
||||
"name": "payload",
|
||||
@@ -1979,6 +2123,15 @@
|
||||
"schedule"
|
||||
],
|
||||
"summary": "List schedules",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
@@ -2007,6 +2160,13 @@
|
||||
],
|
||||
"summary": "Create schedule",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Schedule payload",
|
||||
"name": "payload",
|
||||
@@ -2047,6 +2207,13 @@
|
||||
],
|
||||
"summary": "Get schedule",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Schedule ID",
|
||||
@@ -2089,6 +2256,13 @@
|
||||
],
|
||||
"summary": "Update schedule",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Schedule ID",
|
||||
@@ -2134,6 +2308,13 @@
|
||||
],
|
||||
"summary": "Delete schedule",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Schedule ID",
|
||||
@@ -2168,6 +2349,15 @@
|
||||
"settings"
|
||||
],
|
||||
"summary": "Get user settings",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
@@ -2196,6 +2386,13 @@
|
||||
],
|
||||
"summary": "Update user settings",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Settings payload",
|
||||
"name": "payload",
|
||||
@@ -2234,6 +2431,13 @@
|
||||
],
|
||||
"summary": "Update user settings",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Settings payload",
|
||||
"name": "payload",
|
||||
@@ -2271,6 +2475,15 @@
|
||||
"settings"
|
||||
],
|
||||
"summary": "Delete user settings",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": "No Content"
|
||||
@@ -2297,6 +2510,15 @@
|
||||
"subagent"
|
||||
],
|
||||
"summary": "List subagents",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
@@ -2325,6 +2547,13 @@
|
||||
],
|
||||
"summary": "Create subagent",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Subagent payload",
|
||||
"name": "payload",
|
||||
@@ -2365,6 +2594,13 @@
|
||||
],
|
||||
"summary": "Get subagent",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Subagent ID",
|
||||
@@ -2407,6 +2643,13 @@
|
||||
],
|
||||
"summary": "Update subagent",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Subagent ID",
|
||||
@@ -2458,6 +2701,13 @@
|
||||
],
|
||||
"summary": "Delete subagent",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Subagent ID",
|
||||
@@ -2499,6 +2749,13 @@
|
||||
],
|
||||
"summary": "Get subagent context",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Subagent ID",
|
||||
@@ -2541,6 +2798,13 @@
|
||||
],
|
||||
"summary": "Update subagent context",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Subagent ID",
|
||||
@@ -2594,6 +2858,13 @@
|
||||
],
|
||||
"summary": "Get subagent skills",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Subagent ID",
|
||||
@@ -2636,6 +2907,13 @@
|
||||
],
|
||||
"summary": "Update subagent skills",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Subagent ID",
|
||||
@@ -2687,6 +2965,13 @@
|
||||
],
|
||||
"summary": "Add subagent skills",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Bot ID",
|
||||
"name": "bot_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Subagent ID",
|
||||
@@ -4735,6 +5020,15 @@
|
||||
"definitions": {
|
||||
"bots.Bot": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"created_at",
|
||||
"display_name",
|
||||
"id",
|
||||
"is_active",
|
||||
"owner_user_id",
|
||||
"type",
|
||||
"updated_at"
|
||||
],
|
||||
"properties": {
|
||||
"avatar_url": {
|
||||
"type": "string"
|
||||
@@ -4806,6 +5100,9 @@
|
||||
},
|
||||
"bots.ListBotsResponse": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"items"
|
||||
],
|
||||
"properties": {
|
||||
"items": {
|
||||
"type": "array",
|
||||
@@ -5450,6 +5747,16 @@
|
||||
},
|
||||
"github_com_memohai_memoh_internal_mcp.Connection": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"active",
|
||||
"bot_id",
|
||||
"config",
|
||||
"created_at",
|
||||
"id",
|
||||
"name",
|
||||
"type",
|
||||
"updated_at"
|
||||
],
|
||||
"properties": {
|
||||
"active": {
|
||||
"type": "boolean"
|
||||
@@ -5480,6 +5787,12 @@
|
||||
},
|
||||
"handlers.ChannelMeta": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"capabilities",
|
||||
"config_schema",
|
||||
"display_name",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"capabilities": {
|
||||
"$ref": "#/definitions/channel.ChannelCapabilities"
|
||||
@@ -5830,6 +6143,10 @@
|
||||
},
|
||||
"handlers.LoginRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"password",
|
||||
"username"
|
||||
],
|
||||
"properties": {
|
||||
"password": {
|
||||
"type": "string"
|
||||
@@ -5841,6 +6158,15 @@
|
||||
},
|
||||
"handlers.LoginResponse": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"access_token",
|
||||
"display_name",
|
||||
"expires_at",
|
||||
"role",
|
||||
"token_type",
|
||||
"user_id",
|
||||
"username"
|
||||
],
|
||||
"properties": {
|
||||
"access_token": {
|
||||
"type": "string"
|
||||
@@ -6309,6 +6635,12 @@
|
||||
},
|
||||
"models.AddRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"llm_provider_id",
|
||||
"model_id",
|
||||
"name",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"dimensions": {
|
||||
"type": "integer"
|
||||
@@ -6357,6 +6689,12 @@
|
||||
},
|
||||
"models.GetResponse": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"llm_provider_id",
|
||||
"model_id",
|
||||
"name",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"dimensions": {
|
||||
"type": "integer"
|
||||
@@ -6397,6 +6735,12 @@
|
||||
},
|
||||
"models.UpdateRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"llm_provider_id",
|
||||
"model_id",
|
||||
"name",
|
||||
"type"
|
||||
],
|
||||
"properties": {
|
||||
"dimensions": {
|
||||
"type": "integer"
|
||||
@@ -6477,6 +6821,14 @@
|
||||
},
|
||||
"providers.GetResponse": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"base_url",
|
||||
"client_type",
|
||||
"created_at",
|
||||
"id",
|
||||
"name",
|
||||
"updated_at"
|
||||
],
|
||||
"properties": {
|
||||
"api_key": {
|
||||
"description": "masked in response",
|
||||
@@ -6635,6 +6987,14 @@
|
||||
},
|
||||
"settings.Settings": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"allow_guest",
|
||||
"chat_model_id",
|
||||
"embedding_model_id",
|
||||
"language",
|
||||
"max_context_load_time",
|
||||
"memory_model_id"
|
||||
],
|
||||
"properties": {
|
||||
"allow_guest": {
|
||||
"type": "boolean"
|
||||
|
||||
@@ -20,6 +20,14 @@ definitions:
|
||||
type: string
|
||||
updated_at:
|
||||
type: string
|
||||
required:
|
||||
- created_at
|
||||
- display_name
|
||||
- id
|
||||
- is_active
|
||||
- owner_user_id
|
||||
- type
|
||||
- updated_at
|
||||
type: object
|
||||
bots.BotMember:
|
||||
properties:
|
||||
@@ -52,6 +60,8 @@ definitions:
|
||||
items:
|
||||
$ref: '#/definitions/bots.Bot'
|
||||
type: array
|
||||
required:
|
||||
- items
|
||||
type: object
|
||||
bots.ListMembersResponse:
|
||||
properties:
|
||||
@@ -502,6 +512,15 @@ definitions:
|
||||
type: string
|
||||
updated_at:
|
||||
type: string
|
||||
required:
|
||||
- active
|
||||
- bot_id
|
||||
- config
|
||||
- created_at
|
||||
- id
|
||||
- name
|
||||
- type
|
||||
- updated_at
|
||||
type: object
|
||||
handlers.ChannelMeta:
|
||||
properties:
|
||||
@@ -519,6 +538,11 @@ definitions:
|
||||
type: string
|
||||
user_config_schema:
|
||||
$ref: '#/definitions/channel.ConfigSchema'
|
||||
required:
|
||||
- capabilities
|
||||
- config_schema
|
||||
- display_name
|
||||
- type
|
||||
type: object
|
||||
handlers.CreateContainerRequest:
|
||||
properties:
|
||||
@@ -735,6 +759,9 @@ definitions:
|
||||
type: string
|
||||
username:
|
||||
type: string
|
||||
required:
|
||||
- password
|
||||
- username
|
||||
type: object
|
||||
handlers.LoginResponse:
|
||||
properties:
|
||||
@@ -752,6 +779,14 @@ definitions:
|
||||
type: string
|
||||
username:
|
||||
type: string
|
||||
required:
|
||||
- access_token
|
||||
- display_name
|
||||
- expires_at
|
||||
- role
|
||||
- token_type
|
||||
- user_id
|
||||
- username
|
||||
type: object
|
||||
handlers.MCPStdioRequest:
|
||||
properties:
|
||||
@@ -1062,6 +1097,11 @@ definitions:
|
||||
type: string
|
||||
type:
|
||||
$ref: '#/definitions/models.ModelType'
|
||||
required:
|
||||
- llm_provider_id
|
||||
- model_id
|
||||
- name
|
||||
- type
|
||||
type: object
|
||||
models.AddResponse:
|
||||
properties:
|
||||
@@ -1093,6 +1133,11 @@ definitions:
|
||||
type: string
|
||||
type:
|
||||
$ref: '#/definitions/models.ModelType'
|
||||
required:
|
||||
- llm_provider_id
|
||||
- model_id
|
||||
- name
|
||||
- type
|
||||
type: object
|
||||
models.ModelType:
|
||||
enum:
|
||||
@@ -1120,6 +1165,11 @@ definitions:
|
||||
type: string
|
||||
type:
|
||||
$ref: '#/definitions/models.ModelType'
|
||||
required:
|
||||
- llm_provider_id
|
||||
- model_id
|
||||
- name
|
||||
- type
|
||||
type: object
|
||||
providers.ClientType:
|
||||
enum:
|
||||
@@ -1178,6 +1228,13 @@ definitions:
|
||||
type: string
|
||||
updated_at:
|
||||
type: string
|
||||
required:
|
||||
- base_url
|
||||
- client_type
|
||||
- created_at
|
||||
- id
|
||||
- name
|
||||
- updated_at
|
||||
type: object
|
||||
providers.UpdateRequest:
|
||||
properties:
|
||||
@@ -1276,6 +1333,13 @@ definitions:
|
||||
type: integer
|
||||
memory_model_id:
|
||||
type: string
|
||||
required:
|
||||
- allow_guest
|
||||
- chat_model_id
|
||||
- embedding_model_id
|
||||
- language
|
||||
- max_context_load_time
|
||||
- memory_model_id
|
||||
type: object
|
||||
settings.UpsertRequest:
|
||||
properties:
|
||||
@@ -1572,6 +1636,11 @@ paths:
|
||||
description: Send a chat message and get a response. The system will automatically
|
||||
select an appropriate chat model from the database.
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Chat request
|
||||
in: body
|
||||
name: request
|
||||
@@ -1603,6 +1672,11 @@ paths:
|
||||
description: Send a chat message and get a streaming response. The system will
|
||||
automatically select an appropriate chat model from the database.
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Chat request
|
||||
in: body
|
||||
name: request
|
||||
@@ -2227,6 +2301,12 @@ paths:
|
||||
/bots/{bot_id}/history:
|
||||
delete:
|
||||
description: Delete all history records for current user
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"204":
|
||||
description: No Content
|
||||
@@ -2244,6 +2324,11 @@ paths:
|
||||
get:
|
||||
description: List history records for current user
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Limit
|
||||
in: query
|
||||
name: limit
|
||||
@@ -2267,6 +2352,11 @@ paths:
|
||||
post:
|
||||
description: Create a history record for current user
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: History payload
|
||||
in: body
|
||||
name: payload
|
||||
@@ -2293,6 +2383,11 @@ paths:
|
||||
delete:
|
||||
description: Delete a history record by ID (must belong to current user)
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: History ID
|
||||
in: path
|
||||
name: id
|
||||
@@ -2319,6 +2414,11 @@ paths:
|
||||
get:
|
||||
description: Get a history record by ID (must belong to current user)
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: History ID
|
||||
in: path
|
||||
name: id
|
||||
@@ -2347,6 +2447,12 @@ paths:
|
||||
/bots/{bot_id}/mcp:
|
||||
get:
|
||||
description: List MCP connections for a bot
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
@@ -2374,6 +2480,11 @@ paths:
|
||||
post:
|
||||
description: Create a MCP connection for a bot
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: MCP payload
|
||||
in: body
|
||||
name: payload
|
||||
@@ -2484,6 +2595,11 @@ paths:
|
||||
delete:
|
||||
description: Delete a MCP connection by ID
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: MCP ID
|
||||
in: path
|
||||
name: id
|
||||
@@ -2514,6 +2630,11 @@ paths:
|
||||
get:
|
||||
description: Get a MCP connection by ID
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: MCP ID
|
||||
in: path
|
||||
name: id
|
||||
@@ -2546,6 +2667,11 @@ paths:
|
||||
put:
|
||||
description: Update a MCP connection by ID
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: MCP ID
|
||||
in: path
|
||||
name: id
|
||||
@@ -2586,6 +2712,11 @@ paths:
|
||||
description: 'Add memory for a user via memory. Auth: Bearer JWT determines
|
||||
user_id (sub or user_id).'
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Add request
|
||||
in: body
|
||||
name: payload
|
||||
@@ -2613,6 +2744,11 @@ paths:
|
||||
description: 'Embed text or multimodal input and upsert into memory store. Auth:
|
||||
Bearer JWT determines user_id (sub or user_id).'
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Embed upsert request
|
||||
in: body
|
||||
name: payload
|
||||
@@ -2640,6 +2776,11 @@ paths:
|
||||
description: 'Delete all memories for a user via memory. Auth: Bearer JWT determines
|
||||
user_id (sub or user_id).'
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Delete all request
|
||||
in: body
|
||||
name: payload
|
||||
@@ -2666,6 +2807,11 @@ paths:
|
||||
description: 'List memories for a user via memory. Auth: Bearer JWT determines
|
||||
user_id (sub or user_id).'
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Run ID
|
||||
in: query
|
||||
name: run_id
|
||||
@@ -2695,6 +2841,11 @@ paths:
|
||||
description: 'Delete a memory by ID via memory. Auth: Bearer JWT determines
|
||||
user_id (sub or user_id).'
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Memory ID
|
||||
in: path
|
||||
name: memoryId
|
||||
@@ -2720,6 +2871,11 @@ paths:
|
||||
description: 'Get a memory by ID via memory. Auth: Bearer JWT determines user_id
|
||||
(sub or user_id).'
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Memory ID
|
||||
in: path
|
||||
name: memoryId
|
||||
@@ -2746,6 +2902,11 @@ paths:
|
||||
description: 'Search memories for a user via memory. Auth: Bearer JWT determines
|
||||
user_id (sub or user_id).'
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Search request
|
||||
in: body
|
||||
name: payload
|
||||
@@ -2773,6 +2934,11 @@ paths:
|
||||
description: 'Update a memory by ID via memory. Auth: Bearer JWT determines
|
||||
user_id (sub or user_id).'
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Update request
|
||||
in: body
|
||||
name: payload
|
||||
@@ -2798,6 +2964,12 @@ paths:
|
||||
/bots/{bot_id}/schedule:
|
||||
get:
|
||||
description: List schedules for current user
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
@@ -2817,6 +2989,11 @@ paths:
|
||||
post:
|
||||
description: Create a schedule for current user
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Schedule payload
|
||||
in: body
|
||||
name: payload
|
||||
@@ -2843,6 +3020,11 @@ paths:
|
||||
delete:
|
||||
description: Delete a schedule by ID
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Schedule ID
|
||||
in: path
|
||||
name: id
|
||||
@@ -2865,6 +3047,11 @@ paths:
|
||||
get:
|
||||
description: Get a schedule by ID
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Schedule ID
|
||||
in: path
|
||||
name: id
|
||||
@@ -2893,6 +3080,11 @@ paths:
|
||||
put:
|
||||
description: Update a schedule by ID
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Schedule ID
|
||||
in: path
|
||||
name: id
|
||||
@@ -2923,6 +3115,12 @@ paths:
|
||||
/bots/{bot_id}/settings:
|
||||
delete:
|
||||
description: Remove agent settings for current user
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"204":
|
||||
description: No Content
|
||||
@@ -2939,6 +3137,12 @@ paths:
|
||||
- settings
|
||||
get:
|
||||
description: Get agent settings for current user
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
@@ -2958,6 +3162,11 @@ paths:
|
||||
post:
|
||||
description: Update or create agent settings for current user
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Settings payload
|
||||
in: body
|
||||
name: payload
|
||||
@@ -2983,6 +3192,11 @@ paths:
|
||||
put:
|
||||
description: Update or create agent settings for current user
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Settings payload
|
||||
in: body
|
||||
name: payload
|
||||
@@ -3008,6 +3222,12 @@ paths:
|
||||
/bots/{bot_id}/subagents:
|
||||
get:
|
||||
description: List subagents for current user
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
@@ -3027,6 +3247,11 @@ paths:
|
||||
post:
|
||||
description: Create a subagent for current user
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Subagent payload
|
||||
in: body
|
||||
name: payload
|
||||
@@ -3053,6 +3278,11 @@ paths:
|
||||
delete:
|
||||
description: Delete a subagent by ID
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Subagent ID
|
||||
in: path
|
||||
name: id
|
||||
@@ -3079,6 +3309,11 @@ paths:
|
||||
get:
|
||||
description: Get a subagent by ID
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Subagent ID
|
||||
in: path
|
||||
name: id
|
||||
@@ -3107,6 +3342,11 @@ paths:
|
||||
put:
|
||||
description: Update a subagent by ID
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Subagent ID
|
||||
in: path
|
||||
name: id
|
||||
@@ -3142,6 +3382,11 @@ paths:
|
||||
get:
|
||||
description: Get a subagent's message context
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Subagent ID
|
||||
in: path
|
||||
name: id
|
||||
@@ -3170,6 +3415,11 @@ paths:
|
||||
put:
|
||||
description: Update a subagent's message context
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Subagent ID
|
||||
in: path
|
||||
name: id
|
||||
@@ -3205,6 +3455,11 @@ paths:
|
||||
get:
|
||||
description: Get a subagent's skills
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Subagent ID
|
||||
in: path
|
||||
name: id
|
||||
@@ -3233,6 +3488,11 @@ paths:
|
||||
post:
|
||||
description: Add skills to a subagent
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Subagent ID
|
||||
in: path
|
||||
name: id
|
||||
@@ -3267,6 +3527,11 @@ paths:
|
||||
put:
|
||||
description: Replace a subagent's skills
|
||||
parameters:
|
||||
- description: Bot ID
|
||||
in: path
|
||||
name: bot_id
|
||||
required: true
|
||||
type: string
|
||||
- description: Subagent ID
|
||||
in: path
|
||||
name: id
|
||||
|
||||
@@ -6,15 +6,15 @@ import (
|
||||
)
|
||||
|
||||
type Bot struct {
|
||||
ID string `json:"id"`
|
||||
OwnerUserID string `json:"owner_user_id"`
|
||||
Type string `json:"type"`
|
||||
DisplayName string `json:"display_name"`
|
||||
ID string `json:"id" validate:"required"`
|
||||
OwnerUserID string `json:"owner_user_id" validate:"required"`
|
||||
Type string `json:"type" validate:"required"`
|
||||
DisplayName string `json:"display_name" validate:"required"`
|
||||
AvatarURL string `json:"avatar_url,omitempty"`
|
||||
IsActive bool `json:"is_active"`
|
||||
IsActive bool `json:"is_active" validate:"required"`
|
||||
Metadata map[string]any `json:"metadata,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
CreatedAt time.Time `json:"created_at" validate:"required"`
|
||||
UpdatedAt time.Time `json:"updated_at" validate:"required"`
|
||||
}
|
||||
|
||||
type BotMember struct {
|
||||
@@ -49,7 +49,7 @@ type UpsertMemberRequest struct {
|
||||
}
|
||||
|
||||
type ListBotsResponse struct {
|
||||
Items []Bot `json:"items"`
|
||||
Items []Bot `json:"items" validate:"required"`
|
||||
}
|
||||
|
||||
type ListMembersResponse struct {
|
||||
|
||||
@@ -21,18 +21,18 @@ type AuthHandler struct {
|
||||
}
|
||||
|
||||
type LoginRequest struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
Username string `json:"username" validate:"required"`
|
||||
Password string `json:"password" validate:"required"`
|
||||
}
|
||||
|
||||
type LoginResponse struct {
|
||||
AccessToken string `json:"access_token"`
|
||||
TokenType string `json:"token_type"`
|
||||
ExpiresAt string `json:"expires_at"`
|
||||
UserID string `json:"user_id"`
|
||||
Role string `json:"role"`
|
||||
DisplayName string `json:"display_name"`
|
||||
Username string `json:"username"`
|
||||
AccessToken string `json:"access_token" validate:"required"`
|
||||
TokenType string `json:"token_type" validate:"required"`
|
||||
ExpiresAt string `json:"expires_at" validate:"required"`
|
||||
UserID string `json:"user_id" validate:"required"`
|
||||
Role string `json:"role" validate:"required"`
|
||||
DisplayName string `json:"display_name" validate:"required"`
|
||||
Username string `json:"username" validate:"required"`
|
||||
}
|
||||
|
||||
func NewAuthHandler(log *slog.Logger, userService *users.Service, jwtSecret string, expiresIn time.Duration) *AuthHandler {
|
||||
|
||||
@@ -94,11 +94,11 @@ func (h *ChannelHandler) UpsertUserConfig(c echo.Context) error {
|
||||
}
|
||||
|
||||
type ChannelMeta struct {
|
||||
Type string `json:"type"`
|
||||
DisplayName string `json:"display_name"`
|
||||
Type string `json:"type" validate:"required"`
|
||||
DisplayName string `json:"display_name" validate:"required"`
|
||||
Configless bool `json:"configless"`
|
||||
Capabilities channel.ChannelCapabilities `json:"capabilities"`
|
||||
ConfigSchema channel.ConfigSchema `json:"config_schema"`
|
||||
Capabilities channel.ChannelCapabilities `json:"capabilities" validate:"required"`
|
||||
ConfigSchema channel.ConfigSchema `json:"config_schema" validate:"required"`
|
||||
UserConfigSchema channel.ConfigSchema `json:"user_config_schema"`
|
||||
TargetSpec channel.TargetSpec `json:"target_spec"`
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ func (h *ChatHandler) Register(e *echo.Echo) {
|
||||
// @Tags chat
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param request body chat.ChatRequest true "Chat request"
|
||||
// @Success 200 {object} chat.ChatResponse
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
@@ -102,6 +103,7 @@ func (h *ChatHandler) Chat(c echo.Context) error {
|
||||
// @Tags chat
|
||||
// @Accept json
|
||||
// @Produce text/event-stream
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param request body chat.ChatRequest true "Chat request"
|
||||
// @Success 200 {string} string
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
|
||||
@@ -46,6 +46,7 @@ func (h *HistoryHandler) Register(e *echo.Echo) {
|
||||
// @Summary Create history record
|
||||
// @Description Create a history record for current user
|
||||
// @Tags history
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param payload body history.CreateRequest true "History payload"
|
||||
// @Success 201 {object} history.Record
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
@@ -82,6 +83,7 @@ func (h *HistoryHandler) Create(c echo.Context) error {
|
||||
// @Summary Get history record
|
||||
// @Description Get a history record by ID (must belong to current user)
|
||||
// @Tags history
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param id path string true "History ID"
|
||||
// @Success 200 {object} history.Record
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
@@ -118,6 +120,7 @@ func (h *HistoryHandler) Get(c echo.Context) error {
|
||||
// @Summary List history records
|
||||
// @Description List history records for current user
|
||||
// @Tags history
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param limit query int false "Limit"
|
||||
// @Success 200 {object} history.ListResponse
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
@@ -156,6 +159,7 @@ func (h *HistoryHandler) List(c echo.Context) error {
|
||||
// @Summary Delete history record
|
||||
// @Description Delete a history record by ID (must belong to current user)
|
||||
// @Tags history
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param id path string true "History ID"
|
||||
// @Success 204 "No Content"
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
@@ -195,6 +199,7 @@ func (h *HistoryHandler) Delete(c echo.Context) error {
|
||||
// @Summary Delete all history records
|
||||
// @Description Delete all history records for current user
|
||||
// @Tags history
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Success 204 "No Content"
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
// @Failure 500 {object} ErrorResponse
|
||||
|
||||
@@ -46,6 +46,7 @@ func (h *MCPHandler) Register(e *echo.Echo) {
|
||||
// @Summary List MCP connections
|
||||
// @Description List MCP connections for a bot
|
||||
// @Tags mcp
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Success 200 {object} mcp.ListResponse
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
// @Failure 403 {object} ErrorResponse
|
||||
@@ -75,6 +76,7 @@ func (h *MCPHandler) List(c echo.Context) error {
|
||||
// @Summary Create MCP connection
|
||||
// @Description Create a MCP connection for a bot
|
||||
// @Tags mcp
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param payload body mcp.UpsertRequest true "MCP payload"
|
||||
// @Success 201 {object} mcp.Connection
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
@@ -109,6 +111,7 @@ func (h *MCPHandler) Create(c echo.Context) error {
|
||||
// @Summary Get MCP connection
|
||||
// @Description Get a MCP connection by ID
|
||||
// @Tags mcp
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param id path string true "MCP ID"
|
||||
// @Success 200 {object} mcp.Connection
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
@@ -146,6 +149,7 @@ func (h *MCPHandler) Get(c echo.Context) error {
|
||||
// @Summary Update MCP connection
|
||||
// @Description Update a MCP connection by ID
|
||||
// @Tags mcp
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param id path string true "MCP ID"
|
||||
// @Param payload body mcp.UpsertRequest true "MCP payload"
|
||||
// @Success 200 {object} mcp.Connection
|
||||
@@ -188,6 +192,7 @@ func (h *MCPHandler) Update(c echo.Context) error {
|
||||
// @Summary Delete MCP connection
|
||||
// @Description Delete a MCP connection by ID
|
||||
// @Tags mcp
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param id path string true "MCP ID"
|
||||
// @Success 204 "No Content"
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
|
||||
@@ -90,6 +90,7 @@ func (h *MemoryHandler) checkService() error {
|
||||
// @Summary Embed and upsert memory
|
||||
// @Description Embed text or multimodal input and upsert into memory store. Auth: Bearer JWT determines user_id (sub or user_id).
|
||||
// @Tags memory
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param payload body memoryEmbedUpsertPayload true "Embed upsert request"
|
||||
// @Success 200 {object} memory.EmbedUpsertResponse
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
@@ -144,6 +145,7 @@ func (h *MemoryHandler) EmbedUpsert(c echo.Context) error {
|
||||
// @Summary Add memory
|
||||
// @Description Add memory for a user via memory. Auth: Bearer JWT determines user_id (sub or user_id).
|
||||
// @Tags memory
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param payload body memoryAddPayload true "Add request"
|
||||
// @Success 200 {object} memory.SearchResponse
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
@@ -197,6 +199,7 @@ func (h *MemoryHandler) Add(c echo.Context) error {
|
||||
// @Summary Search memories
|
||||
// @Description Search memories for a user via memory. Auth: Bearer JWT determines user_id (sub or user_id).
|
||||
// @Tags memory
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param payload body memorySearchPayload true "Search request"
|
||||
// @Success 200 {object} memory.SearchResponse
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
@@ -249,6 +252,7 @@ func (h *MemoryHandler) Search(c echo.Context) error {
|
||||
// @Summary Update memory
|
||||
// @Description Update a memory by ID via memory. Auth: Bearer JWT determines user_id (sub or user_id).
|
||||
// @Tags memory
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param payload body memory.UpdateRequest true "Update request"
|
||||
// @Success 200 {object} memory.MemoryItem
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
@@ -296,6 +300,7 @@ func (h *MemoryHandler) Update(c echo.Context) error {
|
||||
// @Summary Get memory
|
||||
// @Description Get a memory by ID via memory. Auth: Bearer JWT determines user_id (sub or user_id).
|
||||
// @Tags memory
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param memoryId path string true "Memory ID"
|
||||
// @Success 200 {object} memory.MemoryItem
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
@@ -337,6 +342,7 @@ func (h *MemoryHandler) Get(c echo.Context) error {
|
||||
// @Summary List memories
|
||||
// @Description List memories for a user via memory. Auth: Bearer JWT determines user_id (sub or user_id).
|
||||
// @Tags memory
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param run_id query string false "Run ID"
|
||||
// @Param limit query int false "Limit"
|
||||
// @Success 200 {object} memory.SearchResponse
|
||||
@@ -388,6 +394,7 @@ func (h *MemoryHandler) GetAll(c echo.Context) error {
|
||||
// @Summary Delete memory
|
||||
// @Description Delete a memory by ID via memory. Auth: Bearer JWT determines user_id (sub or user_id).
|
||||
// @Tags memory
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param memoryId path string true "Memory ID"
|
||||
// @Success 200 {object} memory.DeleteResponse
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
@@ -434,6 +441,7 @@ func (h *MemoryHandler) Delete(c echo.Context) error {
|
||||
// @Summary Delete memories
|
||||
// @Description Delete all memories for a user via memory. Auth: Bearer JWT determines user_id (sub or user_id).
|
||||
// @Tags memory
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param payload body memoryDeleteAllPayload true "Delete all request"
|
||||
// @Success 200 {object} memory.DeleteResponse
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
|
||||
@@ -45,6 +45,7 @@ func (h *ScheduleHandler) Register(e *echo.Echo) {
|
||||
// @Summary Create schedule
|
||||
// @Description Create a schedule for current user
|
||||
// @Tags schedule
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param payload body schedule.CreateRequest true "Schedule payload"
|
||||
// @Success 201 {object} schedule.Schedule
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
@@ -77,6 +78,7 @@ func (h *ScheduleHandler) Create(c echo.Context) error {
|
||||
// @Summary List schedules
|
||||
// @Description List schedules for current user
|
||||
// @Tags schedule
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Success 200 {object} schedule.ListResponse
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
// @Failure 500 {object} ErrorResponse
|
||||
@@ -104,6 +106,7 @@ func (h *ScheduleHandler) List(c echo.Context) error {
|
||||
// @Summary Get schedule
|
||||
// @Description Get a schedule by ID
|
||||
// @Tags schedule
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param id path string true "Schedule ID"
|
||||
// @Success 200 {object} schedule.Schedule
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
@@ -140,6 +143,7 @@ func (h *ScheduleHandler) Get(c echo.Context) error {
|
||||
// @Summary Update schedule
|
||||
// @Description Update a schedule by ID
|
||||
// @Tags schedule
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param id path string true "Schedule ID"
|
||||
// @Param payload body schedule.UpdateRequest true "Schedule payload"
|
||||
// @Success 200 {object} schedule.Schedule
|
||||
@@ -184,6 +188,7 @@ func (h *ScheduleHandler) Update(c echo.Context) error {
|
||||
// @Summary Delete schedule
|
||||
// @Description Delete a schedule by ID
|
||||
// @Tags schedule
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param id path string true "Schedule ID"
|
||||
// @Success 204 "No Content"
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
|
||||
@@ -44,6 +44,7 @@ func (h *SettingsHandler) Register(e *echo.Echo) {
|
||||
// @Summary Get user settings
|
||||
// @Description Get agent settings for current user
|
||||
// @Tags settings
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Success 200 {object} settings.Settings
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
// @Failure 500 {object} ErrorResponse
|
||||
@@ -71,6 +72,7 @@ func (h *SettingsHandler) Get(c echo.Context) error {
|
||||
// @Summary Update user settings
|
||||
// @Description Update or create agent settings for current user
|
||||
// @Tags settings
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param payload body settings.UpsertRequest true "Settings payload"
|
||||
// @Success 200 {object} settings.Settings
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
@@ -104,6 +106,7 @@ func (h *SettingsHandler) Upsert(c echo.Context) error {
|
||||
// @Summary Delete user settings
|
||||
// @Description Remove agent settings for current user
|
||||
// @Tags settings
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Success 204 "No Content"
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
// @Failure 500 {object} ErrorResponse
|
||||
|
||||
@@ -50,6 +50,7 @@ func (h *SubagentHandler) Register(e *echo.Echo) {
|
||||
// @Summary Create subagent
|
||||
// @Description Create a subagent for current user
|
||||
// @Tags subagent
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param payload body subagent.CreateRequest true "Subagent payload"
|
||||
// @Success 201 {object} subagent.Subagent
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
@@ -82,6 +83,7 @@ func (h *SubagentHandler) Create(c echo.Context) error {
|
||||
// @Summary List subagents
|
||||
// @Description List subagents for current user
|
||||
// @Tags subagent
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Success 200 {object} subagent.ListResponse
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
// @Failure 500 {object} ErrorResponse
|
||||
@@ -109,6 +111,7 @@ func (h *SubagentHandler) List(c echo.Context) error {
|
||||
// @Summary Get subagent
|
||||
// @Description Get a subagent by ID
|
||||
// @Tags subagent
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param id path string true "Subagent ID"
|
||||
// @Success 200 {object} subagent.Subagent
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
@@ -145,6 +148,7 @@ func (h *SubagentHandler) Get(c echo.Context) error {
|
||||
// @Summary Update subagent
|
||||
// @Description Update a subagent by ID
|
||||
// @Tags subagent
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param id path string true "Subagent ID"
|
||||
// @Param payload body subagent.UpdateRequest true "Subagent payload"
|
||||
// @Success 200 {object} subagent.Subagent
|
||||
@@ -190,6 +194,7 @@ func (h *SubagentHandler) Update(c echo.Context) error {
|
||||
// @Summary Delete subagent
|
||||
// @Description Delete a subagent by ID
|
||||
// @Tags subagent
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param id path string true "Subagent ID"
|
||||
// @Success 204 "No Content"
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
@@ -229,6 +234,7 @@ func (h *SubagentHandler) Delete(c echo.Context) error {
|
||||
// @Summary Get subagent context
|
||||
// @Description Get a subagent's message context
|
||||
// @Tags subagent
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param id path string true "Subagent ID"
|
||||
// @Success 200 {object} subagent.ContextResponse
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
@@ -265,6 +271,7 @@ func (h *SubagentHandler) GetContext(c echo.Context) error {
|
||||
// @Summary Update subagent context
|
||||
// @Description Update a subagent's message context
|
||||
// @Tags subagent
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param id path string true "Subagent ID"
|
||||
// @Param payload body subagent.UpdateContextRequest true "Context payload"
|
||||
// @Success 200 {object} subagent.ContextResponse
|
||||
@@ -310,6 +317,7 @@ func (h *SubagentHandler) UpdateContext(c echo.Context) error {
|
||||
// @Summary Get subagent skills
|
||||
// @Description Get a subagent's skills
|
||||
// @Tags subagent
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param id path string true "Subagent ID"
|
||||
// @Success 200 {object} subagent.SkillsResponse
|
||||
// @Failure 400 {object} ErrorResponse
|
||||
@@ -346,6 +354,7 @@ func (h *SubagentHandler) GetSkills(c echo.Context) error {
|
||||
// @Summary Update subagent skills
|
||||
// @Description Replace a subagent's skills
|
||||
// @Tags subagent
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param id path string true "Subagent ID"
|
||||
// @Param payload body subagent.UpdateSkillsRequest true "Skills payload"
|
||||
// @Success 200 {object} subagent.SkillsResponse
|
||||
@@ -391,6 +400,7 @@ func (h *SubagentHandler) UpdateSkills(c echo.Context) error {
|
||||
// @Summary Add subagent skills
|
||||
// @Description Add skills to a subagent
|
||||
// @Tags subagent
|
||||
// @Param bot_id path string true "Bot ID"
|
||||
// @Param id path string true "Subagent ID"
|
||||
// @Param payload body subagent.AddSkillsRequest true "Skills payload"
|
||||
// @Success 200 {object} subagent.SkillsResponse
|
||||
|
||||
@@ -14,14 +14,14 @@ import (
|
||||
|
||||
// Connection represents a stored MCP connection for a bot.
|
||||
type Connection struct {
|
||||
ID string `json:"id"`
|
||||
BotID string `json:"bot_id"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
Config map[string]any `json:"config"`
|
||||
Active bool `json:"active"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
ID string `json:"id" validate:"required"`
|
||||
BotID string `json:"bot_id" validate:"required"`
|
||||
Name string `json:"name" validate:"required"`
|
||||
Type string `json:"type" validate:"required"`
|
||||
Config map[string]any `json:"config" validate:"required"`
|
||||
Active bool `json:"active" validate:"required"`
|
||||
CreatedAt time.Time `json:"created_at" validate:"required"`
|
||||
UpdatedAt time.Time `json:"updated_at" validate:"required"`
|
||||
}
|
||||
|
||||
// UpsertRequest is the payload for creating or updating MCP connections.
|
||||
|
||||
@@ -32,13 +32,13 @@ const (
|
||||
)
|
||||
|
||||
type Model struct {
|
||||
ModelID string `json:"model_id"`
|
||||
Name string `json:"name"`
|
||||
LlmProviderID string `json:"llm_provider_id"`
|
||||
IsMultimodal bool `json:"is_multimodal"`
|
||||
Input []string `json:"input"`
|
||||
Type ModelType `json:"type"`
|
||||
Dimensions int `json:"dimensions"`
|
||||
ModelID string `json:"model_id" validate:"required"`
|
||||
Name string `json:"name" validate:"required"`
|
||||
LlmProviderID string `json:"llm_provider_id" validate:"required"`
|
||||
IsMultimodal bool `json:"is_multimodal"`
|
||||
Input []string `json:"input"`
|
||||
Type ModelType `json:"type" validate:"required"`
|
||||
Dimensions int `json:"dimensions"`
|
||||
}
|
||||
|
||||
func (m *Model) Validate() error {
|
||||
|
||||
@@ -33,14 +33,14 @@ type UpdateRequest struct {
|
||||
|
||||
// GetResponse represents the response for getting a provider
|
||||
type GetResponse struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
ClientType string `json:"client_type"`
|
||||
BaseURL string `json:"base_url"`
|
||||
ID string `json:"id" validate:"required"`
|
||||
Name string `json:"name" validate:"required"`
|
||||
ClientType string `json:"client_type" validate:"required"`
|
||||
BaseURL string `json:"base_url" validate:"required"`
|
||||
APIKey string `json:"api_key,omitempty"` // masked in response
|
||||
Metadata map[string]any `json:"metadata,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
CreatedAt time.Time `json:"created_at" validate:"required"`
|
||||
UpdatedAt time.Time `json:"updated_at" validate:"required"`
|
||||
}
|
||||
|
||||
// ListResponse represents the response for listing providers
|
||||
|
||||
@@ -6,12 +6,12 @@ const (
|
||||
)
|
||||
|
||||
type Settings struct {
|
||||
ChatModelID string `json:"chat_model_id"`
|
||||
MemoryModelID string `json:"memory_model_id"`
|
||||
EmbeddingModelID string `json:"embedding_model_id"`
|
||||
MaxContextLoadTime int `json:"max_context_load_time"`
|
||||
Language string `json:"language"`
|
||||
AllowGuest bool `json:"allow_guest"`
|
||||
ChatModelID string `json:"chat_model_id" validate:"required"`
|
||||
MemoryModelID string `json:"memory_model_id" validate:"required"`
|
||||
EmbeddingModelID string `json:"embedding_model_id" validate:"required"`
|
||||
MaxContextLoadTime int `json:"max_context_load_time" validate:"required"`
|
||||
Language string `json:"language" validate:"required"`
|
||||
AllowGuest bool `json:"allow_guest" validate:"required"`
|
||||
}
|
||||
|
||||
type UpsertRequest struct {
|
||||
|
||||
@@ -3,11 +3,21 @@
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"exports": {
|
||||
".": "./src/index.ts"
|
||||
".": "./src/index.ts",
|
||||
"./client": "./src/client.gen.ts",
|
||||
"./colada": "./src/@pinia/colada.gen.ts"
|
||||
},
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
},
|
||||
"packageManager": "pnpm@10.27.0"
|
||||
"packageManager": "pnpm@10.27.0",
|
||||
"peerDependencies": {
|
||||
"@pinia/colada": ">=0.21.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@pinia/colada": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,14 +444,14 @@ export const deleteBotsByBotIdHistoryMutation = (options?: Partial<Options<Delet
|
||||
}
|
||||
});
|
||||
|
||||
export const getBotsByBotIdHistoryQueryKey = (options?: Options<GetBotsByBotIdHistoryData>) => createQueryKey('getBotsByBotIdHistory', options);
|
||||
export const getBotsByBotIdHistoryQueryKey = (options: Options<GetBotsByBotIdHistoryData>) => createQueryKey('getBotsByBotIdHistory', options);
|
||||
|
||||
/**
|
||||
* List history records
|
||||
*
|
||||
* List history records for current user
|
||||
*/
|
||||
export const getBotsByBotIdHistoryQuery = defineQueryOptions((options?: Options<GetBotsByBotIdHistoryData>) => ({
|
||||
export const getBotsByBotIdHistoryQuery = defineQueryOptions((options: Options<GetBotsByBotIdHistoryData>) => ({
|
||||
key: getBotsByBotIdHistoryQueryKey(options),
|
||||
query: async (context) => {
|
||||
const { data } = await getBotsByBotIdHistory({
|
||||
@@ -514,14 +514,14 @@ export const getBotsByBotIdHistoryByIdQuery = defineQueryOptions((options: Optio
|
||||
}
|
||||
}));
|
||||
|
||||
export const getBotsByBotIdMcpQueryKey = (options?: Options<GetBotsByBotIdMcpData>) => createQueryKey('getBotsByBotIdMcp', options);
|
||||
export const getBotsByBotIdMcpQueryKey = (options: Options<GetBotsByBotIdMcpData>) => createQueryKey('getBotsByBotIdMcp', options);
|
||||
|
||||
/**
|
||||
* List MCP connections
|
||||
*
|
||||
* List MCP connections for a bot
|
||||
*/
|
||||
export const getBotsByBotIdMcpQuery = defineQueryOptions((options?: Options<GetBotsByBotIdMcpData>) => ({
|
||||
export const getBotsByBotIdMcpQuery = defineQueryOptions((options: Options<GetBotsByBotIdMcpData>) => ({
|
||||
key: getBotsByBotIdMcpQueryKey(options),
|
||||
query: async (context) => {
|
||||
const { data } = await getBotsByBotIdMcp({
|
||||
@@ -680,14 +680,14 @@ export const deleteBotsByBotIdMemoryMemoriesMutation = (options?: Partial<Option
|
||||
}
|
||||
});
|
||||
|
||||
export const getBotsByBotIdMemoryMemoriesQueryKey = (options?: Options<GetBotsByBotIdMemoryMemoriesData>) => createQueryKey('getBotsByBotIdMemoryMemories', options);
|
||||
export const getBotsByBotIdMemoryMemoriesQueryKey = (options: Options<GetBotsByBotIdMemoryMemoriesData>) => createQueryKey('getBotsByBotIdMemoryMemories', options);
|
||||
|
||||
/**
|
||||
* List memories
|
||||
*
|
||||
* List memories for a user via memory. Auth: Bearer JWT determines user_id (sub or user_id).
|
||||
*/
|
||||
export const getBotsByBotIdMemoryMemoriesQuery = defineQueryOptions((options?: Options<GetBotsByBotIdMemoryMemoriesData>) => ({
|
||||
export const getBotsByBotIdMemoryMemoriesQuery = defineQueryOptions((options: Options<GetBotsByBotIdMemoryMemoriesData>) => ({
|
||||
key: getBotsByBotIdMemoryMemoriesQueryKey(options),
|
||||
query: async (context) => {
|
||||
const { data } = await getBotsByBotIdMemoryMemories({
|
||||
@@ -766,14 +766,14 @@ export const postBotsByBotIdMemoryUpdateMutation = (options?: Partial<Options<Po
|
||||
}
|
||||
});
|
||||
|
||||
export const getBotsByBotIdScheduleQueryKey = (options?: Options<GetBotsByBotIdScheduleData>) => createQueryKey('getBotsByBotIdSchedule', options);
|
||||
export const getBotsByBotIdScheduleQueryKey = (options: Options<GetBotsByBotIdScheduleData>) => createQueryKey('getBotsByBotIdSchedule', options);
|
||||
|
||||
/**
|
||||
* List schedules
|
||||
*
|
||||
* List schedules for current user
|
||||
*/
|
||||
export const getBotsByBotIdScheduleQuery = defineQueryOptions((options?: Options<GetBotsByBotIdScheduleData>) => ({
|
||||
export const getBotsByBotIdScheduleQuery = defineQueryOptions((options: Options<GetBotsByBotIdScheduleData>) => ({
|
||||
key: getBotsByBotIdScheduleQueryKey(options),
|
||||
query: async (context) => {
|
||||
const { data } = await getBotsByBotIdSchedule({
|
||||
@@ -868,14 +868,14 @@ export const deleteBotsByBotIdSettingsMutation = (options?: Partial<Options<Dele
|
||||
}
|
||||
});
|
||||
|
||||
export const getBotsByBotIdSettingsQueryKey = (options?: Options<GetBotsByBotIdSettingsData>) => createQueryKey('getBotsByBotIdSettings', options);
|
||||
export const getBotsByBotIdSettingsQueryKey = (options: Options<GetBotsByBotIdSettingsData>) => createQueryKey('getBotsByBotIdSettings', options);
|
||||
|
||||
/**
|
||||
* Get user settings
|
||||
*
|
||||
* Get agent settings for current user
|
||||
*/
|
||||
export const getBotsByBotIdSettingsQuery = defineQueryOptions((options?: Options<GetBotsByBotIdSettingsData>) => ({
|
||||
export const getBotsByBotIdSettingsQuery = defineQueryOptions((options: Options<GetBotsByBotIdSettingsData>) => ({
|
||||
key: getBotsByBotIdSettingsQueryKey(options),
|
||||
query: async (context) => {
|
||||
const { data } = await getBotsByBotIdSettings({
|
||||
@@ -919,14 +919,14 @@ export const putBotsByBotIdSettingsMutation = (options?: Partial<Options<PutBots
|
||||
}
|
||||
});
|
||||
|
||||
export const getBotsByBotIdSubagentsQueryKey = (options?: Options<GetBotsByBotIdSubagentsData>) => createQueryKey('getBotsByBotIdSubagents', options);
|
||||
export const getBotsByBotIdSubagentsQueryKey = (options: Options<GetBotsByBotIdSubagentsData>) => createQueryKey('getBotsByBotIdSubagents', options);
|
||||
|
||||
/**
|
||||
* List subagents
|
||||
*
|
||||
* List subagents for current user
|
||||
*/
|
||||
export const getBotsByBotIdSubagentsQuery = defineQueryOptions((options?: Options<GetBotsByBotIdSubagentsData>) => ({
|
||||
export const getBotsByBotIdSubagentsQuery = defineQueryOptions((options: Options<GetBotsByBotIdSubagentsData>) => ({
|
||||
key: getBotsByBotIdSubagentsQueryKey(options),
|
||||
query: async (context) => {
|
||||
const { data } = await getBotsByBotIdSubagents({
|
||||
|
||||
@@ -246,14 +246,14 @@ export const postBotsByBotIdContainerStop = <ThrowOnError extends boolean = fals
|
||||
*
|
||||
* Delete all history records for current user
|
||||
*/
|
||||
export const deleteBotsByBotIdHistory = <ThrowOnError extends boolean = false>(options?: Options<DeleteBotsByBotIdHistoryData, ThrowOnError>) => (options?.client ?? client).delete<DeleteBotsByBotIdHistoryResponses, DeleteBotsByBotIdHistoryErrors, ThrowOnError>({ url: '/bots/{bot_id}/history', ...options });
|
||||
export const deleteBotsByBotIdHistory = <ThrowOnError extends boolean = false>(options: Options<DeleteBotsByBotIdHistoryData, ThrowOnError>) => (options.client ?? client).delete<DeleteBotsByBotIdHistoryResponses, DeleteBotsByBotIdHistoryErrors, ThrowOnError>({ url: '/bots/{bot_id}/history', ...options });
|
||||
|
||||
/**
|
||||
* List history records
|
||||
*
|
||||
* List history records for current user
|
||||
*/
|
||||
export const getBotsByBotIdHistory = <ThrowOnError extends boolean = false>(options?: Options<GetBotsByBotIdHistoryData, ThrowOnError>) => (options?.client ?? client).get<GetBotsByBotIdHistoryResponses, GetBotsByBotIdHistoryErrors, ThrowOnError>({ url: '/bots/{bot_id}/history', ...options });
|
||||
export const getBotsByBotIdHistory = <ThrowOnError extends boolean = false>(options: Options<GetBotsByBotIdHistoryData, ThrowOnError>) => (options.client ?? client).get<GetBotsByBotIdHistoryResponses, GetBotsByBotIdHistoryErrors, ThrowOnError>({ url: '/bots/{bot_id}/history', ...options });
|
||||
|
||||
/**
|
||||
* Create history record
|
||||
@@ -288,7 +288,7 @@ export const getBotsByBotIdHistoryById = <ThrowOnError extends boolean = false>(
|
||||
*
|
||||
* List MCP connections for a bot
|
||||
*/
|
||||
export const getBotsByBotIdMcp = <ThrowOnError extends boolean = false>(options?: Options<GetBotsByBotIdMcpData, ThrowOnError>) => (options?.client ?? client).get<GetBotsByBotIdMcpResponses, GetBotsByBotIdMcpErrors, ThrowOnError>({ url: '/bots/{bot_id}/mcp', ...options });
|
||||
export const getBotsByBotIdMcp = <ThrowOnError extends boolean = false>(options: Options<GetBotsByBotIdMcpData, ThrowOnError>) => (options.client ?? client).get<GetBotsByBotIdMcpResponses, GetBotsByBotIdMcpErrors, ThrowOnError>({ url: '/bots/{bot_id}/mcp', ...options });
|
||||
|
||||
/**
|
||||
* Create MCP connection
|
||||
@@ -407,7 +407,7 @@ export const deleteBotsByBotIdMemoryMemories = <ThrowOnError extends boolean = f
|
||||
*
|
||||
* List memories for a user via memory. Auth: Bearer JWT determines user_id (sub or user_id).
|
||||
*/
|
||||
export const getBotsByBotIdMemoryMemories = <ThrowOnError extends boolean = false>(options?: Options<GetBotsByBotIdMemoryMemoriesData, ThrowOnError>) => (options?.client ?? client).get<GetBotsByBotIdMemoryMemoriesResponses, GetBotsByBotIdMemoryMemoriesErrors, ThrowOnError>({ url: '/bots/{bot_id}/memory/memories', ...options });
|
||||
export const getBotsByBotIdMemoryMemories = <ThrowOnError extends boolean = false>(options: Options<GetBotsByBotIdMemoryMemoriesData, ThrowOnError>) => (options.client ?? client).get<GetBotsByBotIdMemoryMemoriesResponses, GetBotsByBotIdMemoryMemoriesErrors, ThrowOnError>({ url: '/bots/{bot_id}/memory/memories', ...options });
|
||||
|
||||
/**
|
||||
* Delete memory
|
||||
@@ -456,7 +456,7 @@ export const postBotsByBotIdMemoryUpdate = <ThrowOnError extends boolean = false
|
||||
*
|
||||
* List schedules for current user
|
||||
*/
|
||||
export const getBotsByBotIdSchedule = <ThrowOnError extends boolean = false>(options?: Options<GetBotsByBotIdScheduleData, ThrowOnError>) => (options?.client ?? client).get<GetBotsByBotIdScheduleResponses, GetBotsByBotIdScheduleErrors, ThrowOnError>({ url: '/bots/{bot_id}/schedule', ...options });
|
||||
export const getBotsByBotIdSchedule = <ThrowOnError extends boolean = false>(options: Options<GetBotsByBotIdScheduleData, ThrowOnError>) => (options.client ?? client).get<GetBotsByBotIdScheduleResponses, GetBotsByBotIdScheduleErrors, ThrowOnError>({ url: '/bots/{bot_id}/schedule', ...options });
|
||||
|
||||
/**
|
||||
* Create schedule
|
||||
@@ -505,14 +505,14 @@ export const putBotsByBotIdScheduleById = <ThrowOnError extends boolean = false>
|
||||
*
|
||||
* Remove agent settings for current user
|
||||
*/
|
||||
export const deleteBotsByBotIdSettings = <ThrowOnError extends boolean = false>(options?: Options<DeleteBotsByBotIdSettingsData, ThrowOnError>) => (options?.client ?? client).delete<DeleteBotsByBotIdSettingsResponses, DeleteBotsByBotIdSettingsErrors, ThrowOnError>({ url: '/bots/{bot_id}/settings', ...options });
|
||||
export const deleteBotsByBotIdSettings = <ThrowOnError extends boolean = false>(options: Options<DeleteBotsByBotIdSettingsData, ThrowOnError>) => (options.client ?? client).delete<DeleteBotsByBotIdSettingsResponses, DeleteBotsByBotIdSettingsErrors, ThrowOnError>({ url: '/bots/{bot_id}/settings', ...options });
|
||||
|
||||
/**
|
||||
* Get user settings
|
||||
*
|
||||
* Get agent settings for current user
|
||||
*/
|
||||
export const getBotsByBotIdSettings = <ThrowOnError extends boolean = false>(options?: Options<GetBotsByBotIdSettingsData, ThrowOnError>) => (options?.client ?? client).get<GetBotsByBotIdSettingsResponses, GetBotsByBotIdSettingsErrors, ThrowOnError>({ url: '/bots/{bot_id}/settings', ...options });
|
||||
export const getBotsByBotIdSettings = <ThrowOnError extends boolean = false>(options: Options<GetBotsByBotIdSettingsData, ThrowOnError>) => (options.client ?? client).get<GetBotsByBotIdSettingsResponses, GetBotsByBotIdSettingsErrors, ThrowOnError>({ url: '/bots/{bot_id}/settings', ...options });
|
||||
|
||||
/**
|
||||
* Update user settings
|
||||
@@ -547,7 +547,7 @@ export const putBotsByBotIdSettings = <ThrowOnError extends boolean = false>(opt
|
||||
*
|
||||
* List subagents for current user
|
||||
*/
|
||||
export const getBotsByBotIdSubagents = <ThrowOnError extends boolean = false>(options?: Options<GetBotsByBotIdSubagentsData, ThrowOnError>) => (options?.client ?? client).get<GetBotsByBotIdSubagentsResponses, GetBotsByBotIdSubagentsErrors, ThrowOnError>({ url: '/bots/{bot_id}/subagents', ...options });
|
||||
export const getBotsByBotIdSubagents = <ThrowOnError extends boolean = false>(options: Options<GetBotsByBotIdSubagentsData, ThrowOnError>) => (options.client ?? client).get<GetBotsByBotIdSubagentsResponses, GetBotsByBotIdSubagentsErrors, ThrowOnError>({ url: '/bots/{bot_id}/subagents', ...options });
|
||||
|
||||
/**
|
||||
* Create subagent
|
||||
|
||||
+251
-74
@@ -6,16 +6,16 @@ export type ClientOptions = {
|
||||
|
||||
export type BotsBot = {
|
||||
avatar_url?: string;
|
||||
created_at?: string;
|
||||
display_name?: string;
|
||||
id?: string;
|
||||
is_active?: boolean;
|
||||
created_at: string;
|
||||
display_name: string;
|
||||
id: string;
|
||||
is_active: boolean;
|
||||
metadata?: {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
owner_user_id?: string;
|
||||
type?: string;
|
||||
updated_at?: string;
|
||||
owner_user_id: string;
|
||||
type: string;
|
||||
updated_at: string;
|
||||
};
|
||||
|
||||
export type BotsBotMember = {
|
||||
@@ -36,7 +36,7 @@ export type BotsCreateBotRequest = {
|
||||
};
|
||||
|
||||
export type BotsListBotsResponse = {
|
||||
items?: Array<BotsBot>;
|
||||
items: Array<BotsBot>;
|
||||
};
|
||||
|
||||
export type BotsListMembersResponse = {
|
||||
@@ -273,25 +273,25 @@ export type ChatToolCallFunction = {
|
||||
};
|
||||
|
||||
export type GithubComMemohaiMemohInternalMcpConnection = {
|
||||
active?: boolean;
|
||||
bot_id?: string;
|
||||
config?: {
|
||||
active: boolean;
|
||||
bot_id: string;
|
||||
config: {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
created_at?: string;
|
||||
id?: string;
|
||||
name?: string;
|
||||
type?: string;
|
||||
updated_at?: string;
|
||||
created_at: string;
|
||||
id: string;
|
||||
name: string;
|
||||
type: string;
|
||||
updated_at: string;
|
||||
};
|
||||
|
||||
export type HandlersChannelMeta = {
|
||||
capabilities?: ChannelChannelCapabilities;
|
||||
config_schema?: ChannelConfigSchema;
|
||||
capabilities: ChannelChannelCapabilities;
|
||||
config_schema: ChannelConfigSchema;
|
||||
configless?: boolean;
|
||||
display_name?: string;
|
||||
display_name: string;
|
||||
target_spec?: ChannelTargetSpec;
|
||||
type?: string;
|
||||
type: string;
|
||||
user_config_schema?: ChannelConfigSchema;
|
||||
};
|
||||
|
||||
@@ -429,18 +429,18 @@ export type HandlersListSnapshotsResponse = {
|
||||
};
|
||||
|
||||
export type HandlersLoginRequest = {
|
||||
password?: string;
|
||||
username?: string;
|
||||
password: string;
|
||||
username: string;
|
||||
};
|
||||
|
||||
export type HandlersLoginResponse = {
|
||||
access_token?: string;
|
||||
display_name?: string;
|
||||
expires_at?: string;
|
||||
role?: string;
|
||||
token_type?: string;
|
||||
user_id?: string;
|
||||
username?: string;
|
||||
access_token: string;
|
||||
display_name: string;
|
||||
expires_at: string;
|
||||
role: string;
|
||||
token_type: string;
|
||||
user_id: string;
|
||||
username: string;
|
||||
};
|
||||
|
||||
export type HandlersMcpStdioRequest = {
|
||||
@@ -634,10 +634,10 @@ export type ModelsAddRequest = {
|
||||
dimensions?: number;
|
||||
input?: Array<string>;
|
||||
is_multimodal?: boolean;
|
||||
llm_provider_id?: string;
|
||||
model_id?: string;
|
||||
name?: string;
|
||||
type?: ModelsModelType;
|
||||
llm_provider_id: string;
|
||||
model_id: string;
|
||||
name: string;
|
||||
type: ModelsModelType;
|
||||
};
|
||||
|
||||
export type ModelsAddResponse = {
|
||||
@@ -653,10 +653,10 @@ export type ModelsGetResponse = {
|
||||
dimensions?: number;
|
||||
input?: Array<string>;
|
||||
is_multimodal?: boolean;
|
||||
llm_provider_id?: string;
|
||||
model_id?: string;
|
||||
name?: string;
|
||||
type?: ModelsModelType;
|
||||
llm_provider_id: string;
|
||||
model_id: string;
|
||||
name: string;
|
||||
type: ModelsModelType;
|
||||
};
|
||||
|
||||
export type ModelsModelType = 'chat' | 'embedding';
|
||||
@@ -665,10 +665,10 @@ export type ModelsUpdateRequest = {
|
||||
dimensions?: number;
|
||||
input?: Array<string>;
|
||||
is_multimodal?: boolean;
|
||||
llm_provider_id?: string;
|
||||
model_id?: string;
|
||||
name?: string;
|
||||
type?: ModelsModelType;
|
||||
llm_provider_id: string;
|
||||
model_id: string;
|
||||
name: string;
|
||||
type: ModelsModelType;
|
||||
};
|
||||
|
||||
export type ProvidersClientType = 'openai' | 'openai-compat' | 'anthropic' | 'google' | 'ollama';
|
||||
@@ -692,15 +692,15 @@ export type ProvidersGetResponse = {
|
||||
* masked in response
|
||||
*/
|
||||
api_key?: string;
|
||||
base_url?: string;
|
||||
client_type?: string;
|
||||
created_at?: string;
|
||||
id?: string;
|
||||
base_url: string;
|
||||
client_type: string;
|
||||
created_at: string;
|
||||
id: string;
|
||||
metadata?: {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
name?: string;
|
||||
updated_at?: string;
|
||||
name: string;
|
||||
updated_at: string;
|
||||
};
|
||||
|
||||
export type ProvidersUpdateRequest = {
|
||||
@@ -755,12 +755,12 @@ export type ScheduleUpdateRequest = {
|
||||
};
|
||||
|
||||
export type SettingsSettings = {
|
||||
allow_guest?: boolean;
|
||||
chat_model_id?: string;
|
||||
embedding_model_id?: string;
|
||||
language?: string;
|
||||
max_context_load_time?: number;
|
||||
memory_model_id?: string;
|
||||
allow_guest: boolean;
|
||||
chat_model_id: string;
|
||||
embedding_model_id: string;
|
||||
language: string;
|
||||
max_context_load_time: number;
|
||||
memory_model_id: string;
|
||||
};
|
||||
|
||||
export type SettingsUpsertRequest = {
|
||||
@@ -1001,7 +1001,12 @@ export type PostBotsByBotIdChatData = {
|
||||
* Chat request
|
||||
*/
|
||||
body: ChatChatRequest;
|
||||
path?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/bots/{bot_id}/chat';
|
||||
};
|
||||
@@ -1033,7 +1038,12 @@ export type PostBotsByBotIdChatStreamData = {
|
||||
* Chat request
|
||||
*/
|
||||
body: ChatChatRequest;
|
||||
path?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/bots/{bot_id}/chat/stream';
|
||||
};
|
||||
@@ -1823,7 +1833,12 @@ export type PostBotsByBotIdContainerStopResponse = PostBotsByBotIdContainerStopR
|
||||
|
||||
export type DeleteBotsByBotIdHistoryData = {
|
||||
body?: never;
|
||||
path?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/bots/{bot_id}/history';
|
||||
};
|
||||
@@ -1850,7 +1865,12 @@ export type DeleteBotsByBotIdHistoryResponses = {
|
||||
|
||||
export type GetBotsByBotIdHistoryData = {
|
||||
body?: never;
|
||||
path?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
};
|
||||
query?: {
|
||||
/**
|
||||
* Limit
|
||||
@@ -1887,7 +1907,12 @@ export type PostBotsByBotIdHistoryData = {
|
||||
* History payload
|
||||
*/
|
||||
body: HistoryCreateRequest;
|
||||
path?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/bots/{bot_id}/history';
|
||||
};
|
||||
@@ -1917,6 +1942,10 @@ export type PostBotsByBotIdHistoryResponse = PostBotsByBotIdHistoryResponses[key
|
||||
export type DeleteBotsByBotIdHistoryByIdData = {
|
||||
body?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
/**
|
||||
* History ID
|
||||
*/
|
||||
@@ -1953,6 +1982,10 @@ export type DeleteBotsByBotIdHistoryByIdResponses = {
|
||||
export type GetBotsByBotIdHistoryByIdData = {
|
||||
body?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
/**
|
||||
* History ID
|
||||
*/
|
||||
@@ -1990,7 +2023,12 @@ export type GetBotsByBotIdHistoryByIdResponse = GetBotsByBotIdHistoryByIdRespons
|
||||
|
||||
export type GetBotsByBotIdMcpData = {
|
||||
body?: never;
|
||||
path?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/bots/{bot_id}/mcp';
|
||||
};
|
||||
@@ -2030,7 +2068,12 @@ export type PostBotsByBotIdMcpData = {
|
||||
* MCP payload
|
||||
*/
|
||||
body: McpUpsertRequest;
|
||||
path?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/bots/{bot_id}/mcp';
|
||||
};
|
||||
@@ -2158,6 +2201,10 @@ export type PostBotsByBotIdMcpStdioBySessionIdResponse = PostBotsByBotIdMcpStdio
|
||||
export type DeleteBotsByBotIdMcpByIdData = {
|
||||
body?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
/**
|
||||
* MCP ID
|
||||
*/
|
||||
@@ -2198,6 +2245,10 @@ export type DeleteBotsByBotIdMcpByIdResponses = {
|
||||
export type GetBotsByBotIdMcpByIdData = {
|
||||
body?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
/**
|
||||
* MCP ID
|
||||
*/
|
||||
@@ -2243,6 +2294,10 @@ export type PutBotsByBotIdMcpByIdData = {
|
||||
*/
|
||||
body: McpUpsertRequest;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
/**
|
||||
* MCP ID
|
||||
*/
|
||||
@@ -2287,7 +2342,12 @@ export type PostBotsByBotIdMemoryAddData = {
|
||||
* Add request
|
||||
*/
|
||||
body: HandlersMemoryAddPayload;
|
||||
path?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/bots/{bot_id}/memory/add';
|
||||
};
|
||||
@@ -2319,7 +2379,12 @@ export type PostBotsByBotIdMemoryEmbedData = {
|
||||
* Embed upsert request
|
||||
*/
|
||||
body: HandlersMemoryEmbedUpsertPayload;
|
||||
path?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/bots/{bot_id}/memory/embed';
|
||||
};
|
||||
@@ -2351,7 +2416,12 @@ export type DeleteBotsByBotIdMemoryMemoriesData = {
|
||||
* Delete all request
|
||||
*/
|
||||
body: HandlersMemoryDeleteAllPayload;
|
||||
path?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/bots/{bot_id}/memory/memories';
|
||||
};
|
||||
@@ -2380,7 +2450,12 @@ export type DeleteBotsByBotIdMemoryMemoriesResponse = DeleteBotsByBotIdMemoryMem
|
||||
|
||||
export type GetBotsByBotIdMemoryMemoriesData = {
|
||||
body?: never;
|
||||
path?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
};
|
||||
query?: {
|
||||
/**
|
||||
* Run ID
|
||||
@@ -2419,6 +2494,10 @@ export type GetBotsByBotIdMemoryMemoriesResponse = GetBotsByBotIdMemoryMemoriesR
|
||||
export type DeleteBotsByBotIdMemoryMemoriesByMemoryIdData = {
|
||||
body?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
/**
|
||||
* Memory ID
|
||||
*/
|
||||
@@ -2453,6 +2532,10 @@ export type DeleteBotsByBotIdMemoryMemoriesByMemoryIdResponse = DeleteBotsByBotI
|
||||
export type GetBotsByBotIdMemoryMemoriesByMemoryIdData = {
|
||||
body?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
/**
|
||||
* Memory ID
|
||||
*/
|
||||
@@ -2489,7 +2572,12 @@ export type PostBotsByBotIdMemorySearchData = {
|
||||
* Search request
|
||||
*/
|
||||
body: HandlersMemorySearchPayload;
|
||||
path?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/bots/{bot_id}/memory/search';
|
||||
};
|
||||
@@ -2521,7 +2609,12 @@ export type PostBotsByBotIdMemoryUpdateData = {
|
||||
* Update request
|
||||
*/
|
||||
body: MemoryUpdateRequest;
|
||||
path?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/bots/{bot_id}/memory/update';
|
||||
};
|
||||
@@ -2550,7 +2643,12 @@ export type PostBotsByBotIdMemoryUpdateResponse = PostBotsByBotIdMemoryUpdateRes
|
||||
|
||||
export type GetBotsByBotIdScheduleData = {
|
||||
body?: never;
|
||||
path?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/bots/{bot_id}/schedule';
|
||||
};
|
||||
@@ -2582,7 +2680,12 @@ export type PostBotsByBotIdScheduleData = {
|
||||
* Schedule payload
|
||||
*/
|
||||
body: ScheduleCreateRequest;
|
||||
path?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/bots/{bot_id}/schedule';
|
||||
};
|
||||
@@ -2612,6 +2715,10 @@ export type PostBotsByBotIdScheduleResponse = PostBotsByBotIdScheduleResponses[k
|
||||
export type DeleteBotsByBotIdScheduleByIdData = {
|
||||
body?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
/**
|
||||
* Schedule ID
|
||||
*/
|
||||
@@ -2644,6 +2751,10 @@ export type DeleteBotsByBotIdScheduleByIdResponses = {
|
||||
export type GetBotsByBotIdScheduleByIdData = {
|
||||
body?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
/**
|
||||
* Schedule ID
|
||||
*/
|
||||
@@ -2685,6 +2796,10 @@ export type PutBotsByBotIdScheduleByIdData = {
|
||||
*/
|
||||
body: ScheduleUpdateRequest;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
/**
|
||||
* Schedule ID
|
||||
*/
|
||||
@@ -2718,7 +2833,12 @@ export type PutBotsByBotIdScheduleByIdResponse = PutBotsByBotIdScheduleByIdRespo
|
||||
|
||||
export type DeleteBotsByBotIdSettingsData = {
|
||||
body?: never;
|
||||
path?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/bots/{bot_id}/settings';
|
||||
};
|
||||
@@ -2745,7 +2865,12 @@ export type DeleteBotsByBotIdSettingsResponses = {
|
||||
|
||||
export type GetBotsByBotIdSettingsData = {
|
||||
body?: never;
|
||||
path?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/bots/{bot_id}/settings';
|
||||
};
|
||||
@@ -2777,7 +2902,12 @@ export type PostBotsByBotIdSettingsData = {
|
||||
* Settings payload
|
||||
*/
|
||||
body: SettingsUpsertRequest;
|
||||
path?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/bots/{bot_id}/settings';
|
||||
};
|
||||
@@ -2809,7 +2939,12 @@ export type PutBotsByBotIdSettingsData = {
|
||||
* Settings payload
|
||||
*/
|
||||
body: SettingsUpsertRequest;
|
||||
path?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/bots/{bot_id}/settings';
|
||||
};
|
||||
@@ -2838,7 +2973,12 @@ export type PutBotsByBotIdSettingsResponse = PutBotsByBotIdSettingsResponses[key
|
||||
|
||||
export type GetBotsByBotIdSubagentsData = {
|
||||
body?: never;
|
||||
path?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/bots/{bot_id}/subagents';
|
||||
};
|
||||
@@ -2870,7 +3010,12 @@ export type PostBotsByBotIdSubagentsData = {
|
||||
* Subagent payload
|
||||
*/
|
||||
body: SubagentCreateRequest;
|
||||
path?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
};
|
||||
query?: never;
|
||||
url: '/bots/{bot_id}/subagents';
|
||||
};
|
||||
@@ -2900,6 +3045,10 @@ export type PostBotsByBotIdSubagentsResponse = PostBotsByBotIdSubagentsResponses
|
||||
export type DeleteBotsByBotIdSubagentsByIdData = {
|
||||
body?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
/**
|
||||
* Subagent ID
|
||||
*/
|
||||
@@ -2936,6 +3085,10 @@ export type DeleteBotsByBotIdSubagentsByIdResponses = {
|
||||
export type GetBotsByBotIdSubagentsByIdData = {
|
||||
body?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
/**
|
||||
* Subagent ID
|
||||
*/
|
||||
@@ -2977,6 +3130,10 @@ export type PutBotsByBotIdSubagentsByIdData = {
|
||||
*/
|
||||
body: SubagentUpdateRequest;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
/**
|
||||
* Subagent ID
|
||||
*/
|
||||
@@ -3015,6 +3172,10 @@ export type PutBotsByBotIdSubagentsByIdResponse = PutBotsByBotIdSubagentsByIdRes
|
||||
export type GetBotsByBotIdSubagentsByIdContextData = {
|
||||
body?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
/**
|
||||
* Subagent ID
|
||||
*/
|
||||
@@ -3056,6 +3217,10 @@ export type PutBotsByBotIdSubagentsByIdContextData = {
|
||||
*/
|
||||
body: SubagentUpdateContextRequest;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
/**
|
||||
* Subagent ID
|
||||
*/
|
||||
@@ -3094,6 +3259,10 @@ export type PutBotsByBotIdSubagentsByIdContextResponse = PutBotsByBotIdSubagents
|
||||
export type GetBotsByBotIdSubagentsByIdSkillsData = {
|
||||
body?: never;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
/**
|
||||
* Subagent ID
|
||||
*/
|
||||
@@ -3135,6 +3304,10 @@ export type PostBotsByBotIdSubagentsByIdSkillsData = {
|
||||
*/
|
||||
body: SubagentAddSkillsRequest;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
/**
|
||||
* Subagent ID
|
||||
*/
|
||||
@@ -3176,6 +3349,10 @@ export type PutBotsByBotIdSubagentsByIdSkillsData = {
|
||||
*/
|
||||
body: SubagentUpdateSkillsRequest;
|
||||
path: {
|
||||
/**
|
||||
* Bot ID
|
||||
*/
|
||||
bot_id: string;
|
||||
/**
|
||||
* Subagent ID
|
||||
*/
|
||||
|
||||
@@ -152,12 +152,22 @@ import {
|
||||
import { toTypedSchema } from '@vee-validate/zod'
|
||||
import z from 'zod'
|
||||
import { useForm } from 'vee-validate'
|
||||
import { CLIENT_TYPES } from '@/composables/api/useProviders'
|
||||
import { useCreateProvider } from '@/composables/api/useProviders'
|
||||
import { useMutation, useQueryCache } from '@pinia/colada'
|
||||
import { postProviders } from '@memoh/sdk'
|
||||
import type { ProvidersClientType } from '@memoh/sdk'
|
||||
|
||||
const CLIENT_TYPES: ProvidersClientType[] = ['openai', 'openai-compat', 'anthropic', 'google', 'ollama']
|
||||
|
||||
const open = defineModel<boolean>('open')
|
||||
|
||||
const { mutate: providerFetch, isLoading } = useCreateProvider()
|
||||
const queryCache = useQueryCache()
|
||||
const { mutate: providerFetch, isLoading } = useMutation({
|
||||
mutation: async (data: Record<string, unknown>) => {
|
||||
const { data: result } = await postProviders({ body: data as any, throwOnError: true })
|
||||
return result
|
||||
},
|
||||
onSettled: () => queryCache.invalidateQueries({ key: ['providers'] }),
|
||||
})
|
||||
|
||||
const providerSchema = toTypedSchema(z.object({
|
||||
api_key: z.string().min(1),
|
||||
|
||||
@@ -172,8 +172,9 @@ import { useForm } from 'vee-validate'
|
||||
import { inject, computed, watch, nextTick, type Ref, ref } from 'vue'
|
||||
import { toTypedSchema } from '@vee-validate/zod'
|
||||
import z from 'zod'
|
||||
import { type ModelInfo } from '@/composables/api/useModels'
|
||||
import { useCreateModel, useUpdateModel } from '@/composables/api/useModels'
|
||||
import { useMutation, useQueryCache } from '@pinia/colada'
|
||||
import { postModels, putModelsModelByModelId } from '@memoh/sdk'
|
||||
import type { ModelsGetResponse } from '@memoh/sdk'
|
||||
|
||||
const formSchema = toTypedSchema(z.object({
|
||||
type: z.string().min(1),
|
||||
@@ -191,7 +192,7 @@ const selectedType = computed(() => form.values.type || editInfo?.value?.type)
|
||||
|
||||
const open = inject<Ref<boolean>>('openModel', ref(false))
|
||||
const title = inject<Ref<'edit' | 'title'>>('openModelTitle', ref('title'))
|
||||
const editInfo = inject<Ref<ModelInfo | null>>('openModelState', ref(null))
|
||||
const editInfo = inject<Ref<ModelsGetResponse | null>>('openModelState', ref(null))
|
||||
|
||||
// 保存按钮:编辑模式直接可提交(表单已预填充,handleSubmit 内部会校验)
|
||||
// 新建模式需要必填字段有值
|
||||
@@ -229,8 +230,25 @@ function onNameInput(e: Event) {
|
||||
|
||||
const { id } = defineProps<{ id: string }>()
|
||||
|
||||
const { mutateAsync: createModel, isLoading: createLoading } = useCreateModel()
|
||||
const { mutateAsync: updateModel, isLoading: updateLoading } = useUpdateModel()
|
||||
const queryCache = useQueryCache()
|
||||
const { mutateAsync: createModel, isLoading: createLoading } = useMutation({
|
||||
mutation: async (data: Record<string, unknown>) => {
|
||||
const { data: result } = await postModels({ body: data as any, throwOnError: true })
|
||||
return result
|
||||
},
|
||||
onSettled: () => queryCache.invalidateQueries({ key: ['provider-models'] }),
|
||||
})
|
||||
const { mutateAsync: updateModel, isLoading: updateLoading } = useMutation({
|
||||
mutation: async ({ modelId, data }: { modelId: string; data: Record<string, unknown> }) => {
|
||||
const { data: result } = await putModelsModelByModelId({
|
||||
path: { modelId },
|
||||
body: data as any,
|
||||
throwOnError: true,
|
||||
})
|
||||
return result
|
||||
},
|
||||
onSettled: () => queryCache.invalidateQueries({ key: ['provider-models'] }),
|
||||
})
|
||||
const isLoading = computed(() => createLoading.value || updateLoading.value)
|
||||
|
||||
async function addModel(e: Event) {
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
import { fetchApi } from '@/utils/request'
|
||||
|
||||
export interface LoginRequest {
|
||||
username: string
|
||||
password: string
|
||||
}
|
||||
|
||||
export interface LoginResponse {
|
||||
access_token: string
|
||||
user_id: string
|
||||
username: string
|
||||
}
|
||||
|
||||
export async function login(data: LoginRequest): Promise<LoginResponse> {
|
||||
return fetchApi<LoginResponse>('/auth/login', {
|
||||
method: 'POST',
|
||||
body: data,
|
||||
noAuth: true,
|
||||
})
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
import { fetchApi } from '@/utils/request'
|
||||
import { useQuery, useMutation, useQueryCache } from '@pinia/colada'
|
||||
import type { Ref } from 'vue'
|
||||
|
||||
// ---- Types ----
|
||||
|
||||
export interface BotSettings {
|
||||
chat_model_id: string
|
||||
memory_model_id: string
|
||||
embedding_model_id: string
|
||||
max_context_load_time: number
|
||||
language: string
|
||||
allow_guest: boolean
|
||||
}
|
||||
|
||||
export interface UpsertBotSettingsRequest {
|
||||
chat_model_id?: string
|
||||
memory_model_id?: string
|
||||
embedding_model_id?: string
|
||||
max_context_load_time?: number
|
||||
language?: string
|
||||
allow_guest?: boolean
|
||||
}
|
||||
|
||||
// ---- Query ----
|
||||
|
||||
export function useBotSettings(botId: Ref<string>) {
|
||||
return useQuery({
|
||||
key: () => ['bot-settings', botId.value],
|
||||
query: () => fetchApi<BotSettings>(`/bots/${botId.value}/settings`),
|
||||
enabled: () => !!botId.value,
|
||||
})
|
||||
}
|
||||
|
||||
// ---- Mutation ----
|
||||
|
||||
export function useUpdateBotSettings(botId: Ref<string>) {
|
||||
const queryCache = useQueryCache()
|
||||
return useMutation({
|
||||
mutation: (data: UpsertBotSettingsRequest) => fetchApi<BotSettings>(
|
||||
`/bots/${botId.value}/settings`,
|
||||
{ method: 'PUT', body: data },
|
||||
),
|
||||
onSettled: () => queryCache.invalidateQueries({ key: ['bot-settings', botId.value] }),
|
||||
})
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
import { fetchApi } from '@/utils/request'
|
||||
import { useQuery, useMutation, useQueryCache } from '@pinia/colada'
|
||||
import type { Ref } from 'vue'
|
||||
|
||||
// ---- Types ----
|
||||
|
||||
export interface BotInfo {
|
||||
id: string
|
||||
display_name: string
|
||||
avatar_url: string
|
||||
type: string
|
||||
is_active: boolean
|
||||
owner_user_id: string
|
||||
metadata: Record<string, unknown>
|
||||
created_at: string
|
||||
updated_at: string
|
||||
}
|
||||
|
||||
export interface ListBotsResponse {
|
||||
items: BotInfo[]
|
||||
}
|
||||
|
||||
export interface CreateBotRequest {
|
||||
display_name: string
|
||||
avatar_url?: string
|
||||
type?: string
|
||||
is_active?: boolean
|
||||
metadata?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface UpdateBotRequest {
|
||||
display_name?: string
|
||||
avatar_url?: string
|
||||
is_active?: boolean
|
||||
metadata?: Record<string, unknown>
|
||||
}
|
||||
|
||||
// ---- Query: 获取 Bot 列表 ----
|
||||
|
||||
export function useBotList() {
|
||||
const queryCache = useQueryCache()
|
||||
|
||||
const query = useQuery({
|
||||
key: ['bots'],
|
||||
query: async (): Promise<BotInfo[]> => {
|
||||
const res = await fetchApi<ListBotsResponse>('/bots')
|
||||
return res.items ?? []
|
||||
},
|
||||
})
|
||||
|
||||
return {
|
||||
...query,
|
||||
invalidate: () => queryCache.invalidateQueries({ key: ['bots'] }),
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Query: 获取单个 Bot 详情 ----
|
||||
|
||||
export function useBotDetail(botId: Ref<string>) {
|
||||
return useQuery({
|
||||
key: () => ['bot', botId.value],
|
||||
query: () => fetchApi<BotInfo>(`/bots/${botId.value}`),
|
||||
enabled: () => !!botId.value,
|
||||
})
|
||||
}
|
||||
|
||||
// ---- Mutations ----
|
||||
|
||||
export function useCreateBot() {
|
||||
const queryCache = useQueryCache()
|
||||
return useMutation({
|
||||
mutation: (data: CreateBotRequest) => fetchApi<BotInfo>('/bots', {
|
||||
method: 'POST',
|
||||
body: data,
|
||||
}),
|
||||
onSettled: () => queryCache.invalidateQueries({ key: ['bots'] }),
|
||||
})
|
||||
}
|
||||
|
||||
export function useDeleteBot() {
|
||||
const queryCache = useQueryCache()
|
||||
return useMutation({
|
||||
mutation: (botId: string) => fetchApi(`/bots/${botId}`, {
|
||||
method: 'DELETE',
|
||||
}),
|
||||
onSettled: () => queryCache.invalidateQueries({ key: ['bots'] }),
|
||||
})
|
||||
}
|
||||
|
||||
export function useUpdateBot() {
|
||||
const queryCache = useQueryCache()
|
||||
return useMutation({
|
||||
mutation: ({ id, ...data }: UpdateBotRequest & { id: string }) => fetchApi<BotInfo>(`/bots/${id}`, {
|
||||
method: 'PUT',
|
||||
body: data,
|
||||
}),
|
||||
onSettled: () => queryCache.invalidateQueries({ key: ['bots'] }),
|
||||
})
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
import { fetchApi, ApiError } from '@/utils/request'
|
||||
import { useQuery, useMutation, useQueryCache } from '@pinia/colada'
|
||||
import type { Ref } from 'vue'
|
||||
|
||||
// ---- Types ----
|
||||
|
||||
export interface FieldSchema {
|
||||
title: string
|
||||
description?: string
|
||||
type: 'string' | 'secret' | 'bool' | 'number' | 'enum'
|
||||
required?: boolean
|
||||
enum?: string[]
|
||||
example?: unknown
|
||||
}
|
||||
|
||||
export interface ConfigSchema {
|
||||
version: number
|
||||
fields: Record<string, FieldSchema>
|
||||
}
|
||||
|
||||
export interface ChannelCapabilities {
|
||||
text: boolean
|
||||
markdown: boolean
|
||||
rich_text: boolean
|
||||
attachments: boolean
|
||||
media: boolean
|
||||
reactions: boolean
|
||||
buttons: boolean
|
||||
reply: boolean
|
||||
threads: boolean
|
||||
streaming: boolean
|
||||
polls: boolean
|
||||
edit: boolean
|
||||
unsend: boolean
|
||||
native_commands: boolean
|
||||
block_streaming: boolean
|
||||
chat_types?: string[]
|
||||
}
|
||||
|
||||
export interface ChannelMeta {
|
||||
type: string
|
||||
display_name: string
|
||||
configless: boolean
|
||||
capabilities: ChannelCapabilities
|
||||
config_schema: ConfigSchema
|
||||
user_config_schema: ConfigSchema
|
||||
target_spec: { format: string; description: string }
|
||||
}
|
||||
|
||||
export interface ChannelConfig {
|
||||
id: string
|
||||
botID: string
|
||||
channelType: string
|
||||
credentials: Record<string, unknown>
|
||||
externalIdentity: string
|
||||
selfIdentity: Record<string, unknown>
|
||||
routing: Record<string, unknown>
|
||||
status: string
|
||||
verifiedAt: string
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
export interface UpsertConfigRequest {
|
||||
credentials: Record<string, unknown>
|
||||
external_identity?: string
|
||||
self_identity?: Record<string, unknown>
|
||||
routing?: Record<string, unknown>
|
||||
status?: string
|
||||
}
|
||||
|
||||
export interface BotChannelItem {
|
||||
meta: ChannelMeta
|
||||
config: ChannelConfig | null
|
||||
configured: boolean
|
||||
}
|
||||
|
||||
// ---- Query: 获取可用渠道类型元信息 ----
|
||||
|
||||
export function useChannelMetas() {
|
||||
return useQuery({
|
||||
key: ['channel-metas'],
|
||||
query: () => fetchApi<ChannelMeta[]>('/channels'),
|
||||
})
|
||||
}
|
||||
|
||||
// ---- Query: 获取某 Bot 的所有渠道配置(组合查询) ----
|
||||
|
||||
export function useBotChannels(botId: Ref<string>) {
|
||||
const queryCache = useQueryCache()
|
||||
|
||||
const query = useQuery({
|
||||
key: () => ['bot-channels', botId.value],
|
||||
query: async (): Promise<BotChannelItem[]> => {
|
||||
// 1. 获取所有渠道元信息
|
||||
const metas = await fetchApi<ChannelMeta[]>('/channels')
|
||||
|
||||
// 2. 过滤掉 configless 的类型(cli / web 等本地渠道)
|
||||
const configurableTypes = metas.filter((m) => !m.configless)
|
||||
|
||||
// 3. 并行获取每种类型的 bot 配置
|
||||
const results = await Promise.all(
|
||||
configurableTypes.map(async (meta) => {
|
||||
try {
|
||||
const config = await fetchApi<ChannelConfig>(
|
||||
`/bots/${botId.value}/channel/${meta.type}`,
|
||||
)
|
||||
return { meta, config, configured: true } as BotChannelItem
|
||||
} catch (err) {
|
||||
// 404 = 尚未配置,其他错误也视为未配置
|
||||
if (err instanceof ApiError && err.status === 404) {
|
||||
return { meta, config: null, configured: false } as BotChannelItem
|
||||
}
|
||||
return { meta, config: null, configured: false } as BotChannelItem
|
||||
}
|
||||
}),
|
||||
)
|
||||
|
||||
return results
|
||||
},
|
||||
enabled: () => !!botId.value,
|
||||
})
|
||||
|
||||
return {
|
||||
...query,
|
||||
invalidate: () => queryCache.invalidateQueries({ key: ['bot-channels', botId.value] }),
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Mutation: 创建/更新 Bot 渠道配置 ----
|
||||
|
||||
export function useUpsertBotChannel(botId: Ref<string>) {
|
||||
const queryCache = useQueryCache()
|
||||
|
||||
return useMutation({
|
||||
mutation: ({ platform, data }: { platform: string; data: UpsertConfigRequest }) =>
|
||||
fetchApi<ChannelConfig>(`/bots/${botId.value}/channel/${platform}`, {
|
||||
method: 'PUT',
|
||||
body: data,
|
||||
}),
|
||||
onSettled: () => queryCache.invalidateQueries({ key: ['bot-channels', botId.value] }),
|
||||
})
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
import { fetchApi } from '@/utils/request'
|
||||
import { useQuery, useMutation, useQueryCache } from '@pinia/colada'
|
||||
import type { Ref } from 'vue'
|
||||
|
||||
// ---- Types ----
|
||||
|
||||
export interface ModelInfo {
|
||||
dimensions: number
|
||||
is_multimodal: boolean
|
||||
input?: string[]
|
||||
llm_provider_id: string
|
||||
model_id: string
|
||||
name: string
|
||||
type: string
|
||||
enable_as?: string
|
||||
}
|
||||
|
||||
export interface CreateModelRequest {
|
||||
model_id: string
|
||||
type: string
|
||||
llm_provider_id: string
|
||||
name?: string
|
||||
dimensions?: number
|
||||
is_multimodal?: boolean
|
||||
}
|
||||
|
||||
// ---- Query: 获取 Provider 下的模型列表 ----
|
||||
|
||||
export function useModelList(providerId: Ref<string | undefined>) {
|
||||
const queryCache = useQueryCache()
|
||||
|
||||
const query = useQuery({
|
||||
key: ['model'],
|
||||
query: () => fetchApi<ModelInfo[]>(
|
||||
`/providers/${providerId.value}/models`,
|
||||
),
|
||||
})
|
||||
|
||||
return {
|
||||
...query,
|
||||
/** 当 providerId 变化时手动刷新 */
|
||||
invalidate: () => queryCache.invalidateQueries({ key: ['model'] }),
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Query: 获取所有模型(跨 Provider) ----
|
||||
|
||||
export function useAllModels() {
|
||||
return useQuery({
|
||||
key: ['all-models'],
|
||||
query: () => fetchApi<ModelInfo[]>('/models'),
|
||||
})
|
||||
}
|
||||
|
||||
// ---- Mutations ----
|
||||
|
||||
export function useCreateModel() {
|
||||
const queryCache = useQueryCache()
|
||||
return useMutation({
|
||||
mutation: (data: CreateModelRequest) => fetchApi('/models', {
|
||||
method: 'POST',
|
||||
body: data,
|
||||
}),
|
||||
onSettled: () => queryCache.invalidateQueries({ key: ['model'], exact: true }),
|
||||
})
|
||||
}
|
||||
|
||||
export function useUpdateModel() {
|
||||
const queryCache = useQueryCache()
|
||||
return useMutation({
|
||||
mutation: ({ modelId, data }: { modelId: string; data: Partial<CreateModelRequest> }) =>
|
||||
fetchApi(`/models/model/${modelId}`, {
|
||||
method: 'PUT',
|
||||
body: data,
|
||||
}),
|
||||
onSettled: () => queryCache.invalidateQueries({ key: ['model'] }),
|
||||
})
|
||||
}
|
||||
|
||||
export function useDeleteModel() {
|
||||
const queryCache = useQueryCache()
|
||||
return useMutation({
|
||||
mutation: (modelName: string) => fetchApi(`/models/model/${modelName}`, {
|
||||
method: 'DELETE',
|
||||
}),
|
||||
onSettled: () => queryCache.invalidateQueries({ key: ['model'] }),
|
||||
})
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
import { fetchApi } from '@/utils/request'
|
||||
import { useQuery, useMutation, useQueryCache } from '@pinia/colada'
|
||||
import type { Ref } from 'vue'
|
||||
|
||||
// ---- Types ----
|
||||
|
||||
export interface ProviderInfo {
|
||||
api_key: string
|
||||
base_url: string
|
||||
client_type: string
|
||||
metadata: Record<'additionalProp1', object>
|
||||
name: string
|
||||
}
|
||||
|
||||
export const CLIENT_TYPES = ['openai', 'anthropic', 'google', 'ollama'] as const
|
||||
|
||||
export type ProviderWithId = ProviderInfo & { id: string }
|
||||
|
||||
export interface CreateProviderRequest {
|
||||
name: string
|
||||
api_key: string
|
||||
base_url: string
|
||||
client_type: string
|
||||
metadata?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export type UpdateProviderRequest = Partial<CreateProviderRequest>
|
||||
|
||||
// ---- Query: 获取 Provider 列表 ----
|
||||
|
||||
export function useProviderList(clientType: Ref<string>) {
|
||||
return useQuery({
|
||||
key: ['provider'],
|
||||
query: () => fetchApi<ProviderWithId[]>(
|
||||
`/providers?client_type=${clientType.value}`,
|
||||
),
|
||||
})
|
||||
}
|
||||
|
||||
/** 获取所有 Provider(无过滤) */
|
||||
export function useAllProviders() {
|
||||
return useQuery({
|
||||
key: ['all-providers'],
|
||||
query: () => fetchApi<ProviderWithId[]>('/providers'),
|
||||
})
|
||||
}
|
||||
|
||||
// ---- Mutations ----
|
||||
|
||||
export function useCreateProvider() {
|
||||
const queryCache = useQueryCache()
|
||||
return useMutation({
|
||||
mutation: (data: CreateProviderRequest) => fetchApi('/providers', {
|
||||
method: 'POST',
|
||||
body: data,
|
||||
}),
|
||||
onSettled: () => queryCache.invalidateQueries({ key: ['provider'] }),
|
||||
})
|
||||
}
|
||||
|
||||
export function useUpdateProvider(providerId: Ref<string | undefined>) {
|
||||
const queryCache = useQueryCache()
|
||||
return useMutation({
|
||||
mutation: (data: UpdateProviderRequest) => fetchApi(`/providers/${providerId.value}`, {
|
||||
method: 'PUT',
|
||||
body: data,
|
||||
}),
|
||||
onSettled: () => queryCache.invalidateQueries({ key: ['provider'] }),
|
||||
})
|
||||
}
|
||||
|
||||
export function useDeleteProvider(providerId: Ref<string | undefined>) {
|
||||
const queryCache = useQueryCache()
|
||||
return useMutation({
|
||||
mutation: () => fetchApi(`/providers/${providerId.value}`, {
|
||||
method: 'DELETE',
|
||||
}),
|
||||
onSettled: () => queryCache.invalidateQueries({ key: ['provider'] }),
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import { client } from '@memoh/sdk/client'
|
||||
import router from '@/router'
|
||||
|
||||
/**
|
||||
* Configure the SDK client with base URL, auth interceptor, and 401 handling.
|
||||
* Call this once at app startup (main.ts).
|
||||
*/
|
||||
export function setupApiClient() {
|
||||
// Set base URL to match the Vite proxy
|
||||
client.setConfig({ baseUrl: '/api' })
|
||||
|
||||
// Add auth token to every request
|
||||
client.interceptors.request.use((request) => {
|
||||
const token = localStorage.getItem('token')
|
||||
if (token) {
|
||||
request.headers.set('Authorization', `Bearer ${token}`)
|
||||
}
|
||||
return request
|
||||
})
|
||||
|
||||
// Handle 401 responses globally
|
||||
client.interceptors.response.use((response) => {
|
||||
if (response.status === 401) {
|
||||
localStorage.removeItem('token')
|
||||
router.replace({ name: 'Login' })
|
||||
}
|
||||
return response
|
||||
})
|
||||
}
|
||||
@@ -2,6 +2,10 @@ import { createApp } from 'vue'
|
||||
import './style.css'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import { setupApiClient } from './lib/api-client'
|
||||
|
||||
// Configure SDK client before anything else
|
||||
setupApiClient()
|
||||
import { createPinia } from 'pinia'
|
||||
import i18n from './i18n'
|
||||
import { PiniaColada } from '@pinia/colada'
|
||||
|
||||
@@ -80,17 +80,17 @@ import {
|
||||
import ConfirmPopover from '@/components/confirm-popover/index.vue'
|
||||
import { computed } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import type { BotInfo } from '@/composables/api/useBots'
|
||||
import type { BotsBot } from '@memoh/sdk'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
const props = defineProps<{
|
||||
bot: BotInfo
|
||||
bot: BotsBot
|
||||
deleteLoading: boolean
|
||||
}>()
|
||||
|
||||
defineEmits<{
|
||||
edit: [bot: BotInfo]
|
||||
edit: [bot: BotsBot]
|
||||
delete: [id: string]
|
||||
}>()
|
||||
|
||||
|
||||
@@ -142,15 +142,48 @@ import {
|
||||
PopoverTrigger,
|
||||
PopoverContent,
|
||||
} from '@memoh/ui'
|
||||
import { useBotChannels, type BotChannelItem } from '@/composables/api/useChannels'
|
||||
import { useQuery, useQueryCache } from '@pinia/colada'
|
||||
import { getChannels, getBotsByIdChannelByPlatform } from '@memoh/sdk'
|
||||
import type { HandlersChannelMeta, ChannelChannelConfig } from '@memoh/sdk'
|
||||
import ChannelSettingsPanel from './channel-settings-panel.vue'
|
||||
|
||||
export interface BotChannelItem {
|
||||
meta: HandlersChannelMeta
|
||||
config: ChannelChannelConfig | null
|
||||
configured: boolean
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
botId: string
|
||||
}>()
|
||||
|
||||
const botIdRef = computed(() => props.botId)
|
||||
const { data: channels, isLoading, refetch } = useBotChannels(botIdRef)
|
||||
|
||||
const { data: channels, isLoading, refetch } = useQuery({
|
||||
key: () => ['bot-channels', botIdRef.value],
|
||||
query: async (): Promise<BotChannelItem[]> => {
|
||||
const { data: metas } = await getChannels({ throwOnError: true })
|
||||
if (!metas) return []
|
||||
|
||||
const configurableTypes = metas.filter((m) => !m.configless)
|
||||
|
||||
const results = await Promise.all(
|
||||
configurableTypes.map(async (meta) => {
|
||||
try {
|
||||
const { data: config } = await getBotsByIdChannelByPlatform({
|
||||
path: { id: botIdRef.value, platform: meta.type },
|
||||
throwOnError: true,
|
||||
})
|
||||
return { meta, config: config ?? null, configured: true } as BotChannelItem
|
||||
} catch {
|
||||
return { meta, config: null, configured: false } as BotChannelItem
|
||||
}
|
||||
}),
|
||||
)
|
||||
return results
|
||||
},
|
||||
enabled: () => !!botIdRef.value,
|
||||
})
|
||||
|
||||
const selectedType = ref<string | null>(null)
|
||||
const addPopoverOpen = ref(false)
|
||||
|
||||
@@ -94,9 +94,9 @@ import { reactive, computed, watch } from 'vue'
|
||||
import { toast } from 'vue-sonner'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import ModelSelect from './model-select.vue'
|
||||
import { useBotSettings, useUpdateBotSettings, type BotSettings } from '@/composables/api/useBotSettings'
|
||||
import { useAllModels } from '@/composables/api/useModels'
|
||||
import { useAllProviders } from '@/composables/api/useProviders'
|
||||
import { useQuery, useMutation, useQueryCache } from '@pinia/colada'
|
||||
import { getBotsByBotIdSettings, putBotsByBotIdSettings, getModels, getProviders } from '@memoh/sdk'
|
||||
import type { SettingsSettings } from '@memoh/sdk'
|
||||
import type { Ref } from 'vue'
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -108,16 +108,50 @@ const { t } = useI18n()
|
||||
const botIdRef = computed(() => props.botId) as Ref<string>
|
||||
|
||||
// ---- Data ----
|
||||
const { data: settings } = useBotSettings(botIdRef)
|
||||
const { data: modelData } = useAllModels()
|
||||
const { data: providerData } = useAllProviders()
|
||||
const { mutateAsync: updateSettings, isLoading } = useUpdateBotSettings(botIdRef)
|
||||
const queryCache = useQueryCache()
|
||||
|
||||
const { data: settings } = useQuery({
|
||||
key: () => ['bot-settings', botIdRef.value],
|
||||
query: async () => {
|
||||
const { data } = await getBotsByBotIdSettings({ path: { bot_id: botIdRef.value }, throwOnError: true })
|
||||
return data
|
||||
},
|
||||
enabled: () => !!botIdRef.value,
|
||||
})
|
||||
|
||||
const { data: modelData } = useQuery({
|
||||
key: ['all-models'],
|
||||
query: async () => {
|
||||
const { data } = await getModels({ throwOnError: true })
|
||||
return data
|
||||
},
|
||||
})
|
||||
|
||||
const { data: providerData } = useQuery({
|
||||
key: ['all-providers'],
|
||||
query: async () => {
|
||||
const { data } = await getProviders({ throwOnError: true })
|
||||
return data
|
||||
},
|
||||
})
|
||||
|
||||
const { mutateAsync: updateSettings, isLoading } = useMutation({
|
||||
mutation: async (body: Partial<SettingsSettings>) => {
|
||||
const { data } = await putBotsByBotIdSettings({
|
||||
path: { bot_id: botIdRef.value },
|
||||
body,
|
||||
throwOnError: true,
|
||||
})
|
||||
return data
|
||||
},
|
||||
onSettled: () => queryCache.invalidateQueries({ key: ['bot-settings', botIdRef.value] }),
|
||||
})
|
||||
|
||||
const models = computed(() => modelData.value ?? [])
|
||||
const providers = computed(() => providerData.value ?? [])
|
||||
|
||||
// ---- Form ----
|
||||
const form = reactive<BotSettings>({
|
||||
const form = reactive<SettingsSettings>({
|
||||
chat_model_id: '',
|
||||
memory_model_id: '',
|
||||
embedding_model_id: '',
|
||||
|
||||
@@ -151,14 +151,17 @@ import {
|
||||
import { reactive, watch, computed } from 'vue'
|
||||
import { toast } from 'vue-sonner'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import {
|
||||
useUpsertBotChannel,
|
||||
type BotChannelItem,
|
||||
type FieldSchema,
|
||||
} from '@/composables/api/useChannels'
|
||||
import { ApiError } from '@/utils/request'
|
||||
import { useMutation, useQueryCache } from '@pinia/colada'
|
||||
import { putBotsByIdChannelByPlatform } from '@memoh/sdk'
|
||||
import type { HandlersChannelMeta, ChannelChannelConfig, ChannelFieldSchema } from '@memoh/sdk'
|
||||
import type { Ref } from 'vue'
|
||||
|
||||
interface BotChannelItem {
|
||||
meta: HandlersChannelMeta
|
||||
config: ChannelChannelConfig | null
|
||||
configured: boolean
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
botId: string
|
||||
channelItem: BotChannelItem
|
||||
@@ -170,7 +173,18 @@ const emit = defineEmits<{
|
||||
|
||||
const { t } = useI18n()
|
||||
const botIdRef = computed(() => props.botId) as Ref<string>
|
||||
const { mutateAsync: upsertChannel, isLoading } = useUpsertBotChannel(botIdRef)
|
||||
const queryCache = useQueryCache()
|
||||
const { mutateAsync: upsertChannel, isLoading } = useMutation({
|
||||
mutation: async ({ platform, data }: { platform: string; data: Record<string, unknown> }) => {
|
||||
const { data: result } = await putBotsByIdChannelByPlatform({
|
||||
path: { id: botIdRef.value, platform },
|
||||
body: data as any,
|
||||
throwOnError: true,
|
||||
})
|
||||
return result
|
||||
},
|
||||
onSettled: () => queryCache.invalidateQueries({ key: ['bot-channels', botIdRef.value] }),
|
||||
})
|
||||
|
||||
// ---- Form state ----
|
||||
|
||||
@@ -193,7 +207,7 @@ const orderedFields = computed(() => {
|
||||
if (!a.required && b.required) return 1
|
||||
return 0
|
||||
})
|
||||
return Object.fromEntries(entries) as Record<string, FieldSchema>
|
||||
return Object.fromEntries(entries) as Record<string, ChannelFieldSchema>
|
||||
})
|
||||
|
||||
// 初始化表单
|
||||
@@ -252,10 +266,7 @@ async function handleSave() {
|
||||
emit('saved')
|
||||
} catch (err) {
|
||||
let detail = ''
|
||||
if (err instanceof ApiError && err.body) {
|
||||
const body = err.body as Record<string, unknown>
|
||||
detail = String(body.message || body.error || '')
|
||||
} else if (err instanceof Error) {
|
||||
if (err instanceof Error) {
|
||||
detail = err.message
|
||||
}
|
||||
toast.error(detail ? `${t('bots.channels.saveFailed')}: ${detail}` : t('bots.channels.saveFailed'))
|
||||
|
||||
@@ -153,10 +153,12 @@ import { useForm } from 'vee-validate'
|
||||
import { toTypedSchema } from '@vee-validate/zod'
|
||||
import z from 'zod'
|
||||
import { computed, watch } from 'vue'
|
||||
import { useCreateBot, useUpdateBot, type BotInfo } from '@/composables/api/useBots'
|
||||
import { useMutation, useQueryCache } from '@pinia/colada'
|
||||
import { postBotsMutation, putBotsByIdMutation, getBotsQueryKey } from '@memoh/sdk/colada'
|
||||
import type { BotsBot } from '@memoh/sdk'
|
||||
|
||||
const open = defineModel<boolean>('open', { default: false })
|
||||
const editBot = defineModel<BotInfo | null>('editBot', { default: null })
|
||||
const editBot = defineModel<BotsBot | null>('editBot', { default: null })
|
||||
|
||||
const isEdit = computed(() => !!editBot.value)
|
||||
|
||||
@@ -174,8 +176,15 @@ const form = useForm({
|
||||
},
|
||||
})
|
||||
|
||||
const { mutate: createBot, isLoading: createLoading } = useCreateBot()
|
||||
const { mutate: updateBot, isLoading: updateLoading } = useUpdateBot()
|
||||
const queryCache = useQueryCache()
|
||||
const { mutate: createBot, isLoading: createLoading } = useMutation({
|
||||
...postBotsMutation(),
|
||||
onSettled: () => queryCache.invalidateQueries({ key: getBotsQueryKey() }),
|
||||
})
|
||||
const { mutate: updateBot, isLoading: updateLoading } = useMutation({
|
||||
...putBotsByIdMutation(),
|
||||
onSettled: () => queryCache.invalidateQueries({ key: getBotsQueryKey() }),
|
||||
})
|
||||
|
||||
const submitLoading = computed(() => createLoading.value || updateLoading.value)
|
||||
|
||||
@@ -199,17 +208,21 @@ const handleSubmit = form.handleSubmit(async (values) => {
|
||||
try {
|
||||
if (isEdit.value && editBot.value) {
|
||||
await updateBot({
|
||||
id: editBot.value.id,
|
||||
display_name: values.display_name,
|
||||
avatar_url: values.avatar_url || undefined,
|
||||
is_active: values.is_active,
|
||||
path: { id: editBot.value.id },
|
||||
body: {
|
||||
display_name: values.display_name,
|
||||
avatar_url: values.avatar_url || undefined,
|
||||
is_active: values.is_active,
|
||||
},
|
||||
})
|
||||
} else {
|
||||
await createBot({
|
||||
display_name: values.display_name,
|
||||
avatar_url: values.avatar_url || undefined,
|
||||
type: values.type || undefined,
|
||||
is_active: true,
|
||||
body: {
|
||||
display_name: values.display_name,
|
||||
avatar_url: values.avatar_url || undefined,
|
||||
type: values.type || undefined,
|
||||
is_active: true,
|
||||
},
|
||||
})
|
||||
}
|
||||
open.value = false
|
||||
|
||||
@@ -89,12 +89,11 @@ import {
|
||||
ScrollArea,
|
||||
} from '@memoh/ui'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import type { ModelInfo } from '@/composables/api/useModels'
|
||||
import type { ProviderWithId } from '@/composables/api/useProviders'
|
||||
import type { ModelsGetResponse, ProvidersGetResponse } from '@memoh/sdk'
|
||||
|
||||
const props = defineProps<{
|
||||
models: ModelInfo[]
|
||||
providers: ProviderWithId[]
|
||||
models: ModelsGetResponse[]
|
||||
providers: ProvidersGetResponse[]
|
||||
modelType: 'chat' | 'embedding'
|
||||
placeholder?: string
|
||||
}>()
|
||||
@@ -131,7 +130,7 @@ const filteredGroups = computed(() => {
|
||||
)
|
||||
: typeFilteredModels.value
|
||||
|
||||
const groups = new Map<string, { providerName: string; models: ModelInfo[] }>()
|
||||
const groups = new Map<string, { providerName: string; models: ModelsGetResponse[] }>()
|
||||
for (const model of models) {
|
||||
const pid = model.llm_provider_id
|
||||
const providerName = providerMap.value.get(pid) ?? pid
|
||||
|
||||
@@ -117,14 +117,22 @@ import {
|
||||
} from '@memoh/ui'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { useBotDetail } from '@/composables/api/useBots'
|
||||
import { useQuery } from '@pinia/colada'
|
||||
import { getBotsById } from '@memoh/sdk'
|
||||
import BotSettings from './components/bot-settings.vue'
|
||||
import BotChannels from './components/bot-channels.vue'
|
||||
|
||||
const route = useRoute()
|
||||
const botId = computed(() => route.params.botId as string)
|
||||
|
||||
const { data: bot } = useBotDetail(botId)
|
||||
const { data: bot } = useQuery({
|
||||
key: () => ['bot', botId.value],
|
||||
query: async () => {
|
||||
const { data } = await getBotsById({ path: { id: botId.value }, throwOnError: true })
|
||||
return data
|
||||
},
|
||||
enabled: () => !!botId.value,
|
||||
})
|
||||
|
||||
// 加载到 bot 数据后,用名称替换 breadcrumb 中的 botId
|
||||
watch(bot, (val) => {
|
||||
|
||||
@@ -69,19 +69,25 @@ import {
|
||||
import { ref, computed } from 'vue'
|
||||
import BotCard from './components/bot-card.vue'
|
||||
import CreateBot from './components/create-bot.vue'
|
||||
import { useBotList, useDeleteBot, type BotInfo } from '@/composables/api/useBots'
|
||||
import { useQuery, useMutation, useQueryCache } from '@pinia/colada'
|
||||
import { getBotsQuery, getBotsQueryKey, deleteBotsByIdMutation } from '@memoh/sdk/colada'
|
||||
import type { BotsBot } from '@memoh/sdk'
|
||||
|
||||
const searchText = ref('')
|
||||
const dialogOpen = ref(false)
|
||||
const editingBot = ref<BotInfo | null>(null)
|
||||
const editingBot = ref<BotsBot | null>(null)
|
||||
|
||||
const { data: botData, status } = useBotList()
|
||||
const { mutate: deleteBot, isLoading: deleteLoading } = useDeleteBot()
|
||||
const queryCache = useQueryCache()
|
||||
const { data: botData, status } = useQuery(getBotsQuery())
|
||||
const { mutate: deleteBot, isLoading: deleteLoading } = useMutation({
|
||||
...deleteBotsByIdMutation(),
|
||||
onSettled: () => queryCache.invalidateQueries({ key: getBotsQueryKey() }),
|
||||
})
|
||||
|
||||
const isLoading = computed(() => status.value === 'loading')
|
||||
|
||||
const filteredBots = computed(() => {
|
||||
const list = botData.value ?? []
|
||||
const list = botData.value?.items ?? []
|
||||
const keyword = searchText.value.trim().toLowerCase()
|
||||
if (!keyword) return list
|
||||
return list.filter((bot) =>
|
||||
@@ -91,14 +97,14 @@ const filteredBots = computed(() => {
|
||||
)
|
||||
})
|
||||
|
||||
function handleEdit(bot: BotInfo) {
|
||||
function handleEdit(bot: BotsBot) {
|
||||
editingBot.value = bot
|
||||
dialogOpen.value = true
|
||||
}
|
||||
|
||||
async function handleDelete(id: string) {
|
||||
try {
|
||||
await deleteBot(id)
|
||||
await deleteBot({ path: { id } })
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -65,17 +65,19 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { Avatar, AvatarImage, AvatarFallback, ScrollArea } from '@memoh/ui'
|
||||
import { useBotList, type BotInfo } from '@/composables/api/useBots'
|
||||
import { useQuery } from '@pinia/colada'
|
||||
import { getBotsQuery } from '@memoh/sdk/colada'
|
||||
import type { BotsBot } from '@memoh/sdk'
|
||||
import { useChatStore } from '@/store/chat-list'
|
||||
import { storeToRefs } from 'pinia'
|
||||
|
||||
const chatStore = useChatStore()
|
||||
const { currentBotId } = storeToRefs(chatStore)
|
||||
|
||||
const { data: botData, isLoading } = useBotList()
|
||||
const bots = computed<BotInfo[]>(() => botData.value ?? [])
|
||||
const { data: botData, isLoading } = useQuery(getBotsQuery())
|
||||
const bots = computed<BotsBot[]>(() => botData.value?.items ?? [])
|
||||
|
||||
function handleSelect(bot: BotInfo) {
|
||||
function handleSelect(bot: BotsBot) {
|
||||
chatStore.selectBot(bot.id)
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -107,11 +107,11 @@ import { useRouter } from 'vue-router'
|
||||
import { toTypedSchema } from '@vee-validate/zod'
|
||||
import { useForm } from 'vee-validate'
|
||||
import * as z from 'zod'
|
||||
import { useUserStore } from '@/store/User'
|
||||
import { useUserStore } from '@/store/user'
|
||||
import { ref } from 'vue'
|
||||
import { toast } from 'vue-sonner'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { login as loginApi } from '@/composables/api/useAuth'
|
||||
import { postAuthLogin } from '@memoh/sdk'
|
||||
|
||||
const router = useRouter()
|
||||
const { t } = useI18n()
|
||||
@@ -130,13 +130,13 @@ const loading = ref(false)
|
||||
const login = form.handleSubmit(async (values) => {
|
||||
try {
|
||||
loading.value = true
|
||||
const data = await loginApi(values)
|
||||
const { data } = await postAuthLogin({ body: values })
|
||||
if (data?.access_token && data?.user_id) {
|
||||
loginHandle({
|
||||
id: data.user_id,
|
||||
username: data.username,
|
||||
displayName: '',
|
||||
role: '',
|
||||
displayName: data.display_name ?? '',
|
||||
role: data.role ?? '',
|
||||
}, data.access_token)
|
||||
} else {
|
||||
throw new Error(t('auth.loginFailed'))
|
||||
|
||||
@@ -43,15 +43,15 @@ import {
|
||||
Button,
|
||||
} from '@memoh/ui'
|
||||
import ConfirmPopover from '@/components/confirm-popover/index.vue'
|
||||
import { type ModelInfo } from '@/composables/api/useModels'
|
||||
import type { ModelsGetResponse } from '@memoh/sdk'
|
||||
|
||||
defineProps<{
|
||||
model: ModelInfo
|
||||
model: ModelsGetResponse
|
||||
deleteLoading: boolean
|
||||
}>()
|
||||
|
||||
defineEmits<{
|
||||
edit: [model: ModelInfo]
|
||||
edit: [model: ModelsGetResponse]
|
||||
delete: [name: string]
|
||||
}>()
|
||||
</script>
|
||||
|
||||
@@ -51,16 +51,16 @@ import {
|
||||
} from '@memoh/ui'
|
||||
import CreateModel from '@/components/create-model/index.vue'
|
||||
import ModelItem from './model-item.vue'
|
||||
import { type ModelInfo } from '@/composables/api/useModels'
|
||||
import type { ModelsGetResponse } from '@memoh/sdk'
|
||||
|
||||
defineProps<{
|
||||
providerId: string | undefined
|
||||
models: ModelInfo[] | undefined
|
||||
models: ModelsGetResponse[] | undefined
|
||||
deleteModelLoading: boolean
|
||||
}>()
|
||||
|
||||
defineEmits<{
|
||||
edit: [model: ModelInfo]
|
||||
edit: [model: ModelsGetResponse]
|
||||
delete: [name: string]
|
||||
}>()
|
||||
</script>
|
||||
|
||||
@@ -100,10 +100,10 @@ import { computed, watch } from 'vue'
|
||||
import { toTypedSchema } from '@vee-validate/zod'
|
||||
import z from 'zod'
|
||||
import { useForm } from 'vee-validate'
|
||||
import { type ProviderInfo } from '@/composables/api/useProviders'
|
||||
import type { ProvidersGetResponse } from '@memoh/sdk'
|
||||
|
||||
const props = defineProps<{
|
||||
provider: Partial<ProviderInfo & { id: string }> | undefined
|
||||
provider: Partial<ProvidersGetResponse> | undefined
|
||||
editLoading: boolean
|
||||
deleteLoading: boolean
|
||||
}>()
|
||||
|
||||
@@ -28,20 +28,32 @@ import {
|
||||
EmptyMedia,
|
||||
EmptyTitle,
|
||||
} from '@memoh/ui'
|
||||
import { type ProviderInfo, CLIENT_TYPES } from '@/composables/api/useProviders'
|
||||
import { getProviders } from '@memoh/sdk'
|
||||
import type { ProvidersGetResponse, ProvidersClientType } from '@memoh/sdk'
|
||||
import AddProvider from '@/components/add-provider/index.vue'
|
||||
import { useProviderList } from '@/composables/api/useProviders'
|
||||
import { useQuery } from '@pinia/colada'
|
||||
|
||||
const CLIENT_TYPES: ProvidersClientType[] = ['openai', 'openai-compat', 'anthropic', 'google', 'ollama']
|
||||
|
||||
const filterProvider = ref('')
|
||||
const { data: providerData } = useProviderList(filterProvider)
|
||||
const { data: providerData } = useQuery({
|
||||
key: () => ['providers', filterProvider.value],
|
||||
query: async () => {
|
||||
const { data } = await getProviders({
|
||||
query: filterProvider.value ? { client_type: filterProvider.value } : undefined,
|
||||
throwOnError: true,
|
||||
})
|
||||
return data
|
||||
},
|
||||
})
|
||||
const queryCache = useQueryCache()
|
||||
|
||||
watch(filterProvider, () => {
|
||||
queryCache.invalidateQueries({ key: ['provider'] })
|
||||
queryCache.invalidateQueries({ key: ['providers'] })
|
||||
}, { immediate: true })
|
||||
|
||||
|
||||
const curProvider = ref<Partial<ProviderInfo> & { id: string }>()
|
||||
const curProvider = ref<ProvidersGetResponse>()
|
||||
provide('curProvider', curProvider)
|
||||
|
||||
const selectProvider = (value: string) => computed(() => {
|
||||
@@ -58,7 +70,7 @@ const curFilterProvider = computed(() => {
|
||||
return []
|
||||
}
|
||||
const searchReg = new RegExp([...searchProviderTxt.value].map(v => `\\u{${v.codePointAt(0)?.toString(16)}}`).join(''), 'u')
|
||||
return providerData.value.filter((provider: Partial<ProviderInfo> & { id: string }) => {
|
||||
return providerData.value.filter((provider: ProvidersGetResponse) => {
|
||||
return searchReg.test(provider.name as string)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -32,22 +32,15 @@ import { Separator } from '@memoh/ui'
|
||||
import ProviderForm from './components/provider-form.vue'
|
||||
import ModelList from './components/model-list.vue'
|
||||
import { computed, inject, provide, reactive, ref, toRef, watch } from 'vue'
|
||||
import { type ModelInfo } from '@/composables/api/useModels'
|
||||
import { type ProviderInfo } from '@/composables/api/useProviders'
|
||||
import {
|
||||
useUpdateProvider,
|
||||
useDeleteProvider,
|
||||
} from '@/composables/api/useProviders'
|
||||
import {
|
||||
useModelList,
|
||||
useDeleteModel,
|
||||
} from '@/composables/api/useModels'
|
||||
import { useQuery, useMutation, useQueryCache } from '@pinia/colada'
|
||||
import { putProvidersById, deleteProvidersById, getProvidersByIdModels, deleteModelsModelByModelId } from '@memoh/sdk'
|
||||
import type { ModelsGetResponse, ProvidersGetResponse } from '@memoh/sdk'
|
||||
|
||||
// ---- Model 编辑状态(provide 给 CreateModel) ----
|
||||
const openModel = reactive<{
|
||||
state: boolean
|
||||
title: 'title' | 'edit'
|
||||
curState: ModelInfo | null
|
||||
curState: ModelsGetResponse | null
|
||||
}>({
|
||||
state: false,
|
||||
title: 'title',
|
||||
@@ -58,23 +51,61 @@ provide('openModel', toRef(openModel, 'state'))
|
||||
provide('openModelTitle', toRef(openModel, 'title'))
|
||||
provide('openModelState', toRef(openModel, 'curState'))
|
||||
|
||||
function handleEditModel(model: ModelInfo) {
|
||||
function handleEditModel(model: ModelsGetResponse) {
|
||||
openModel.state = true
|
||||
openModel.title = 'edit'
|
||||
openModel.curState = { ...model }
|
||||
}
|
||||
|
||||
// ---- 当前 Provider ----
|
||||
const curProvider = inject('curProvider', ref<Partial<ProviderInfo & { id: string }>>())
|
||||
const curProvider = inject('curProvider', ref<ProvidersGetResponse>())
|
||||
const curProviderId = computed(() => curProvider.value?.id)
|
||||
|
||||
// ---- API Hooks ----
|
||||
const { mutate: deleteProvider, isLoading: deleteLoading } = useDeleteProvider(curProviderId)
|
||||
const { mutate: changeProvider, isLoading: editLoading } = useUpdateProvider(curProviderId)
|
||||
const { mutate: deleteModel, isLoading: deleteModelLoading } = useDeleteModel()
|
||||
const { data: modelDataList, invalidate: invalidateModels } = useModelList(curProviderId)
|
||||
const queryCache = useQueryCache()
|
||||
|
||||
const { mutate: deleteProvider, isLoading: deleteLoading } = useMutation({
|
||||
mutation: async () => {
|
||||
if (!curProviderId.value) return
|
||||
await deleteProvidersById({ path: { id: curProviderId.value }, throwOnError: true })
|
||||
},
|
||||
onSettled: () => queryCache.invalidateQueries({ key: ['providers'] }),
|
||||
})
|
||||
|
||||
const { mutate: changeProvider, isLoading: editLoading } = useMutation({
|
||||
mutation: async (data: Record<string, unknown>) => {
|
||||
if (!curProviderId.value) return
|
||||
const { data: result } = await putProvidersById({
|
||||
path: { id: curProviderId.value },
|
||||
body: data as any,
|
||||
throwOnError: true,
|
||||
})
|
||||
return result
|
||||
},
|
||||
onSettled: () => queryCache.invalidateQueries({ key: ['providers'] }),
|
||||
})
|
||||
|
||||
const { mutate: deleteModel, isLoading: deleteModelLoading } = useMutation({
|
||||
mutation: async (modelName: string) => {
|
||||
await deleteModelsModelByModelId({ path: { modelId: modelName }, throwOnError: true })
|
||||
},
|
||||
onSettled: () => queryCache.invalidateQueries({ key: ['provider-models'] }),
|
||||
})
|
||||
|
||||
const { data: modelDataList } = useQuery({
|
||||
key: () => ['provider-models', curProviderId.value ?? ''],
|
||||
query: async () => {
|
||||
if (!curProviderId.value) return []
|
||||
const { data } = await getProvidersByIdModels({
|
||||
path: { id: curProviderId.value },
|
||||
throwOnError: true,
|
||||
})
|
||||
return data
|
||||
},
|
||||
enabled: () => !!curProviderId.value,
|
||||
})
|
||||
|
||||
watch(curProvider, () => {
|
||||
invalidateModels()
|
||||
queryCache.invalidateQueries({ key: ['provider-models'] })
|
||||
}, { immediate: true })
|
||||
</script>
|
||||
|
||||
@@ -104,7 +104,7 @@ import {
|
||||
} from '@memoh/ui'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useUserStore } from '../../store/User'
|
||||
import { useUserStore } from '@/store/user'
|
||||
import { useSettingsStore } from '@/store/settings'
|
||||
import type { Locale } from '@/i18n'
|
||||
|
||||
|
||||
Generated
+5
-1
@@ -144,7 +144,11 @@ importers:
|
||||
specifier: latest
|
||||
version: 1.3.8
|
||||
|
||||
packages/sdk: {}
|
||||
packages/sdk:
|
||||
dependencies:
|
||||
'@pinia/colada':
|
||||
specifier: '>=0.21.0'
|
||||
version: 0.21.2(pinia@3.0.4(typescript@5.9.3)(vue@3.5.26(typescript@5.9.3)))(vue@3.5.26(typescript@5.9.3))
|
||||
|
||||
packages/ui:
|
||||
dependencies:
|
||||
|
||||
Reference in New Issue
Block a user