Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

feat: add AI conversation management endpoints and update related schemas

LinkinStarsf403eadb2c8b
diff --git a/docs/docs.go b/docs/docs.go
index 0cd06429..57a23d43 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -50,6 +50,297 @@ const docTemplate = `{
"responses": {}
}
},
+ "/answer/admin/api/ai-config": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "get AI configuration",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "get AI configuration",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.SiteAIResp"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "update AI configuration",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "update AI configuration",
+ "parameters": [
+ {
+ "description": "AI config",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.SiteAIReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
+ "/answer/admin/api/ai-models": {
+ "post": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "get AI models",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "get AI models",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.GetAIModelResp"
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "/answer/admin/api/ai-provider": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "get AI provider configuration",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "get AI provider configuration",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.GetAIProviderResp"
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "/answer/admin/api/ai/conversation": {
+ "get": {
+ "description": "get conversation detail for admin",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "ai-conversation-admin"
+ ],
+ "summary": "get conversation detail for admin",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "conversation id",
+ "name": "conversation_id",
+ "in": "query",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.AIConversationAdminDetailResp"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ "delete": {
+ "description": "delete conversation and its related records for admin",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "ai-conversation-admin"
+ ],
+ "summary": "delete conversation for admin",
+ "parameters": [
+ {
+ "description": "apikey",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.AIConversationAdminDeleteReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
+ "/answer/admin/api/ai/conversation/page": {
+ "get": {
+ "description": "get conversation list for admin",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "ai-conversation-admin"
+ ],
+ "summary": "get conversation list for admin",
+ "parameters": [
+ {
+ "type": "integer",
+ "description": "page",
+ "name": "page",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "page size",
+ "name": "page_size",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/pager.PageModel"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "list": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.AIConversationAdminListItem"
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
"/answer/admin/api/answer/page": {
"get": {
"security": [
@@ -132,23 +423,179 @@ const docTemplate = `{
"tags": [
"admin"
],
- "summary": "update answer status",
- "parameters": [
- {
- "description": "AdminUpdateAnswerStatusReq",
- "name": "data",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/schema.AdminUpdateAnswerStatusReq"
- }
- }
- ],
+ "summary": "update answer status",
+ "parameters": [
+ {
+ "description": "AdminUpdateAnswerStatusReq",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.AdminUpdateAnswerStatusReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
+ "/answer/admin/api/api-key": {
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "update apikey",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "update apikey",
+ "parameters": [
+ {
+ "description": "apikey",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.UpdateAPIKeyReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ },
+ "post": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "add apikey",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "add apikey",
+ "parameters": [
+ {
+ "description": "apikey",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.AddAPIKeyReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.AddAPIKeyResp"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ "delete": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "delete apikey",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "delete apikey",
+ "parameters": [
+ {
+ "description": "apikey",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.DeleteAPIKeyReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
+ "/answer/admin/api/api-key/all": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "get all api keys",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "get all api keys",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/handler.RespBody"
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.GetAPIKeyResp"
+ }
+ }
+ }
+ }
+ ]
}
}
}
@@ -359,6 +806,77 @@ const docTemplate = `{
}
}
},
+ "/answer/admin/api/mcp-config": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "get MCP configuration",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "get MCP configuration",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.SiteMCPResp"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "update MCP configuration",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "update MCP configuration",
+ "parameters": [
+ {
+ "description": "MCP config",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.SiteMCPReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
"/answer/admin/api/plugin/config": {
"get": {
"security": [
@@ -2251,15 +2769,178 @@ const docTemplate = `{
"in": "query"
},
{
- "enum": [
- "suspended",
- "deleted",
- "inactive"
- ],
+ "enum": [
+ "suspended",
+ "deleted",
+ "inactive"
+ ],
+ "type": "string",
+ "description": "user status",
+ "name": "status",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/pager.PageModel"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "records": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.GetUserPageResp"
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "/answer/api/v1/activity/timeline": {
+ "get": {
+ "description": "get object timeline",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Comment"
+ ],
+ "summary": "get object timeline",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "object id",
+ "name": "object_id",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "tag slug name",
+ "name": "tag_slug_name",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "question",
+ "answer",
+ "tag"
+ ],
+ "type": "string",
+ "description": "object type",
+ "name": "object_type",
+ "in": "query"
+ },
+ {
+ "type": "boolean",
+ "description": "is show vote",
+ "name": "show_vote",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.GetObjectTimelineResp"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "/answer/api/v1/activity/timeline/detail": {
+ "get": {
+ "description": "get object timeline detail",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Comment"
+ ],
+ "summary": "get object timeline detail",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "revision id",
+ "name": "revision_id",
+ "in": "query",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.GetObjectTimelineResp"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "/answer/api/v1/ai/conversation": {
+ "get": {
+ "description": "get conversation detail",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "ai-conversation"
+ ],
+ "summary": "get conversation detail",
+ "parameters": [
+ {
"type": "string",
- "description": "user status",
- "name": "status",
- "in": "query"
+ "description": "conversation id",
+ "name": "conversation_id",
+ "in": "query",
+ "required": true
}
],
"responses": {
@@ -2274,22 +2955,7 @@ const docTemplate = `{
"type": "object",
"properties": {
"data": {
- "allOf": [
- {
- "$ref": "#/definitions/pager.PageModel"
- },
- {
- "type": "object",
- "properties": {
- "records": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/schema.GetUserPageResp"
- }
- }
- }
- }
- ]
+ "$ref": "#/definitions/schema.AIConversationDetailResp"
}
}
}
@@ -2299,44 +2965,30 @@ const docTemplate = `{
}
}
},
- "/answer/api/v1/activity/timeline": {
+ "/answer/api/v1/ai/conversation/page": {
"get": {
- "description": "get object timeline",
+ "description": "get conversation list",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "Comment"
+ "ai-conversation"
],
- "summary": "get object timeline",
+ "summary": "get conversation list",
"parameters": [
{
- "type": "string",
- "description": "object id",
- "name": "object_id",
- "in": "query"
- },
- {
- "type": "string",
- "description": "tag slug name",
- "name": "tag_slug_name",
- "in": "query"
- },
- {
- "enum": [
- "question",
- "answer",
- "tag"
- ],
- "type": "string",
- "description": "object type",
- "name": "object_type",
+ "type": "integer",
+ "description": "page",
+ "name": "page",
"in": "query"
},
{
- "type": "boolean",
- "description": "is show vote",
- "name": "show_vote",
+ "type": "integer",
+ "description": "page size",
+ "name": "page_size",
"in": "query"
}
],
@@ -2352,7 +3004,22 @@ const docTemplate = `{
"type": "object",
"properties": {
"data": {
- "$ref": "#/definitions/schema.GetObjectTimelineResp"
+ "allOf": [
+ {
+ "$ref": "#/definitions/pager.PageModel"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "list": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.AIConversationListItem"
+ }
+ }
+ }
+ }
+ ]
}
}
}
@@ -2362,42 +3029,35 @@ const docTemplate = `{
}
}
},
- "/answer/api/v1/activity/timeline/detail": {
- "get": {
- "description": "get object timeline detail",
+ "/answer/api/v1/ai/conversation/vote": {
+ "post": {
+ "description": "vote record",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "Comment"
+ "ai-conversation"
],
- "summary": "get object timeline detail",
+ "summary": "vote record",
"parameters": [
{
- "type": "string",
- "description": "revision id",
- "name": "revision_id",
- "in": "query",
- "required": true
+ "description": "vote request",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.AIConversationVoteReq"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "allOf": [
- {
- "$ref": "#/definitions/handler.RespBody"
- },
- {
- "type": "object",
- "properties": {
- "data": {
- "$ref": "#/definitions/schema.GetObjectTimelineResp"
- }
- }
- }
- ]
+ "$ref": "#/definitions/handler.RespBody"
}
}
}
@@ -7915,99 +8575,269 @@ const docTemplate = `{
"ssl_cert": {
"type": "string"
},
- "ssl_enabled": {
- "type": "boolean"
+ "ssl_enabled": {
+ "type": "boolean"
+ },
+ "ssl_key": {
+ "type": "string"
+ },
+ "ssl_mode": {
+ "type": "string"
+ },
+ "ssl_root_cert": {
+ "type": "string"
+ }
+ }
+ },
+ "install.InitBaseInfoReq": {
+ "type": "object",
+ "required": [
+ "contact_email",
+ "email",
+ "external_content_display",
+ "lang",
+ "name",
+ "password",
+ "site_name",
+ "site_url"
+ ],
+ "properties": {
+ "contact_email": {
+ "type": "string",
+ "maxLength": 500
+ },
+ "email": {
+ "type": "string",
+ "maxLength": 500
+ },
+ "external_content_display": {
+ "type": "string",
+ "enum": [
+ "always_display",
+ "ask_before_display"
+ ]
+ },
+ "lang": {
+ "type": "string",
+ "maxLength": 30
+ },
+ "login_required": {
+ "type": "boolean"
+ },
+ "name": {
+ "type": "string",
+ "maxLength": 30,
+ "minLength": 2
+ },
+ "password": {
+ "type": "string",
+ "maxLength": 32,
+ "minLength": 8
+ },
+ "site_name": {
+ "type": "string",
+ "maxLength": 30
+ },
+ "site_url": {
+ "type": "string",
+ "maxLength": 512
+ }
+ }
+ },
+ "pager.PageModel": {
+ "type": "object",
+ "properties": {
+ "count": {
+ "type": "integer"
+ },
+ "list": {}
+ }
+ },
+ "plugin.EmbedConfig": {
+ "type": "object",
+ "properties": {
+ "enable": {
+ "type": "boolean"
+ },
+ "platform": {
+ "type": "string"
+ }
+ }
+ },
+ "plugin.RenderConfig": {
+ "type": "object",
+ "properties": {
+ "select_theme": {
+ "type": "string"
+ }
+ }
+ },
+ "schema.AIConversationAdminDeleteReq": {
+ "type": "object",
+ "required": [
+ "conversation_id"
+ ],
+ "properties": {
+ "conversation_id": {
+ "type": "string"
+ }
+ }
+ },
+ "schema.AIConversationAdminDetailResp": {
+ "type": "object",
+ "properties": {
+ "conversation_id": {
+ "type": "string"
+ },
+ "created_at": {
+ "type": "integer"
+ },
+ "records": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.AIConversationRecord"
+ }
+ },
+ "topic": {
+ "type": "string"
+ },
+ "user_info": {
+ "$ref": "#/definitions/schema.AIConversationUserInfo"
+ }
+ }
+ },
+ "schema.AIConversationAdminListItem": {
+ "type": "object",
+ "properties": {
+ "created_at": {
+ "type": "integer"
+ },
+ "helpful_count": {
+ "type": "integer"
+ },
+ "id": {
+ "type": "string"
+ },
+ "topic": {
+ "type": "string"
+ },
+ "unhelpful_count": {
+ "type": "integer"
+ },
+ "user_info": {
+ "$ref": "#/definitions/schema.AIConversationUserInfo"
+ }
+ }
+ },
+ "schema.AIConversationDetailResp": {
+ "type": "object",
+ "properties": {
+ "conversation_id": {
+ "type": "string"
+ },
+ "created_at": {
+ "type": "integer"
+ },
+ "records": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.AIConversationRecord"
+ }
},
- "ssl_key": {
+ "topic": {
"type": "string"
},
- "ssl_mode": {
+ "updated_at": {
+ "type": "integer"
+ }
+ }
+ },
+ "schema.AIConversationListItem": {
+ "type": "object",
+ "properties": {
+ "conversation_id": {
"type": "string"
},
- "ssl_root_cert": {
+ "created_at": {
+ "type": "integer"
+ },
+ "topic": {
"type": "string"
}
}
},
- "install.InitBaseInfoReq": {
+ "schema.AIConversationRecord": {
"type": "object",
- "required": [
- "contact_email",
- "email",
- "external_content_display",
- "lang",
- "name",
- "password",
- "site_name",
- "site_url"
- ],
"properties": {
- "contact_email": {
- "type": "string",
- "maxLength": 500
- },
- "email": {
- "type": "string",
- "maxLength": 500
- },
- "external_content_display": {
- "type": "string",
- "enum": [
- "always_display",
- "ask_before_display"
- ]
- },
- "lang": {
- "type": "string",
- "maxLength": 30
+ "chat_completion_id": {
+ "type": "string"
},
- "login_required": {
- "type": "boolean"
+ "content": {
+ "type": "string"
},
- "name": {
- "type": "string",
- "maxLength": 30,
- "minLength": 2
+ "created_at": {
+ "type": "integer"
},
- "password": {
- "type": "string",
- "maxLength": 32,
- "minLength": 8
+ "helpful": {
+ "type": "integer"
},
- "site_name": {
- "type": "string",
- "maxLength": 30
+ "role": {
+ "type": "string"
},
- "site_url": {
- "type": "string",
- "maxLength": 512
+ "unhelpful": {
+ "type": "integer"
}
}
},
- "pager.PageModel": {
+ "schema.AIConversationUserInfo": {
"type": "object",
"properties": {
- "count": {
+ "avatar": {
+ "type": "string"
+ },
+ "display_name": {
+ "type": "string"
+ },
+ "id": {
+ "type": "string"
+ },
+ "rank": {
"type": "integer"
},
- "list": {}
+ "username": {
+ "type": "string"
+ }
}
},
- "plugin.EmbedConfig": {
+ "schema.AIConversationVoteReq": {
"type": "object",
+ "required": [
+ "chat_completion_id",
+ "vote_type"
+ ],
"properties": {
- "enable": {
+ "cancel": {
"type": "boolean"
},
- "platform": {
+ "chat_completion_id": {
"type": "string"
+ },
+ "vote_type": {
+ "type": "string",
+ "enum": [
+ "helpful",
+ "unhelpful"
+ ]
}
}
},
- "plugin.RenderConfig": {
+ "schema.AIPromptConfig": {
"type": "object",
"properties": {
- "select_theme": {
+ "en_us": {
+ "type": "string"
+ },
+ "zh_cn": {
"type": "string"
}
}
@@ -8102,6 +8932,34 @@ const docTemplate = `{
}
}
},
+ "schema.AddAPIKeyReq": {
+ "type": "object",
+ "required": [
+ "description",
+ "scope"
+ ],
+ "properties": {
+ "description": {
+ "type": "string",
+ "maxLength": 150
+ },
+ "scope": {
+ "type": "string",
+ "enum": [
+ "read-only",
+ "global"
+ ]
+ }
+ }
+ },
+ "schema.AddAPIKeyResp": {
+ "type": "object",
+ "properties": {
+ "access_key": {
+ "type": "string"
+ }
+ }
+ },
"schema.AddCommentReq": {
"type": "object",
"required": [
@@ -8582,6 +9440,14 @@ const docTemplate = `{
}
}
},
+ "schema.DeleteAPIKeyReq": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ }
+ }
+ },
"schema.DeletePermanentlyReq": {
"type": "object",
"required": [
@@ -8698,6 +9564,60 @@ const docTemplate = `{
}
}
},
+ "schema.GetAIModelResp": {
+ "type": "object",
+ "properties": {
+ "created": {
+ "type": "integer"
+ },
+ "id": {
+ "type": "string"
+ },
+ "object": {
+ "type": "string"
+ },
+ "owned_by": {
+ "type": "string"
+ }
+ }
+ },
+ "schema.GetAIProviderResp": {
+ "type": "object",
+ "properties": {
+ "default_api_host": {
+ "type": "string"
+ },
+ "display_name": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ }
+ }
+ },
+ "schema.GetAPIKeyResp": {
+ "type": "object",
+ "properties": {
+ "access_key": {
+ "type": "string"
+ },
+ "created_at": {
+ "type": "integer"
+ },
+ "description": {
+ "type": "string"
+ },
+ "id": {
+ "type": "integer"
+ },
+ "last_used_at": {
+ "type": "integer"
+ },
+ "scope": {
+ "type": "string"
+ }
+ }
+ },
"schema.GetAnswerInfoResp": {
"type": "object",
"properties": {
@@ -10781,6 +11701,69 @@ const docTemplate = `{
}
}
},
+ "schema.SiteAIProvider": {
+ "type": "object",
+ "properties": {
+ "api_host": {
+ "type": "string",
+ "maxLength": 512
+ },
+ "api_key": {
+ "type": "string",
+ "maxLength": 256
+ },
+ "model": {
+ "type": "string",
+ "maxLength": 100
+ },
+ "provider": {
+ "type": "string",
+ "maxLength": 50
+ }
+ }
+ },
+ "schema.SiteAIReq": {
+ "type": "object",
+ "properties": {
+ "ai_providers": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.SiteAIProvider"
+ }
+ },
+ "chosen_provider": {
+ "type": "string",
+ "maxLength": 50
+ },
+ "enabled": {
+ "type": "boolean"
+ },
+ "prompt_config": {
+ "$ref": "#/definitions/schema.AIPromptConfig"
+ }
+ }
+ },
+ "schema.SiteAIResp": {
+ "type": "object",
+ "properties": {
+ "ai_providers": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.SiteAIProvider"
+ }
+ },
+ "chosen_provider": {
+ "type": "string",
+ "maxLength": 50
+ },
+ "enabled": {
+ "type": "boolean"
+ },
+ "prompt_config": {
+ "$ref": "#/definitions/schema.AIPromptConfig"
+ }
+ }
+ },
"schema.SiteAdvancedReq": {
"type": "object",
"properties": {
@@ -10988,6 +11971,9 @@ const docTemplate = `{
"schema.SiteInfoResp": {
"type": "object",
"properties": {
+ "ai_enabled": {
+ "type": "boolean"
+ },
"branding": {
"$ref": "#/definitions/schema.SiteBrandingResp"
},
@@ -11003,6 +11989,9 @@ const docTemplate = `{
"login": {
"$ref": "#/definitions/schema.SiteLoginResp"
},
+ "mcp_enabled": {
+ "type": "boolean"
+ },
"revision": {
"type": "string"
},
@@ -11127,6 +12116,31 @@ const docTemplate = `{
}
}
},
+ "schema.SiteMCPReq": {
+ "type": "object",
+ "properties": {
+ "enabled": {
+ "type": "boolean"
+ }
+ }
+ },
+ "schema.SiteMCPResp": {
+ "type": "object",
+ "properties": {
+ "enabled": {
+ "type": "boolean"
+ },
+ "http_header": {
+ "type": "string"
+ },
+ "type": {
+ "type": "string"
+ },
+ "url": {
+ "type": "string"
+ }
+ }
+ },
"schema.SitePoliciesReq": {
"type": "object",
"properties": {
@@ -11631,6 +12645,22 @@ const docTemplate = `{
}
}
},
+ "schema.UpdateAPIKeyReq": {
+ "type": "object",
+ "required": [
+ "description",
+ "id"
+ ],
+ "properties": {
+ "description": {
+ "type": "string",
+ "maxLength": 150
+ },
+ "id": {
+ "type": "integer"
+ }
+ }
+ },
"schema.UpdateBadgeStatusReq": {
"type": "object",
"required": [
diff --git a/docs/swagger.json b/docs/swagger.json
index a59867f9..dac2b38f 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -23,6 +23,297 @@
"responses": {}
}
},
+ "/answer/admin/api/ai-config": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "get AI configuration",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "get AI configuration",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.SiteAIResp"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "update AI configuration",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "update AI configuration",
+ "parameters": [
+ {
+ "description": "AI config",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.SiteAIReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
+ "/answer/admin/api/ai-models": {
+ "post": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "get AI models",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "get AI models",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.GetAIModelResp"
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "/answer/admin/api/ai-provider": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "get AI provider configuration",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "get AI provider configuration",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.GetAIProviderResp"
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "/answer/admin/api/ai/conversation": {
+ "get": {
+ "description": "get conversation detail for admin",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "ai-conversation-admin"
+ ],
+ "summary": "get conversation detail for admin",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "conversation id",
+ "name": "conversation_id",
+ "in": "query",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.AIConversationAdminDetailResp"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ "delete": {
+ "description": "delete conversation and its related records for admin",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "ai-conversation-admin"
+ ],
+ "summary": "delete conversation for admin",
+ "parameters": [
+ {
+ "description": "apikey",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.AIConversationAdminDeleteReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
+ "/answer/admin/api/ai/conversation/page": {
+ "get": {
+ "description": "get conversation list for admin",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "ai-conversation-admin"
+ ],
+ "summary": "get conversation list for admin",
+ "parameters": [
+ {
+ "type": "integer",
+ "description": "page",
+ "name": "page",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "page size",
+ "name": "page_size",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/pager.PageModel"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "list": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.AIConversationAdminListItem"
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
"/answer/admin/api/answer/page": {
"get": {
"security": [
@@ -105,23 +396,179 @@
"tags": [
"admin"
],
- "summary": "update answer status",
- "parameters": [
- {
- "description": "AdminUpdateAnswerStatusReq",
- "name": "data",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/schema.AdminUpdateAnswerStatusReq"
- }
- }
- ],
+ "summary": "update answer status",
+ "parameters": [
+ {
+ "description": "AdminUpdateAnswerStatusReq",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.AdminUpdateAnswerStatusReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
+ "/answer/admin/api/api-key": {
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "update apikey",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "update apikey",
+ "parameters": [
+ {
+ "description": "apikey",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.UpdateAPIKeyReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ },
+ "post": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "add apikey",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "add apikey",
+ "parameters": [
+ {
+ "description": "apikey",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.AddAPIKeyReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.AddAPIKeyResp"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ "delete": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "delete apikey",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "delete apikey",
+ "parameters": [
+ {
+ "description": "apikey",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.DeleteAPIKeyReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
+ "/answer/admin/api/api-key/all": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "get all api keys",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "get all api keys",
"responses": {
"200": {
"description": "OK",
"schema": {
- "$ref": "#/definitions/handler.RespBody"
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.GetAPIKeyResp"
+ }
+ }
+ }
+ }
+ ]
}
}
}
@@ -332,6 +779,77 @@
}
}
},
+ "/answer/admin/api/mcp-config": {
+ "get": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "get MCP configuration",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "get MCP configuration",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.SiteMCPResp"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ },
+ "put": {
+ "security": [
+ {
+ "ApiKeyAuth": []
+ }
+ ],
+ "description": "update MCP configuration",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "summary": "update MCP configuration",
+ "parameters": [
+ {
+ "description": "MCP config",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.SiteMCPReq"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "$ref": "#/definitions/handler.RespBody"
+ }
+ }
+ }
+ }
+ },
"/answer/admin/api/plugin/config": {
"get": {
"security": [
@@ -2224,15 +2742,178 @@
"in": "query"
},
{
- "enum": [
- "suspended",
- "deleted",
- "inactive"
- ],
+ "enum": [
+ "suspended",
+ "deleted",
+ "inactive"
+ ],
+ "type": "string",
+ "description": "user status",
+ "name": "status",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/pager.PageModel"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "records": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.GetUserPageResp"
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "/answer/api/v1/activity/timeline": {
+ "get": {
+ "description": "get object timeline",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Comment"
+ ],
+ "summary": "get object timeline",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "object id",
+ "name": "object_id",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "tag slug name",
+ "name": "tag_slug_name",
+ "in": "query"
+ },
+ {
+ "enum": [
+ "question",
+ "answer",
+ "tag"
+ ],
+ "type": "string",
+ "description": "object type",
+ "name": "object_type",
+ "in": "query"
+ },
+ {
+ "type": "boolean",
+ "description": "is show vote",
+ "name": "show_vote",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.GetObjectTimelineResp"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "/answer/api/v1/activity/timeline/detail": {
+ "get": {
+ "description": "get object timeline detail",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "Comment"
+ ],
+ "summary": "get object timeline detail",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "revision id",
+ "name": "revision_id",
+ "in": "query",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/handler.RespBody"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/schema.GetObjectTimelineResp"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "/answer/api/v1/ai/conversation": {
+ "get": {
+ "description": "get conversation detail",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "ai-conversation"
+ ],
+ "summary": "get conversation detail",
+ "parameters": [
+ {
"type": "string",
- "description": "user status",
- "name": "status",
- "in": "query"
+ "description": "conversation id",
+ "name": "conversation_id",
+ "in": "query",
+ "required": true
}
],
"responses": {
@@ -2247,22 +2928,7 @@
"type": "object",
"properties": {
"data": {
- "allOf": [
- {
- "$ref": "#/definitions/pager.PageModel"
- },
- {
- "type": "object",
- "properties": {
- "records": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/schema.GetUserPageResp"
- }
- }
- }
- }
- ]
+ "$ref": "#/definitions/schema.AIConversationDetailResp"
}
}
}
@@ -2272,44 +2938,30 @@
}
}
},
- "/answer/api/v1/activity/timeline": {
+ "/answer/api/v1/ai/conversation/page": {
"get": {
- "description": "get object timeline",
+ "description": "get conversation list",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "Comment"
+ "ai-conversation"
],
- "summary": "get object timeline",
+ "summary": "get conversation list",
"parameters": [
{
- "type": "string",
- "description": "object id",
- "name": "object_id",
- "in": "query"
- },
- {
- "type": "string",
- "description": "tag slug name",
- "name": "tag_slug_name",
- "in": "query"
- },
- {
- "enum": [
- "question",
- "answer",
- "tag"
- ],
- "type": "string",
- "description": "object type",
- "name": "object_type",
+ "type": "integer",
+ "description": "page",
+ "name": "page",
"in": "query"
},
{
- "type": "boolean",
- "description": "is show vote",
- "name": "show_vote",
+ "type": "integer",
+ "description": "page size",
+ "name": "page_size",
"in": "query"
}
],
@@ -2325,7 +2977,22 @@
"type": "object",
"properties": {
"data": {
- "$ref": "#/definitions/schema.GetObjectTimelineResp"
+ "allOf": [
+ {
+ "$ref": "#/definitions/pager.PageModel"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "list": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.AIConversationListItem"
+ }
+ }
+ }
+ }
+ ]
}
}
}
@@ -2335,42 +3002,35 @@
}
}
},
- "/answer/api/v1/activity/timeline/detail": {
- "get": {
- "description": "get object timeline detail",
+ "/answer/api/v1/ai/conversation/vote": {
+ "post": {
+ "description": "vote record",
+ "consumes": [
+ "application/json"
+ ],
"produces": [
"application/json"
],
"tags": [
- "Comment"
+ "ai-conversation"
],
- "summary": "get object timeline detail",
+ "summary": "vote record",
"parameters": [
{
- "type": "string",
- "description": "revision id",
- "name": "revision_id",
- "in": "query",
- "required": true
+ "description": "vote request",
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/schema.AIConversationVoteReq"
+ }
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
- "allOf": [
- {
- "$ref": "#/definitions/handler.RespBody"
- },
- {
- "type": "object",
- "properties": {
- "data": {
- "$ref": "#/definitions/schema.GetObjectTimelineResp"
- }
- }
- }
- ]
+ "$ref": "#/definitions/handler.RespBody"
}
}
}
@@ -7888,99 +8548,269 @@
"ssl_cert": {
"type": "string"
},
- "ssl_enabled": {
- "type": "boolean"
+ "ssl_enabled": {
+ "type": "boolean"
+ },
+ "ssl_key": {
+ "type": "string"
+ },
+ "ssl_mode": {
+ "type": "string"
+ },
+ "ssl_root_cert": {
+ "type": "string"
+ }
+ }
+ },
+ "install.InitBaseInfoReq": {
+ "type": "object",
+ "required": [
+ "contact_email",
+ "email",
+ "external_content_display",
+ "lang",
+ "name",
+ "password",
+ "site_name",
+ "site_url"
+ ],
+ "properties": {
+ "contact_email": {
+ "type": "string",
+ "maxLength": 500
+ },
+ "email": {
+ "type": "string",
+ "maxLength": 500
+ },
+ "external_content_display": {
+ "type": "string",
+ "enum": [
+ "always_display",
+ "ask_before_display"
+ ]
+ },
+ "lang": {
+ "type": "string",
+ "maxLength": 30
+ },
+ "login_required": {
+ "type": "boolean"
+ },
+ "name": {
+ "type": "string",
+ "maxLength": 30,
+ "minLength": 2
+ },
+ "password": {
+ "type": "string",
+ "maxLength": 32,
+ "minLength": 8
+ },
+ "site_name": {
+ "type": "string",
+ "maxLength": 30
+ },
+ "site_url": {
+ "type": "string",
+ "maxLength": 512
+ }
+ }
+ },
+ "pager.PageModel": {
+ "type": "object",
+ "properties": {
+ "count": {
+ "type": "integer"
+ },
+ "list": {}
+ }
+ },
+ "plugin.EmbedConfig": {
+ "type": "object",
+ "properties": {
+ "enable": {
+ "type": "boolean"
+ },
+ "platform": {
+ "type": "string"
+ }
+ }
+ },
+ "plugin.RenderConfig": {
+ "type": "object",
+ "properties": {
+ "select_theme": {
+ "type": "string"
+ }
+ }
+ },
+ "schema.AIConversationAdminDeleteReq": {
+ "type": "object",
+ "required": [
+ "conversation_id"
+ ],
+ "properties": {
+ "conversation_id": {
+ "type": "string"
+ }
+ }
+ },
+ "schema.AIConversationAdminDetailResp": {
+ "type": "object",
+ "properties": {
+ "conversation_id": {
+ "type": "string"
+ },
+ "created_at": {
+ "type": "integer"
+ },
+ "records": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.AIConversationRecord"
+ }
+ },
+ "topic": {
+ "type": "string"
+ },
+ "user_info": {
+ "$ref": "#/definitions/schema.AIConversationUserInfo"
+ }
+ }
+ },
+ "schema.AIConversationAdminListItem": {
+ "type": "object",
+ "properties": {
+ "created_at": {
+ "type": "integer"
+ },
+ "helpful_count": {
+ "type": "integer"
+ },
+ "id": {
+ "type": "string"
+ },
+ "topic": {
+ "type": "string"
+ },
+ "unhelpful_count": {
+ "type": "integer"
+ },
+ "user_info": {
+ "$ref": "#/definitions/schema.AIConversationUserInfo"
+ }
+ }
+ },
+ "schema.AIConversationDetailResp": {
+ "type": "object",
+ "properties": {
+ "conversation_id": {
+ "type": "string"
+ },
+ "created_at": {
+ "type": "integer"
+ },
+ "records": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.AIConversationRecord"
+ }
},
- "ssl_key": {
+ "topic": {
"type": "string"
},
- "ssl_mode": {
+ "updated_at": {
+ "type": "integer"
+ }
+ }
+ },
+ "schema.AIConversationListItem": {
+ "type": "object",
+ "properties": {
+ "conversation_id": {
"type": "string"
},
- "ssl_root_cert": {
+ "created_at": {
+ "type": "integer"
+ },
+ "topic": {
"type": "string"
}
}
},
- "install.InitBaseInfoReq": {
+ "schema.AIConversationRecord": {
"type": "object",
- "required": [
- "contact_email",
- "email",
- "external_content_display",
- "lang",
- "name",
- "password",
- "site_name",
- "site_url"
- ],
"properties": {
- "contact_email": {
- "type": "string",
- "maxLength": 500
- },
- "email": {
- "type": "string",
- "maxLength": 500
- },
- "external_content_display": {
- "type": "string",
- "enum": [
- "always_display",
- "ask_before_display"
- ]
- },
- "lang": {
- "type": "string",
- "maxLength": 30
+ "chat_completion_id": {
+ "type": "string"
},
- "login_required": {
- "type": "boolean"
+ "content": {
+ "type": "string"
},
- "name": {
- "type": "string",
- "maxLength": 30,
- "minLength": 2
+ "created_at": {
+ "type": "integer"
},
- "password": {
- "type": "string",
- "maxLength": 32,
- "minLength": 8
+ "helpful": {
+ "type": "integer"
},
- "site_name": {
- "type": "string",
- "maxLength": 30
+ "role": {
+ "type": "string"
},
- "site_url": {
- "type": "string",
- "maxLength": 512
+ "unhelpful": {
+ "type": "integer"
}
}
},
- "pager.PageModel": {
+ "schema.AIConversationUserInfo": {
"type": "object",
"properties": {
- "count": {
+ "avatar": {
+ "type": "string"
+ },
+ "display_name": {
+ "type": "string"
+ },
+ "id": {
+ "type": "string"
+ },
+ "rank": {
"type": "integer"
},
- "list": {}
+ "username": {
+ "type": "string"
+ }
}
},
- "plugin.EmbedConfig": {
+ "schema.AIConversationVoteReq": {
"type": "object",
+ "required": [
+ "chat_completion_id",
+ "vote_type"
+ ],
"properties": {
- "enable": {
+ "cancel": {
"type": "boolean"
},
- "platform": {
+ "chat_completion_id": {
"type": "string"
+ },
+ "vote_type": {
+ "type": "string",
+ "enum": [
+ "helpful",
+ "unhelpful"
+ ]
}
}
},
- "plugin.RenderConfig": {
+ "schema.AIPromptConfig": {
"type": "object",
"properties": {
- "select_theme": {
+ "en_us": {
+ "type": "string"
+ },
+ "zh_cn": {
"type": "string"
}
}
@@ -8075,6 +8905,34 @@
}
}
},
+ "schema.AddAPIKeyReq": {
+ "type": "object",
+ "required": [
+ "description",
+ "scope"
+ ],
+ "properties": {
+ "description": {
+ "type": "string",
+ "maxLength": 150
+ },
+ "scope": {
+ "type": "string",
+ "enum": [
+ "read-only",
+ "global"
+ ]
+ }
+ }
+ },
+ "schema.AddAPIKeyResp": {
+ "type": "object",
+ "properties": {
+ "access_key": {
+ "type": "string"
+ }
+ }
+ },
"schema.AddCommentReq": {
"type": "object",
"required": [
@@ -8555,6 +9413,14 @@
}
}
},
+ "schema.DeleteAPIKeyReq": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ }
+ }
+ },
"schema.DeletePermanentlyReq": {
"type": "object",
"required": [
@@ -8671,6 +9537,60 @@
}
}
},
+ "schema.GetAIModelResp": {
+ "type": "object",
+ "properties": {
+ "created": {
+ "type": "integer"
+ },
+ "id": {
+ "type": "string"
+ },
+ "object": {
+ "type": "string"
+ },
+ "owned_by": {
+ "type": "string"
+ }
+ }
+ },
+ "schema.GetAIProviderResp": {
+ "type": "object",
+ "properties": {
+ "default_api_host": {
+ "type": "string"
+ },
+ "display_name": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ }
+ }
+ },
+ "schema.GetAPIKeyResp": {
+ "type": "object",
+ "properties": {
+ "access_key": {
+ "type": "string"
+ },
+ "created_at": {
+ "type": "integer"
+ },
+ "description": {
+ "type": "string"
+ },
+ "id": {
+ "type": "integer"
+ },
+ "last_used_at": {
+ "type": "integer"
+ },
+ "scope": {
+ "type": "string"
+ }
+ }
+ },
"schema.GetAnswerInfoResp": {
"type": "object",
"properties": {
@@ -10754,6 +11674,69 @@
}
}
},
+ "schema.SiteAIProvider": {
+ "type": "object",
+ "properties": {
+ "api_host": {
+ "type": "string",
+ "maxLength": 512
+ },
+ "api_key": {
+ "type": "string",
+ "maxLength": 256
+ },
+ "model": {
+ "type": "string",
+ "maxLength": 100
+ },
+ "provider": {
+ "type": "string",
+ "maxLength": 50
+ }
+ }
+ },
+ "schema.SiteAIReq": {
+ "type": "object",
+ "properties": {
+ "ai_providers": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.SiteAIProvider"
+ }
+ },
+ "chosen_provider": {
+ "type": "string",
+ "maxLength": 50
+ },
+ "enabled": {
+ "type": "boolean"
+ },
+ "prompt_config": {
+ "$ref": "#/definitions/schema.AIPromptConfig"
+ }
+ }
+ },
+ "schema.SiteAIResp": {
+ "type": "object",
+ "properties": {
+ "ai_providers": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/schema.SiteAIProvider"
+ }
+ },
+ "chosen_provider": {
+ "type": "string",
+ "maxLength": 50
+ },
+ "enabled": {
+ "type": "boolean"
+ },
+ "prompt_config": {
+ "$ref": "#/definitions/schema.AIPromptConfig"
+ }
+ }
+ },
"schema.SiteAdvancedReq": {
"type": "object",
"properties": {
@@ -10961,6 +11944,9 @@
"schema.SiteInfoResp": {
"type": "object",
"properties": {
+ "ai_enabled": {
+ "type": "boolean"
+ },
"branding": {
"$ref": "#/definitions/schema.SiteBrandingResp"
},
@@ -10976,6 +11962,9 @@
"login": {
"$ref": "#/definitions/schema.SiteLoginResp"
},
+ "mcp_enabled": {
+ "type": "boolean"
+ },
"revision": {
"type": "string"
},
@@ -11100,6 +12089,31 @@
}
}
},
+ "schema.SiteMCPReq": {
+ "type": "object",
+ "properties": {
+ "enabled": {
+ "type": "boolean"
+ }
+ }
+ },
+ "schema.SiteMCPResp": {
+ "type": "object",
+ "properties": {
+ "enabled": {
+ "type": "boolean"
+ },
+ "http_header": {
+ "type": "string"
+ },
+ "type": {
+ "type": "string"
+ },
+ "url": {
+ "type": "string"
+ }
+ }
+ },
"schema.SitePoliciesReq": {
"type": "object",
"properties": {
@@ -11604,6 +12618,22 @@
}
}
},
+ "schema.UpdateAPIKeyReq": {
+ "type": "object",
+ "required": [
+ "description",
+ "id"
+ ],
+ "properties": {
+ "description": {
+ "type": "string",
+ "maxLength": 150
+ },
+ "id": {
+ "type": "integer"
+ }
+ }
+ },
"schema.UpdateBadgeStatusReq": {
"type": "object",
"required": [
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 426f5332..7a7adb68 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -157,6 +157,117 @@ definitions:
select_theme:
type: string
type: object
+ schema.AIConversationAdminDeleteReq:
+ properties:
+ conversation_id:
+ type: string
+ required:
+ - conversation_id
+ type: object
+ schema.AIConversationAdminDetailResp:
+ properties:
+ conversation_id:
+ type: string
+ created_at:
+ type: integer
+ records:
+ items:
+ $ref: '#/definitions/schema.AIConversationRecord'
+ type: array
+ topic:
+ type: string
+ user_info:
+ $ref: '#/definitions/schema.AIConversationUserInfo'
+ type: object
+ schema.AIConversationAdminListItem:
+ properties:
+ created_at:
+ type: integer
+ helpful_count:
+ type: integer
+ id:
+ type: string
+ topic:
+ type: string
+ unhelpful_count:
+ type: integer
+ user_info:
+ $ref: '#/definitions/schema.AIConversationUserInfo'
+ type: object
+ schema.AIConversationDetailResp:
+ properties:
+ conversation_id:
+ type: string
+ created_at:
+ type: integer
+ records:
+ items:
+ $ref: '#/definitions/schema.AIConversationRecord'
+ type: array
+ topic:
+ type: string
+ updated_at:
+ type: integer
+ type: object
+ schema.AIConversationListItem:
+ properties:
+ conversation_id:
+ type: string
+ created_at:
+ type: integer
+ topic:
+ type: string
+ type: object
+ schema.AIConversationRecord:
+ properties:
+ chat_completion_id:
+ type: string
+ content:
+ type: string
+ created_at:
+ type: integer
+ helpful:
+ type: integer
+ role:
+ type: string
+ unhelpful:
+ type: integer
+ type: object
+ schema.AIConversationUserInfo:
+ properties:
+ avatar:
+ type: string
+ display_name:
+ type: string
+ id:
+ type: string
+ rank:
+ type: integer
+ username:
+ type: string
+ type: object
+ schema.AIConversationVoteReq:
+ properties:
+ cancel:
+ type: boolean
+ chat_completion_id:
+ type: string
+ vote_type:
+ enum:
+ - helpful
+ - unhelpful
+ type: string
+ required:
+ - chat_completion_id
+ - vote_type
+ type: object
+ schema.AIPromptConfig:
+ properties:
+ en_us:
+ type: string
+ zh_cn:
+ type: string
+ type: object
schema.AcceptAnswerReq:
properties:
answer_id:
@@ -216,6 +327,25 @@ definitions:
verify:
type: boolean
type: object
+ schema.AddAPIKeyReq:
+ properties:
+ description:
+ maxLength: 150
+ type: string
+ scope:
+ enum:
+ - read-only
+ - global
+ type: string
+ required:
+ - description
+ - scope
+ type: object
+ schema.AddAPIKeyResp:
+ properties:
+ access_key:
+ type: string
+ type: object
schema.AddCommentReq:
properties:
captcha_code:
@@ -546,6 +676,11 @@ definitions:
name:
type: string
type: object
+ schema.DeleteAPIKeyReq:
+ properties:
+ id:
+ type: integer
+ type: object
schema.DeletePermanentlyReq:
properties:
type:
@@ -629,6 +764,41 @@ definitions:
description: if user is followed object will be true,otherwise false
type: boolean
type: object
+ schema.GetAIModelResp:
+ properties:
+ created:
+ type: integer
+ id:
+ type: string
+ object:
+ type: string
+ owned_by:
+ type: string
+ type: object
+ schema.GetAIProviderResp:
+ properties:
+ default_api_host:
+ type: string
+ display_name:
+ type: string
+ name:
+ type: string
+ type: object
+ schema.GetAPIKeyResp:
+ properties:
+ access_key:
+ type: string
+ created_at:
+ type: integer
+ description:
+ type: string
+ id:
+ type: integer
+ last_used_at:
+ type: integer
+ scope:
+ type: string
+ type: object
schema.GetAnswerInfoResp:
properties:
info:
@@ -2072,6 +2242,49 @@ definitions:
required:
- user_id
type: object
+ schema.SiteAIProvider:
+ properties:
+ api_host:
+ maxLength: 512
+ type: string
+ api_key:
+ maxLength: 256
+ type: string
+ model:
+ maxLength: 100
+ type: string
+ provider:
+ maxLength: 50
+ type: string
+ type: object
+ schema.SiteAIReq:
+ properties:
+ ai_providers:
+ items:
+ $ref: '#/definitions/schema.SiteAIProvider'
+ type: array
+ chosen_provider:
+ maxLength: 50
+ type: string
+ enabled:
+ type: boolean
+ prompt_config:
+ $ref: '#/definitions/schema.AIPromptConfig'
+ type: object
+ schema.SiteAIResp:
+ properties:
+ ai_providers:
+ items:
+ $ref: '#/definitions/schema.SiteAIProvider'
+ type: array
+ chosen_provider:
+ maxLength: 50
+ type: string
+ enabled:
+ type: boolean
+ prompt_config:
+ $ref: '#/definitions/schema.AIPromptConfig'
+ type: object
schema.SiteAdvancedReq:
properties:
authorized_attachment_extensions:
@@ -2218,6 +2431,8 @@ definitions:
type: object
schema.SiteInfoResp:
properties:
+ ai_enabled:
+ type: boolean
branding:
$ref: '#/definitions/schema.SiteBrandingResp'
custom_css_html:
@@ -2228,6 +2443,8 @@ definitions:
$ref: '#/definitions/schema.SiteInterfaceSettingsResp'
login:
$ref: '#/definitions/schema.SiteLoginResp'
+ mcp_enabled:
+ type: boolean
revision:
type: string
site_advanced:
@@ -2311,6 +2528,22 @@ definitions:
allow_password_login:
type: boolean
type: object
+ schema.SiteMCPReq:
+ properties:
+ enabled:
+ type: boolean
+ type: object
+ schema.SiteMCPResp:
+ properties:
+ enabled:
+ type: boolean
+ http_header:
+ type: string
+ type:
+ type: string
+ url:
+ type: string
+ type: object
schema.SitePoliciesReq:
properties:
privacy_policy_original_text:
@@ -2653,6 +2886,17 @@ definitions:
url_title:
type: string
type: object
+ schema.UpdateAPIKeyReq:
+ properties:
+ description:
+ maxLength: 150
+ type: string
+ id:
+ type: integer
+ required:
+ - description
+ - id
+ type: object
schema.UpdateBadgeStatusReq:
properties:
id:
@@ -3241,6 +3485,174 @@ paths:
summary: if config file not exist try to redirect to install page
tags:
- installation
+ /answer/admin/api/ai-config:
+ get:
+ description: get AI configuration
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ allOf:
+ - $ref: '#/definitions/handler.RespBody'
+ - properties:
+ data:
+ $ref: '#/definitions/schema.SiteAIResp'
+ type: object
+ security:
+ - ApiKeyAuth: []
+ summary: get AI configuration
+ tags:
+ - admin
+ put:
+ description: update AI configuration
+ parameters:
+ - description: AI config
+ in: body
+ name: data
+ required: true
+ schema:
+ $ref: '#/definitions/schema.SiteAIReq'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/handler.RespBody'
+ security:
+ - ApiKeyAuth: []
+ summary: update AI configuration
+ tags:
+ - admin
+ /answer/admin/api/ai-models:
+ post:
+ description: get AI models
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ allOf:
+ - $ref: '#/definitions/handler.RespBody'
+ - properties:
+ data:
+ items:
+ $ref: '#/definitions/schema.GetAIModelResp'
+ type: array
+ type: object
+ security:
+ - ApiKeyAuth: []
+ summary: get AI models
+ tags:
+ - admin
+ /answer/admin/api/ai-provider:
+ get:
+ description: get AI provider configuration
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ allOf:
+ - $ref: '#/definitions/handler.RespBody'
+ - properties:
+ data:
+ items:
+ $ref: '#/definitions/schema.GetAIProviderResp'
+ type: array
+ type: object
+ security:
+ - ApiKeyAuth: []
+ summary: get AI provider configuration
+ tags:
+ - admin
+ /answer/admin/api/ai/conversation:
+ delete:
+ consumes:
+ - application/json
+ description: delete conversation and its related records for admin
+ parameters:
+ - description: apikey
+ in: body
+ name: data
+ required: true
+ schema:
+ $ref: '#/definitions/schema.AIConversationAdminDeleteReq'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/handler.RespBody'
+ summary: delete conversation for admin
+ tags:
+ - ai-conversation-admin
+ get:
+ consumes:
+ - application/json
+ description: get conversation detail for admin
+ parameters:
+ - description: conversation id
+ in: query
+ name: conversation_id
+ required: true
+ type: string
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ allOf:
+ - $ref: '#/definitions/handler.RespBody'
+ - properties:
+ data:
+ $ref: '#/definitions/schema.AIConversationAdminDetailResp'
+ type: object
+ summary: get conversation detail for admin
+ tags:
+ - ai-conversation-admin
+ /answer/admin/api/ai/conversation/page:
+ get:
+ consumes:
+ - application/json
+ description: get conversation list for admin
+ parameters:
+ - description: page
+ in: query
+ name: page
+ type: integer
+ - description: page size
+ in: query
+ name: page_size
+ type: integer
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ allOf:
+ - $ref: '#/definitions/handler.RespBody'
+ - properties:
+ data:
+ allOf:
+ - $ref: '#/definitions/pager.PageModel'
+ - properties:
+ list:
+ items:
+ $ref: '#/definitions/schema.AIConversationAdminListItem'
+ type: array
+ type: object
+ type: object
+ summary: get conversation list for admin
+ tags:
+ - ai-conversation-admin
/answer/admin/api/answer/page:
get:
consumes:
@@ -3307,6 +3719,97 @@ paths:
summary: update answer status
tags:
- admin
+ /answer/admin/api/api-key:
+ delete:
+ description: delete apikey
+ parameters:
+ - description: apikey
+ in: body
+ name: data
+ required: true
+ schema:
+ $ref: '#/definitions/schema.DeleteAPIKeyReq'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/handler.RespBody'
+ security:
+ - ApiKeyAuth: []
+ summary: delete apikey
+ tags:
+ - admin
+ post:
+ description: add apikey
+ parameters:
+ - description: apikey
+ in: body
+ name: data
+ required: true
+ schema:
+ $ref: '#/definitions/schema.AddAPIKeyReq'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ allOf:
+ - $ref: '#/definitions/handler.RespBody'
+ - properties:
+ data:
+ $ref: '#/definitions/schema.AddAPIKeyResp'
+ type: object
+ security:
+ - ApiKeyAuth: []
+ summary: add apikey
+ tags:
+ - admin
+ put:
+ description: update apikey
+ parameters:
+ - description: apikey
+ in: body
+ name: data
+ required: true
+ schema:
+ $ref: '#/definitions/schema.UpdateAPIKeyReq'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/handler.RespBody'
+ security:
+ - ApiKeyAuth: []
+ summary: update apikey
+ tags:
+ - admin
+ /answer/admin/api/api-key/all:
+ get:
+ description: get all api keys
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ allOf:
+ - $ref: '#/definitions/handler.RespBody'
+ - properties:
+ data:
+ items:
+ $ref: '#/definitions/schema.GetAPIKeyResp'
+ type: array
+ type: object
+ security:
+ - ApiKeyAuth: []
+ summary: get all api keys
+ tags:
+ - admin
/answer/admin/api/badge/status:
put:
consumes:
@@ -3432,6 +3935,47 @@ paths:
summary: Get language options
tags:
- Lang
+ /answer/admin/api/mcp-config:
+ get:
+ description: get MCP configuration
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ allOf:
+ - $ref: '#/definitions/handler.RespBody'
+ - properties:
+ data:
+ $ref: '#/definitions/schema.SiteMCPResp'
+ type: object
+ security:
+ - ApiKeyAuth: []
+ summary: get MCP configuration
+ tags:
+ - admin
+ put:
+ description: update MCP configuration
+ parameters:
+ - description: MCP config
+ in: body
+ name: data
+ required: true
+ schema:
+ $ref: '#/definitions/schema.SiteMCPReq'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/handler.RespBody'
+ security:
+ - ApiKeyAuth: []
+ summary: update MCP configuration
+ tags:
+ - admin
/answer/admin/api/plugin/config:
get:
description: get plugin config
@@ -4639,6 +5183,90 @@ paths:
summary: get object timeline detail
tags:
- Comment
+ /answer/api/v1/ai/conversation:
+ get:
+ consumes:
+ - application/json
+ description: get conversation detail
+ parameters:
+ - description: conversation id
+ in: query
+ name: conversation_id
+ required: true
+ type: string
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ allOf:
+ - $ref: '#/definitions/handler.RespBody'
+ - properties:
+ data:
+ $ref: '#/definitions/schema.AIConversationDetailResp'
+ type: object
+ summary: get conversation detail
+ tags:
+ - ai-conversation
+ /answer/api/v1/ai/conversation/page:
+ get:
+ consumes:
+ - application/json
+ description: get conversation list
+ parameters:
+ - description: page
+ in: query
+ name: page
+ type: integer
+ - description: page size
+ in: query
+ name: page_size
+ type: integer
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ allOf:
+ - $ref: '#/definitions/handler.RespBody'
+ - properties:
+ data:
+ allOf:
+ - $ref: '#/definitions/pager.PageModel'
+ - properties:
+ list:
+ items:
+ $ref: '#/definitions/schema.AIConversationListItem'
+ type: array
+ type: object
+ type: object
+ summary: get conversation list
+ tags:
+ - ai-conversation
+ /answer/api/v1/ai/conversation/vote:
+ post:
+ consumes:
+ - application/json
+ description: vote record
+ parameters:
+ - description: vote request
+ in: body
+ name: data
+ required: true
+ schema:
+ $ref: '#/definitions/schema.AIConversationVoteReq'
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: OK
+ schema:
+ $ref: '#/definitions/handler.RespBody'
+ summary: vote record
+ tags:
+ - ai-conversation
/answer/api/v1/answer:
delete:
consumes:
diff --git a/go.mod b/go.mod
index d2430295..5c48abfd 100644
--- a/go.mod
+++ b/go.mod
@@ -30,6 +30,7 @@ require (
github.com/go-playground/locales v0.14.1
github.com/go-playground/universal-translator v0.18.1
github.com/go-playground/validator/v10 v10.22.1
+ github.com/go-resty/resty/v2 v2.17.1
github.com/go-sql-driver/mysql v1.8.1
github.com/goccy/go-json v0.10.3
github.com/google/uuid v1.6.0
@@ -39,10 +40,12 @@ require (
github.com/jinzhu/now v1.1.5
github.com/joho/godotenv v1.5.1
github.com/lib/pq v1.10.9
+ github.com/mark3labs/mcp-go v0.43.2
github.com/microcosm-cc/bluemonday v1.0.27
github.com/mozillazg/go-pinyin v0.20.0
github.com/ory/dockertest/v3 v3.11.0
github.com/robfig/cron/v3 v3.0.1
+ github.com/sashabaranov/go-openai v1.41.2
github.com/scottleedavis/go-exif-remove v0.0.0-20230314195146-7e059d593405
github.com/segmentfault/pacman v1.0.5-0.20230822083413-c0075a2d401f
github.com/segmentfault/pacman/contrib/cache/memory v0.0.0-20230822083413-c0075a2d401f
@@ -80,6 +83,8 @@ require (
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
+ github.com/bahlo/generic-list-go v0.2.0 // indirect
+ github.com/buger/jsonparser v1.1.1 // indirect
github.com/bytedance/sonic v1.12.2 // indirect
github.com/bytedance/sonic/loader v0.2.0 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
@@ -118,6 +123,7 @@ require (
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
+ github.com/invopop/jsonschema v0.13.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
@@ -146,7 +152,7 @@ require (
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
- github.com/spf13/cast v1.7.0 // indirect
+ github.com/spf13/cast v1.7.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.19.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
@@ -155,9 +161,11 @@ require (
github.com/tidwall/pretty v1.2.1 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
+ github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
+ github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/arch v0.10.0 // indirect
diff --git a/internal/base/constant/site_type.go b/internal/base/constant/site_type.go
index 64ea9c4a..20917f12 100644
--- a/internal/base/constant/site_type.go
+++ b/internal/base/constant/site_type.go
@@ -42,8 +42,8 @@ const (
SiteTypeUsersSettings = "users_settings"
SiteTypeInterfaceSettings = "interface_settings"
- SiteTypePolicies = "policies"
- SiteTypeSecurity = "security"
+ SiteTypePolicies = "policies"
+ SiteTypeSecurity = "security"
SiteTypeAI = "ai"
SiteTypeFeatureToggle = "feature-toggle"
SiteTypeMCP = "mcp"
diff --git a/internal/migrations/v32.go b/internal/migrations/v31.go
similarity index 100%
rename from internal/migrations/v32.go
rename to internal/migrations/v31.go
diff --git a/internal/schema/siteinfo_schema.go b/internal/schema/siteinfo_schema.go
index 3338e80a..a72a8460 100644
--- a/internal/schema/siteinfo_schema.go
+++ b/internal/schema/siteinfo_schema.go
@@ -381,8 +381,8 @@ type SiteInfoResp struct {
Security *SiteSecurityResp `json:"site_security"`
Version string `json:"version"`
Revision string `json:"revision"`
- AIEnabled bool `json:"ai_enabled"`
- MCPEnabled bool `json:"mcp_enabled"`
+ AIEnabled bool `json:"ai_enabled"`
+ MCPEnabled bool `json:"mcp_enabled"`
}
type TemplateSiteInfoResp struct {
diff --git a/internal/service/mock/siteinfo_repo_mock.go b/internal/service/mock/siteinfo_repo_mock.go
index 16f7abd8..ad3a170a 100644
--- a/internal/service/mock/siteinfo_repo_mock.go
+++ b/internal/service/mock/siteinfo_repo_mock.go
@@ -41,6 +41,7 @@ import (
type MockSiteInfoRepo struct {
ctrl *gomock.Controller
recorder *MockSiteInfoRepoMockRecorder
+ isgomock struct{}
}
// MockSiteInfoRepoMockRecorder is the mock recorder for MockSiteInfoRepo.
@@ -75,7 +76,7 @@ func (m *MockSiteInfoRepo) GetByType(ctx context.Context, siteType string, witho
}
// GetByType indicates an expected call of GetByType.
-func (mr *MockSiteInfoRepoMockRecorder) GetByType(ctx, siteType interface{}) *gomock.Call {
+func (mr *MockSiteInfoRepoMockRecorder) GetByType(ctx, siteType any, withoutCache ...any) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]any{ctx, siteType}, withoutCache...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByType", reflect.TypeOf((*MockSiteInfoRepo)(nil).GetByType), varargs...)
@@ -91,7 +92,7 @@ func (m *MockSiteInfoRepo) IsBrandingFileUsed(ctx context.Context, filePath stri
}
// IsBrandingFileUsed indicates an expected call of IsBrandingFileUsed.
-func (mr *MockSiteInfoRepoMockRecorder) IsBrandingFileUsed(ctx, filePath interface{}) *gomock.Call {
+func (mr *MockSiteInfoRepoMockRecorder) IsBrandingFileUsed(ctx, filePath any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsBrandingFileUsed", reflect.TypeOf((*MockSiteInfoRepo)(nil).IsBrandingFileUsed), ctx, filePath)
}
@@ -105,7 +106,7 @@ func (m *MockSiteInfoRepo) SaveByType(ctx context.Context, siteType string, data
}
// SaveByType indicates an expected call of SaveByType.
-func (mr *MockSiteInfoRepoMockRecorder) SaveByType(ctx, siteType, data interface{}) *gomock.Call {
+func (mr *MockSiteInfoRepoMockRecorder) SaveByType(ctx, siteType, data any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SaveByType", reflect.TypeOf((*MockSiteInfoRepo)(nil).SaveByType), ctx, siteType, data)
}
@@ -114,6 +115,7 @@ func (mr *MockSiteInfoRepoMockRecorder) SaveByType(ctx, siteType, data interface
type MockSiteInfoCommonService struct {
ctrl *gomock.Controller
recorder *MockSiteInfoCommonServiceMockRecorder
+ isgomock struct{}
}
// MockSiteInfoCommonServiceMockRecorder is the mock recorder for MockSiteInfoCommonService.
@@ -142,7 +144,7 @@ func (m *MockSiteInfoCommonService) FormatAvatar(ctx context.Context, originalAv
}
// FormatAvatar indicates an expected call of FormatAvatar.
-func (mr *MockSiteInfoCommonServiceMockRecorder) FormatAvatar(ctx, originalAvatarData, email, userStatus interface{}) *gomock.Call {
+func (mr *MockSiteInfoCommonServiceMockRecorder) FormatAvatar(ctx, originalAvatarData, email, userStatus any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FormatAvatar", reflect.TypeOf((*MockSiteInfoCommonService)(nil).FormatAvatar), ctx, originalAvatarData, email, userStatus)
}
@@ -156,11 +158,26 @@ func (m *MockSiteInfoCommonService) FormatListAvatar(ctx context.Context, userLi
}
// FormatListAvatar indicates an expected call of FormatListAvatar.
-func (mr *MockSiteInfoCommonServiceMockRecorder) FormatListAvatar(ctx, userList interface{}) *gomock.Call {
+func (mr *MockSiteInfoCommonServiceMockRecorder) FormatListAvatar(ctx, userList any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FormatListAvatar", reflect.TypeOf((*MockSiteInfoCommonService)(nil).FormatListAvatar), ctx, userList)
}
+// GetSiteAI mocks base method.
+func (m *MockSiteInfoCommonService) GetSiteAI(ctx context.Context) (*schema.SiteAIResp, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "GetSiteAI", ctx)
+ ret0, _ := ret[0].(*schema.SiteAIResp)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// GetSiteAI indicates an expected call of GetSiteAI.
+func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteAI(ctx any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSiteAI", reflect.TypeOf((*MockSiteInfoCommonService)(nil).GetSiteAI), ctx)
+}
+
// GetSiteAdvanced mocks base method.
func (m *MockSiteInfoCommonService) GetSiteAdvanced(ctx context.Context) (*schema.SiteAdvancedResp, error) {
m.ctrl.T.Helper()
@@ -171,7 +188,7 @@ func (m *MockSiteInfoCommonService) GetSiteAdvanced(ctx context.Context) (*schem
}
// GetSiteAdvanced indicates an expected call of GetSiteAdvanced.
-func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteAdvanced(ctx interface{}) *gomock.Call {
+func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteAdvanced(ctx any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSiteAdvanced", reflect.TypeOf((*MockSiteInfoCommonService)(nil).GetSiteAdvanced), ctx)
}
@@ -186,7 +203,7 @@ func (m *MockSiteInfoCommonService) GetSiteBranding(ctx context.Context) (*schem
}
// GetSiteBranding indicates an expected call of GetSiteBranding.
-func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteBranding(ctx interface{}) *gomock.Call {
+func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteBranding(ctx any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSiteBranding", reflect.TypeOf((*MockSiteInfoCommonService)(nil).GetSiteBranding), ctx)
}
@@ -201,7 +218,7 @@ func (m *MockSiteInfoCommonService) GetSiteCustomCssHTML(ctx context.Context) (*
}
// GetSiteCustomCssHTML indicates an expected call of GetSiteCustomCssHTML.
-func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteCustomCssHTML(ctx interface{}) *gomock.Call {
+func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteCustomCssHTML(ctx any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSiteCustomCssHTML", reflect.TypeOf((*MockSiteInfoCommonService)(nil).GetSiteCustomCssHTML), ctx)
}
@@ -216,7 +233,7 @@ func (m *MockSiteInfoCommonService) GetSiteGeneral(ctx context.Context) (*schema
}
// GetSiteGeneral indicates an expected call of GetSiteGeneral.
-func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteGeneral(ctx interface{}) *gomock.Call {
+func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteGeneral(ctx any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSiteGeneral", reflect.TypeOf((*MockSiteInfoCommonService)(nil).GetSiteGeneral), ctx)
}
@@ -230,7 +247,7 @@ func (m *MockSiteInfoCommonService) GetSiteInfoByType(ctx context.Context, siteT
}
// GetSiteInfoByType indicates an expected call of GetSiteInfoByType.
-func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteInfoByType(ctx, siteType, resp interface{}) *gomock.Call {
+func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteInfoByType(ctx, siteType, resp any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSiteInfoByType", reflect.TypeOf((*MockSiteInfoCommonService)(nil).GetSiteInfoByType), ctx, siteType, resp)
}
@@ -245,7 +262,7 @@ func (m *MockSiteInfoCommonService) GetSiteInterface(ctx context.Context) (*sche
}
// GetSiteInterface indicates an expected call of GetSiteInterface.
-func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteInterface(ctx interface{}) *gomock.Call {
+func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteInterface(ctx any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSiteInterface", reflect.TypeOf((*MockSiteInfoCommonService)(nil).GetSiteInterface), ctx)
}
@@ -260,11 +277,26 @@ func (m *MockSiteInfoCommonService) GetSiteLogin(ctx context.Context) (*schema.S
}
// GetSiteLogin indicates an expected call of GetSiteLogin.
-func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteLogin(ctx interface{}) *gomock.Call {
+func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteLogin(ctx any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSiteLogin", reflect.TypeOf((*MockSiteInfoCommonService)(nil).GetSiteLogin), ctx)
}
+// GetSiteMCP mocks base method.
+func (m *MockSiteInfoCommonService) GetSiteMCP(ctx context.Context) (*schema.SiteMCPResp, error) {
+ m.ctrl.T.Helper()
+ ret := m.ctrl.Call(m, "GetSiteMCP", ctx)
+ ret0, _ := ret[0].(*schema.SiteMCPResp)
+ ret1, _ := ret[1].(error)
+ return ret0, ret1
+}
+
+// GetSiteMCP indicates an expected call of GetSiteMCP.
+func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteMCP(ctx any) *gomock.Call {
+ mr.mock.ctrl.T.Helper()
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSiteMCP", reflect.TypeOf((*MockSiteInfoCommonService)(nil).GetSiteMCP), ctx)
+}
+
// GetSitePolicies mocks base method.
func (m *MockSiteInfoCommonService) GetSitePolicies(ctx context.Context) (*schema.SitePoliciesResp, error) {
m.ctrl.T.Helper()
@@ -275,7 +307,7 @@ func (m *MockSiteInfoCommonService) GetSitePolicies(ctx context.Context) (*schem
}
// GetSitePolicies indicates an expected call of GetSitePolicies.
-func (mr *MockSiteInfoCommonServiceMockRecorder) GetSitePolicies(ctx interface{}) *gomock.Call {
+func (mr *MockSiteInfoCommonServiceMockRecorder) GetSitePolicies(ctx any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSitePolicies", reflect.TypeOf((*MockSiteInfoCommonService)(nil).GetSitePolicies), ctx)
}
@@ -290,7 +322,7 @@ func (m *MockSiteInfoCommonService) GetSiteQuestion(ctx context.Context) (*schem
}
// GetSiteQuestion indicates an expected call of GetSiteQuestion.
-func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteQuestion(ctx interface{}) *gomock.Call {
+func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteQuestion(ctx any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSiteQuestion", reflect.TypeOf((*MockSiteInfoCommonService)(nil).GetSiteQuestion), ctx)
}
@@ -305,7 +337,7 @@ func (m *MockSiteInfoCommonService) GetSiteSecurity(ctx context.Context) (*schem
}
// GetSiteSecurity indicates an expected call of GetSiteSecurity.
-func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteSecurity(ctx interface{}) *gomock.Call {
+func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteSecurity(ctx any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSiteSecurity", reflect.TypeOf((*MockSiteInfoCommonService)(nil).GetSiteSecurity), ctx)
}
@@ -320,7 +352,7 @@ func (m *MockSiteInfoCommonService) GetSiteSeo(ctx context.Context) (*schema.Sit
}
// GetSiteSeo indicates an expected call of GetSiteSeo.
-func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteSeo(ctx interface{}) *gomock.Call {
+func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteSeo(ctx any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSiteSeo", reflect.TypeOf((*MockSiteInfoCommonService)(nil).GetSiteSeo), ctx)
}
@@ -335,7 +367,7 @@ func (m *MockSiteInfoCommonService) GetSiteTag(ctx context.Context) (*schema.Sit
}
// GetSiteTag indicates an expected call of GetSiteTag.
-func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteTag(ctx interface{}) *gomock.Call {
+func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteTag(ctx any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSiteTag", reflect.TypeOf((*MockSiteInfoCommonService)(nil).GetSiteTag), ctx)
}
@@ -350,7 +382,7 @@ func (m *MockSiteInfoCommonService) GetSiteTheme(ctx context.Context) (*schema.S
}
// GetSiteTheme indicates an expected call of GetSiteTheme.
-func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteTheme(ctx interface{}) *gomock.Call {
+func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteTheme(ctx any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSiteTheme", reflect.TypeOf((*MockSiteInfoCommonService)(nil).GetSiteTheme), ctx)
}
@@ -365,7 +397,7 @@ func (m *MockSiteInfoCommonService) GetSiteUsers(ctx context.Context) (*schema.S
}
// GetSiteUsers indicates an expected call of GetSiteUsers.
-func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteUsers(ctx interface{}) *gomock.Call {
+func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteUsers(ctx any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSiteUsers", reflect.TypeOf((*MockSiteInfoCommonService)(nil).GetSiteUsers), ctx)
}
@@ -380,7 +412,7 @@ func (m *MockSiteInfoCommonService) GetSiteUsersSettings(ctx context.Context) (*
}
// GetSiteUsersSettings indicates an expected call of GetSiteUsersSettings.
-func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteUsersSettings(ctx interface{}) *gomock.Call {
+func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteUsersSettings(ctx any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSiteUsersSettings", reflect.TypeOf((*MockSiteInfoCommonService)(nil).GetSiteUsersSettings), ctx)
}
@@ -395,7 +427,7 @@ func (m *MockSiteInfoCommonService) GetSiteWrite(ctx context.Context) (*schema.S
}
// GetSiteWrite indicates an expected call of GetSiteWrite.
-func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteWrite(ctx interface{}) *gomock.Call {
+func (mr *MockSiteInfoCommonServiceMockRecorder) GetSiteWrite(ctx any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSiteWrite", reflect.TypeOf((*MockSiteInfoCommonService)(nil).GetSiteWrite), ctx)
}
@@ -409,7 +441,7 @@ func (m *MockSiteInfoCommonService) IsBrandingFileUsed(ctx context.Context, file
}
// IsBrandingFileUsed indicates an expected call of IsBrandingFileUsed.
-func (mr *MockSiteInfoCommonServiceMockRecorder) IsBrandingFileUsed(ctx, filePath interface{}) *gomock.Call {
+func (mr *MockSiteInfoCommonServiceMockRecorder) IsBrandingFileUsed(ctx, filePath any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsBrandingFileUsed", reflect.TypeOf((*MockSiteInfoCommonService)(nil).IsBrandingFileUsed), ctx, filePath)
}
diff --git a/ui/src/components/TabNav/index.tsx b/ui/src/components/TabNav/index.tsx
index 482cd0cf..6b1b434d 100644
--- a/ui/src/components/TabNav/index.tsx
+++ b/ui/src/components/TabNav/index.tsx
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
import { FC } from 'react';
import { Nav } from 'react-bootstrap';
import { NavLink, useLocation } from 'react-router-dom';
diff --git a/ui/src/pages/Admin/AiAssistant/components/Action/index.tsx b/ui/src/pages/Admin/AiAssistant/components/Action/index.tsx
index c9702ea6..75b8661a 100644
--- a/ui/src/pages/Admin/AiAssistant/components/Action/index.tsx
+++ b/ui/src/pages/Admin/AiAssistant/components/Action/index.tsx
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
import { Dropdown } from 'react-bootstrap';
import { useTranslation } from 'react-i18next';
diff --git a/ui/src/pages/AiAssistant/components/ConversationList/index.tsx b/ui/src/pages/AiAssistant/components/ConversationList/index.tsx
index 4dbc6129..1ddb9625 100644
--- a/ui/src/pages/AiAssistant/components/ConversationList/index.tsx
+++ b/ui/src/pages/AiAssistant/components/ConversationList/index.tsx
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
import { FC, memo } from 'react';
import { Card, ListGroup } from 'react-bootstrap';
import { Link } from 'react-router-dom';
diff --git a/ui/src/pages/Search/components/AiCard/index.tsx b/ui/src/pages/Search/components/AiCard/index.tsx
index 9e7d8f94..2da5cb91 100644
--- a/ui/src/pages/Search/components/AiCard/index.tsx
+++ b/ui/src/pages/Search/components/AiCard/index.tsx
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
import { useState, useEffect } from 'react';
import { Card, Spinner } from 'react-bootstrap';
import { useSearchParams, Link } from 'react-router-dom';
diff --git a/ui/src/utils/requestAi.ts b/ui/src/utils/requestAi.ts
index 444bbe6d..df2d1ee7 100644
--- a/ui/src/utils/requestAi.ts
+++ b/ui/src/utils/requestAi.ts
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
import { Modal } from '@/components';
import { loggedUserInfoStore, toastStore, errorCodeStore } from '@/stores';
import { LOGGED_TOKEN_STORAGE_KEY } from '@/common/constants';