From 0306b4816c8d598c6a4fb4832a443fbf42446b3a Mon Sep 17 00:00:00 2001 From: coltea Date: Fri, 24 Oct 2025 11:39:35 +0800 Subject: [PATCH 1/2] feat doc tree --- backend/api/crawler/v1/crawler.go | 86 +- backend/consts/parse.go | 42 + backend/docs/docs.go | 8006 ++++++++++++----------------- backend/docs/swagger.json | 8006 ++++++++++++----------------- backend/docs/swagger.yaml | 1143 +--- backend/handler/v1/crawler.go | 628 +-- backend/pkg/anydoc/anydoc.go | 10 +- backend/pkg/anydoc/confluence.go | 23 +- backend/pkg/anydoc/epub.go | 4 +- backend/pkg/anydoc/feishu.go | 8 +- backend/pkg/anydoc/mindoc.go | 4 +- backend/pkg/anydoc/notion.go | 4 +- backend/pkg/anydoc/res.go | 25 + backend/pkg/anydoc/rss.go | 4 +- backend/pkg/anydoc/sitemap.go | 4 +- backend/pkg/anydoc/siyuan.go | 4 +- backend/pkg/anydoc/wikijs.go | 23 +- backend/pkg/anydoc/yuque.go | 4 +- backend/usecase/crawler.go | 523 +- backend/usecase/crawler_feishu.go | 98 - 20 files changed, 7013 insertions(+), 11636 deletions(-) create mode 100644 backend/consts/parse.go delete mode 100644 backend/usecase/crawler_feishu.go diff --git a/backend/api/crawler/v1/crawler.go b/backend/api/crawler/v1/crawler.go index 204d0c02..60f382a1 100644 --- a/backend/api/crawler/v1/crawler.go +++ b/backend/api/crawler/v1/crawler.go @@ -1,15 +1,40 @@ package v1 -import "github.com/chaitin/panda-wiki/consts" +import ( + "github.com/chaitin/panda-wiki/consts" + "github.com/chaitin/panda-wiki/pkg/anydoc" +) -type ScrapeReq struct { - URL string `json:"url" validate:"required"` - KbID string `json:"kb_id" validate:"required"` +type CrawlerParseReq struct { + Key string `json:"key"` + KbID string `json:"kb_id" validate:"required"` + CrawlerSource consts.CrawlerSource `json:"crawler_source" validate:"required"` + Filename string `json:"filename"` + FeishuSetting FeishuSetting `json:"feishu_setting"` } -type ScrapeResp struct { +type FeishuSetting struct { + UserAccessToken string `json:"user_access_token"` + AppID string `json:"app_id"` + AppSecret string `json:"app_secret"` + SpaceId string `json:"space_id"` +} + +type CrawlerParseResp struct { + ID string `json:"id"` + Docs anydoc.Child `json:"docs"` +} + +type CrawlerExportReq struct { + KbID string `json:"kb_id" validate:"required"` + ID string `json:"id" validate:"required"` + DocID string `json:"doc_id" validate:"required"` + SpaceId string `json:"space_id"` + FileType string `json:"file_type"` +} + +type CrawlerExportResp struct { TaskId string `json:"task_id"` - Title string `json:"title"` } type CrawlerResultReq struct { @@ -34,52 +59,3 @@ type CrawlerResultItem struct { Status consts.CrawlerStatus `json:"status"` Content string `json:"content"` } - -type SitemapParseReq struct { - URL string `json:"url" validate:"required"` -} - -type SitemapParseResp struct { - ID string `json:"id"` - List []SitemapParseItem `json:"list"` -} - -type SitemapParseItem struct { - URL string `json:"url"` - Title string `json:"title"` -} - -type SitemapScrapeReq struct { - KbID string `json:"kb_id" validate:"required"` - ID string `json:"id" validate:"required"` - URL string `json:"url" validate:"required"` -} - -type SitemapScrapeResp struct { - Content string `json:"content"` -} - -type RssParseReq struct { - URL string `json:"url" validate:"required"` -} - -type RssParseResp struct { - ID string `json:"id"` - List []RssParseItem `json:"list"` -} - -type RssParseItem struct { - URL string `json:"url"` - Title string `json:"title"` - Desc string `json:"desc"` -} - -type RssScrapeReq struct { - KbID string `json:"kb_id" validate:"required"` - ID string `json:"id" validate:"required"` - URL string `json:"url" validate:"required"` -} - -type RssScrapeResp struct { - Content string `json:"content"` -} diff --git a/backend/consts/parse.go b/backend/consts/parse.go new file mode 100644 index 00000000..c5473918 --- /dev/null +++ b/backend/consts/parse.go @@ -0,0 +1,42 @@ +package consts + +type CrawlerSource string + +const ( + // CrawlerSourceUrl key或url形式 直接走parse接口 + CrawlerSourceUrl CrawlerSource = "url" + CrawlerSourceRSS CrawlerSource = "rss" + CrawlerSourceSitemap CrawlerSource = "sitemap" + CrawlerSourceNotion CrawlerSource = "notion" + CrawlerSourceFeishu CrawlerSource = "feishu" + + // CrawlerSourceFile file形式 需要先走upload接口先上传文件 + CrawlerSourceFile CrawlerSource = "file" + CrawlerSourceEpub CrawlerSource = "epub" + CrawlerSourceYuque CrawlerSource = "yuque" + CrawlerSourceSiyuan CrawlerSource = "siyuan" + CrawlerSourceMindoc CrawlerSource = "mindoc" + CrawlerSourceWikijs CrawlerSource = "wikijs" + CrawlerSourceConfluence CrawlerSource = "confluence" +) + +type CrawlerSourceType string + +const ( + CrawlerSourceTypeFile CrawlerSourceType = "file" + CrawlerSourceTypeUrl CrawlerSourceType = "url" + CrawlerSourceTypeKey CrawlerSourceType = "key" +) + +func (c CrawlerSource) Type() CrawlerSourceType { + switch c { + case CrawlerSourceNotion, CrawlerSourceFeishu: + return CrawlerSourceTypeKey + case CrawlerSourceUrl, CrawlerSourceRSS, CrawlerSourceSitemap: + return CrawlerSourceTypeUrl + case CrawlerSourceFile, CrawlerSourceEpub, CrawlerSourceYuque, CrawlerSourceSiyuan, CrawlerSourceMindoc, CrawlerSourceWikijs, CrawlerSourceConfluence: + return CrawlerSourceTypeFile + default: + return "" + } +} diff --git a/backend/docs/docs.go b/backend/docs/docs.go index eac8553e..8c2ad67b 100644 --- a/backend/docs/docs.go +++ b/backend/docs/docs.go @@ -663,11 +663,11 @@ const docTemplate = `{ } } }, - "/api/v1/crawler/confluence/parse": { + "/api/v1/crawler/export": { "post": { - "description": "Parse Confluence Export File and return document list", + "description": "CrawlerExport", "consumes": [ - "multipart/form-data" + "application/json" ], "produces": [ "application/json" @@ -675,21 +675,16 @@ const docTemplate = `{ "tags": [ "crawler" ], - "summary": "ConfluenceParse", + "summary": "CrawlerExport", "parameters": [ { - "type": "file", - "description": "file", - "name": "file", - "in": "formData", - "required": true - }, - { - "type": "string", - "description": "kb_id", - "name": "kb_id", - "in": "formData", - "required": true + "description": "Scrape", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.CrawlerExportReq" + } } ], "responses": { @@ -704,7 +699,7 @@ const docTemplate = `{ "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.ConfluenceParseResp" + "$ref": "#/definitions/v1.CrawlerExportResp" } } } @@ -714,9 +709,9 @@ const docTemplate = `{ } } }, - "/api/v1/crawler/confluence/scrape": { + "/api/v1/crawler/parse": { "post": { - "description": "Scrape specific Confluence documents by ID", + "description": "解析文档树", "consumes": [ "application/json" ], @@ -726,15 +721,15 @@ const docTemplate = `{ "tags": [ "crawler" ], - "summary": "ConfluenceScrape", + "summary": "解析文档树", "parameters": [ { - "description": "Scrape Request", + "description": "Scrape", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.ConfluenceScrapeReq" + "$ref": "#/definitions/v1.CrawlerParseReq" } } ], @@ -750,7 +745,7 @@ const docTemplate = `{ "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.ConfluenceScrapeResp" + "$ref": "#/definitions/v1.CrawlerParseResp" } } } @@ -760,9 +755,9 @@ const docTemplate = `{ } } }, - "/api/v1/crawler/epub/parse": { - "post": { - "description": "EpubParse", + "/api/v1/crawler/result": { + "get": { + "description": "Retrieve the result of a previously started scraping task", "consumes": [ "application/json" ], @@ -772,15 +767,15 @@ const docTemplate = `{ "tags": [ "crawler" ], - "summary": "EpubParse", + "summary": "Get Crawler Result", "parameters": [ { - "description": "Parse URL", + "description": "Crawler Result Request", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.EpubParseReq" + "$ref": "#/definitions/v1.CrawlerResultReq" } } ], @@ -796,7 +791,7 @@ const docTemplate = `{ "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.EpubParseResp" + "$ref": "#/definitions/v1.CrawlerResultResp" } } } @@ -806,9 +801,9 @@ const docTemplate = `{ } } }, - "/api/v1/crawler/feishu/get_doc": { + "/api/v1/crawler/results": { "post": { - "description": "Get Docx in Feishu Spaces", + "description": "Retrieve the results of a previously started scraping task", "consumes": [ "application/json" ], @@ -818,15 +813,15 @@ const docTemplate = `{ "tags": [ "crawler" ], - "summary": "FeishuDoc", + "summary": "Get Crawler Results", "parameters": [ { - "description": "Get Docx", - "name": "body", + "description": "Crawler Results Request", + "name": "param", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.FeishuGetDocReq" + "$ref": "#/definitions/v1.CrawlerResultsReq" } } ], @@ -842,7 +837,7 @@ const docTemplate = `{ "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.FeishuGetDocResp" + "$ref": "#/definitions/v1.CrawlerResultsResp" } } } @@ -852,9 +847,9 @@ const docTemplate = `{ } } }, - "/api/v1/crawler/feishu/list_doc": { + "/api/v1/creation/tab-complete": { "post": { - "description": "List Docx in Feishu Spaces", + "description": "Tab-based document completion similar to AI coding's FIM (Fill in Middle)", "consumes": [ "application/json" ], @@ -862,48 +857,33 @@ const docTemplate = `{ "application/json" ], "tags": [ - "crawler" + "creation" ], - "summary": "FeishuListCloudDoc", + "summary": "Tab-based document completion", "parameters": [ { - "description": "Search Docx", + "description": "tab completion request", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.FeishuListCloudDocReq" + "$ref": "#/definitions/domain.CompleteReq" } } ], "responses": { "200": { - "description": "OK", + "description": "success", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.FeishuListCloudDocResp" - } - } - } - } - ] + "type": "string" } } } } }, - "/api/v1/crawler/feishu/list_spaces": { + "/api/v1/creation/text": { "post": { - "description": "List All Feishu Spaces", + "description": "Text creation", "consumes": [ "application/json" ], @@ -911,119 +891,87 @@ const docTemplate = `{ "application/json" ], "tags": [ - "crawler" + "creation" ], - "summary": "FeishuListSpaces", + "summary": "Text creation", "parameters": [ { - "description": "List Spaces", + "description": "text creation request", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.FeishuSpaceListReq" + "$ref": "#/definitions/domain.TextReq" } } ], "responses": { "200": { - "description": "OK", + "description": "success", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.FeishuSpaceListResp" - } - } - } - } - ] + "type": "string" } } } } }, - "/api/v1/crawler/feishu/search_wiki": { + "/api/v1/file/upload": { "post": { - "description": "Search Wiki in Feishu Spaces", + "description": "Upload File", "consumes": [ - "application/json" - ], - "produces": [ - "application/json" + "multipart/form-data" ], "tags": [ - "crawler" + "file" ], - "summary": "FeishuWikiSearch", + "summary": "Upload File", "parameters": [ { - "description": "Search Wiki", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.FeishuSearchWikiReq" - } + "type": "file", + "description": "File", + "name": "file", + "in": "formData", + "required": true + }, + { + "type": "string", + "description": "Knowledge Base ID", + "name": "kb_id", + "in": "formData" } ], "responses": { "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.FeishuSearchWikiResp" - } - } - } - } - ] + "$ref": "#/definitions/domain.ObjectUploadResp" } } } } }, - "/api/v1/crawler/mindoc/parse": { + "/api/v1/file/upload/anydoc": { "post": { - "description": "Parse Mindoc Export File and return document list", + "description": "Upload Anydoc File", "consumes": [ "multipart/form-data" ], - "produces": [ - "application/json" - ], "tags": [ - "crawler" + "file" ], - "summary": "MindocParse", + "summary": "Upload Anydoc File", "parameters": [ { "type": "file", - "description": "file", + "description": "File", "name": "file", "in": "formData", "required": true }, { "type": "string", - "description": "kb_id", - "name": "kb_id", + "description": "File Path", + "name": "path", "in": "formData", "required": true } @@ -1032,27 +980,15 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.MindocParseResp" - } - } - } - ] + "$ref": "#/definitions/domain.AnydocUploadResp" } } } } }, - "/api/v1/crawler/mindoc/scrape": { + "/api/v1/knowledge_base": { "post": { - "description": "Scrape specific Mindoc documents by ID", + "description": "CreateKnowledgeBase", "consumes": [ "application/json" ], @@ -1060,17 +996,17 @@ const docTemplate = `{ "application/json" ], "tags": [ - "crawler" + "knowledge_base" ], - "summary": "MindocScrape", + "summary": "CreateKnowledgeBase", "parameters": [ { - "description": "Scrape Request", + "description": "CreateKnowledgeBase Request", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.MindocScrapeReq" + "$ref": "#/definitions/domain.CreateKnowledgeBaseReq" } } ], @@ -1078,27 +1014,20 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.MindocScrapeResp" - } - } - } - ] + "$ref": "#/definitions/domain.Response" } } } } }, - "/api/v1/crawler/notion/parse": { - "post": { - "description": "NotionParse", + "/api/v1/knowledge_base/detail": { + "get": { + "security": [ + { + "bearerAuth": [] + } + ], + "description": "GetKnowledgeBaseDetail", "consumes": [ "application/json" ], @@ -1106,18 +1035,16 @@ const docTemplate = `{ "application/json" ], "tags": [ - "crawler" + "knowledge_base" ], - "summary": "NotionParse", + "summary": "GetKnowledgeBaseDetail", "parameters": [ { - "description": "Scrape", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.NotionParseReq" - } + "type": "string", + "description": "Knowledge Base ID", + "name": "id", + "in": "query", + "required": true } ], "responses": { @@ -1132,7 +1059,7 @@ const docTemplate = `{ "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.NotionParseResp" + "$ref": "#/definitions/domain.KnowledgeBaseDetail" } } } @@ -1140,11 +1067,9 @@ const docTemplate = `{ } } } - } - }, - "/api/v1/crawler/notion/scrape": { - "post": { - "description": "NotionScrape", + }, + "put": { + "description": "UpdateKnowledgeBase", "consumes": [ "application/json" ], @@ -1152,17 +1077,17 @@ const docTemplate = `{ "application/json" ], "tags": [ - "crawler" + "knowledge_base" ], - "summary": "NotionScrape", + "summary": "UpdateKnowledgeBase", "parameters": [ { - "description": "Get Docs", + "description": "UpdateKnowledgeBase Request", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.NotionScrapeReq" + "$ref": "#/definitions/domain.UpdateKnowledgeBaseReq" } } ], @@ -1170,27 +1095,13 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.NotionScrapeResp" - } - } - } - ] + "$ref": "#/definitions/domain.Response" } } } - } - }, - "/api/v1/crawler/result": { - "get": { - "description": "Retrieve the result of a previously started scraping task", + }, + "delete": { + "description": "DeleteKnowledgeBase", "consumes": [ "application/json" ], @@ -1198,13 +1109,14 @@ const docTemplate = `{ "application/json" ], "tags": [ - "crawler" + "knowledge_base" ], - "summary": "Get Crawler Result", + "summary": "DeleteKnowledgeBase", "parameters": [ { "type": "string", - "name": "task_id", + "description": "Knowledge Base ID", + "name": "id", "in": "query", "required": true } @@ -1213,27 +1125,15 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.CrawlerResultResp" - } - } - } - ] + "$ref": "#/definitions/domain.Response" } } } } }, - "/api/v1/crawler/results": { - "post": { - "description": "Retrieve the results of a previously started scraping task", + "/api/v1/knowledge_base/list": { + "get": { + "description": "GetKnowledgeBaseList", "consumes": [ "application/json" ], @@ -1241,20 +1141,9 @@ const docTemplate = `{ "application/json" ], "tags": [ - "crawler" - ], - "summary": "Get Crawler Results", - "parameters": [ - { - "description": "Crawler Results Request", - "name": "param", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.CrawlerResultsReq" - } - } + "knowledge_base" ], + "summary": "GetKnowledgeBaseList", "responses": { "200": { "description": "OK", @@ -1267,7 +1156,10 @@ const docTemplate = `{ "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.CrawlerResultsResp" + "type": "array", + "items": { + "$ref": "#/definitions/domain.KnowledgeBaseListItem" + } } } } @@ -1277,9 +1169,9 @@ const docTemplate = `{ } } }, - "/api/v1/crawler/rss/parse": { + "/api/v1/knowledge_base/release": { "post": { - "description": "Parse RSS", + "description": "CreateKBRelease", "consumes": [ "application/json" ], @@ -1287,17 +1179,17 @@ const docTemplate = `{ "application/json" ], "tags": [ - "crawler" + "knowledge_base" ], - "summary": "Parse RSS", + "summary": "CreateKBRelease", "parameters": [ { - "description": "Parse URL", + "description": "CreateKBRelease Request", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.RssParseReq" + "$ref": "#/definitions/domain.CreateKBReleaseReq" } } ], @@ -1305,27 +1197,15 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.RssParseResp" - } - } - } - ] + "$ref": "#/definitions/domain.Response" } } } } }, - "/api/v1/crawler/rss/scrape": { - "post": { - "description": "RSSScrape", + "/api/v1/knowledge_base/release/list": { + "get": { + "description": "GetKBReleaseList", "consumes": [ "application/json" ], @@ -1333,18 +1213,16 @@ const docTemplate = `{ "application/json" ], "tags": [ - "crawler" + "knowledge_base" ], - "summary": "RSSScrape", + "summary": "GetKBReleaseList", "parameters": [ { - "description": "Parse URL", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.RssScrapeReq" - } + "type": "string", + "description": "Knowledge Base ID", + "name": "kb_id", + "in": "query", + "required": true } ], "responses": { @@ -1359,7 +1237,7 @@ const docTemplate = `{ "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.RssScrapeResp" + "$ref": "#/definitions/domain.GetKBReleaseListResp" } } } @@ -1369,9 +1247,14 @@ const docTemplate = `{ } } }, - "/api/v1/crawler/scrape": { - "post": { - "description": "Scrape", + "/api/v1/knowledge_base/user/delete": { + "delete": { + "security": [ + { + "bearerAuth": [] + } + ], + "description": "Remove user from knowledge base", "consumes": [ "application/json" ], @@ -1379,45 +1262,41 @@ const docTemplate = `{ "application/json" ], "tags": [ - "crawler" + "knowledge_base" ], - "summary": "Scrape", + "summary": "KBUserDelete", "parameters": [ { - "description": "Scrape", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.ScrapeReq" - } + "type": "string", + "name": "kb_id", + "in": "query", + "required": true + }, + { + "type": "string", + "name": "user_id", + "in": "query", + "required": true } ], "responses": { "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.ScrapeResp" - } - } - } - ] + "$ref": "#/definitions/domain.Response" } } } } }, - "/api/v1/crawler/sitemap/parse": { + "/api/v1/knowledge_base/user/invite": { "post": { - "description": "Parse Sitemap", + "security": [ + { + "bearerAuth": [] + } + ], + "description": "Invite user to knowledge base", "consumes": [ "application/json" ], @@ -1425,17 +1304,17 @@ const docTemplate = `{ "application/json" ], "tags": [ - "crawler" + "knowledge_base" ], - "summary": "Parse Sitemap", + "summary": "KBUserInvite", "parameters": [ { - "description": "Parse URL", - "name": "body", + "description": "Invite User Request", + "name": "param", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.SitemapParseReq" + "$ref": "#/definitions/v1.KBUserInviteReq" } } ], @@ -1443,27 +1322,20 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.SitemapParseResp" - } - } - } - ] + "$ref": "#/definitions/domain.Response" } } } } }, - "/api/v1/crawler/sitemap/scrape": { - "post": { - "description": "SitemapScrape", + "/api/v1/knowledge_base/user/list": { + "get": { + "security": [ + { + "bearerAuth": [] + } + ], + "description": "KBUserList", "consumes": [ "application/json" ], @@ -1471,18 +1343,16 @@ const docTemplate = `{ "application/json" ], "tags": [ - "crawler" + "knowledge_base" ], - "summary": "SitemapScrape", + "summary": "KBUserList", "parameters": [ { - "description": "Parse URL", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.SitemapScrapeReq" - } + "type": "string", + "description": "Knowledge Base ID", + "name": "kb_id", + "in": "query", + "required": true } ], "responses": { @@ -1497,7 +1367,10 @@ const docTemplate = `{ "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.SitemapScrapeResp" + "type": "array", + "items": { + "$ref": "#/definitions/v1.KBUserListItemResp" + } } } } @@ -1507,60 +1380,48 @@ const docTemplate = `{ } } }, - "/api/v1/crawler/siyuan/parse": { - "post": { - "description": "Parse Siyuan Export File and return document list", + "/api/v1/knowledge_base/user/update": { + "patch": { + "security": [ + { + "bearerAuth": [] + } + ], + "description": "Update user permission in knowledge base", "consumes": [ - "multipart/form-data" + "application/json" ], "produces": [ "application/json" ], "tags": [ - "crawler" + "knowledge_base" ], - "summary": "SiyuanParse", + "summary": "KBUserUpdate", "parameters": [ { - "type": "file", - "description": "file", - "name": "file", - "in": "formData", - "required": true - }, - { - "type": "string", - "description": "kb_id", - "name": "kb_id", - "in": "formData", - "required": true + "description": "Update User Permission Request", + "name": "param", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.KBUserUpdateReq" + } } ], "responses": { "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.SiyuanParseResp" - } - } - } - ] + "$ref": "#/definitions/domain.Response" } } } } }, - "/api/v1/crawler/siyuan/scrape": { - "post": { - "description": "Scrape specific Siyuan documents by ID", + "/api/v1/model": { + "put": { + "description": "update model", "consumes": [ "application/json" ], @@ -1568,17 +1429,16 @@ const docTemplate = `{ "application/json" ], "tags": [ - "crawler" + "model" ], - "summary": "SiyuanScrape", "parameters": [ { - "description": "Scrape Request", - "name": "body", + "description": "update model request", + "name": "model", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.SiyuanScrapeReq" + "$ref": "#/definitions/domain.UpdateModelReq" } } ], @@ -1586,78 +1446,47 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.SiyuanScrapeResp" - } - } - } - ] + "$ref": "#/definitions/domain.Response" } } } - } - }, - "/api/v1/crawler/wikijs/parse": { + }, "post": { - "description": "Parse Wikijs Export File and return document list", + "description": "create model", "consumes": [ - "multipart/form-data" + "application/json" ], "produces": [ "application/json" ], "tags": [ - "crawler" + "model" ], - "summary": "WikijsParse", + "summary": "create model", "parameters": [ { - "type": "file", - "description": "file", - "name": "file", - "in": "formData", - "required": true - }, - { - "type": "string", - "description": "kb_id", - "name": "kb_id", - "in": "formData", - "required": true + "description": "create model request", + "name": "model", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.CreateModelReq" + } } ], "responses": { "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.WikijsParseResp" - } - } - } - ] + "$ref": "#/definitions/domain.Response" } } } } }, - "/api/v1/crawler/wikijs/scrape": { + "/api/v1/model/check": { "post": { - "description": "Scrape specific Wikijs documents by ID", + "description": "check model", "consumes": [ "application/json" ], @@ -1665,17 +1494,17 @@ const docTemplate = `{ "application/json" ], "tags": [ - "crawler" + "model" ], - "summary": "WikijsScrape", + "summary": "check model", "parameters": [ { - "description": "Scrape Request", - "name": "body", + "description": "check model request", + "name": "model", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.WikijsScrapeReq" + "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.CheckModelReq" } } ], @@ -1685,13 +1514,13 @@ const docTemplate = `{ "schema": { "allOf": [ { - "$ref": "#/definitions/domain.PWResponse" + "$ref": "#/definitions/domain.Response" }, { "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.WikijsScrapeResp" + "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.CheckModelResp" } } } @@ -1701,9 +1530,9 @@ const docTemplate = `{ } } }, - "/api/v1/crawler/yuque/parse": { - "post": { - "description": "YuqueParse", + "/api/v1/model/list": { + "get": { + "description": "get model list", "consumes": [ "application/json" ], @@ -1711,20 +1540,9 @@ const docTemplate = `{ "application/json" ], "tags": [ - "crawler" - ], - "summary": "YuqueParse", - "parameters": [ - { - "description": "Parse URL", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.YuqueParseReq" - } - } + "model" ], + "summary": "get model list", "responses": { "200": { "description": "OK", @@ -1737,7 +1555,7 @@ const docTemplate = `{ "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.YuqueParseResp" + "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelListItem" } } } @@ -1747,9 +1565,9 @@ const docTemplate = `{ } } }, - "/api/v1/creation/tab-complete": { + "/api/v1/model/provider/supported": { "post": { - "description": "Tab-based document completion similar to AI coding's FIM (Fill in Middle)", + "description": "get provider supported model list", "consumes": [ "application/json" ], @@ -1757,33 +1575,50 @@ const docTemplate = `{ "application/json" ], "tags": [ - "creation" + "model" ], - "summary": "Tab-based document completion", + "summary": "get provider supported model list", "parameters": [ { - "description": "tab completion request", - "name": "body", + "description": "get supported model list request", + "name": "params", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/domain.CompleteReq" + "$ref": "#/definitions/domain.GetProviderModelListReq" } } ], "responses": { "200": { - "description": "success", + "description": "OK", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/domain.PWResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/domain.GetProviderModelListResp" + } + } + } + ] } } } } }, - "/api/v1/creation/text": { + "/api/v1/node": { "post": { - "description": "Text creation", + "security": [ + { + "bearerAuth": [] + } + ], + "description": "Create Node", "consumes": [ "application/json" ], @@ -1791,104 +1626,107 @@ const docTemplate = `{ "application/json" ], "tags": [ - "creation" + "node" ], - "summary": "Text creation", + "summary": "Create Node", "parameters": [ { - "description": "text creation request", + "description": "Node", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/domain.TextReq" + "$ref": "#/definitions/domain.CreateNodeReq" } } ], "responses": { "200": { - "description": "success", + "description": "OK", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/domain.PWResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + ] } } } } }, - "/api/v1/file/upload": { + "/api/v1/node/action": { "post": { - "description": "Upload File", - "consumes": [ - "multipart/form-data" - ], - "tags": [ - "file" - ], - "summary": "Upload File", - "parameters": [ - { - "type": "file", - "description": "File", - "name": "file", - "in": "formData", - "required": true - }, + "security": [ { - "type": "string", - "description": "Knowledge Base ID", - "name": "kb_id", - "in": "formData" + "bearerAuth": [] } ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.ObjectUploadResp" - } - } - } - } - }, - "/api/v1/file/upload/anydoc": { - "post": { - "description": "Upload Anydoc File", + "description": "Node Action", "consumes": [ - "multipart/form-data" + "application/json" + ], + "produces": [ + "application/json" ], "tags": [ - "file" + "node" ], - "summary": "Upload Anydoc File", + "summary": "Node Action", "parameters": [ { - "type": "file", - "description": "File", - "name": "file", - "in": "formData", - "required": true - }, - { - "type": "string", - "description": "File Path", - "name": "path", - "in": "formData", - "required": true + "description": "Action", + "name": "action", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.NodeActionReq" + } } ], "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/domain.AnydocUploadResp" + "allOf": [ + { + "$ref": "#/definitions/domain.PWResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + ] } } } } }, - "/api/v1/knowledge_base": { + "/api/v1/node/batch_move": { "post": { - "description": "CreateKnowledgeBase", + "security": [ + { + "bearerAuth": [] + } + ], + "description": "Batch Move Node", "consumes": [ "application/json" ], @@ -1896,17 +1734,17 @@ const docTemplate = `{ "application/json" ], "tags": [ - "knowledge_base" + "node" ], - "summary": "CreateKnowledgeBase", + "summary": "Batch Move Node", "parameters": [ { - "description": "CreateKnowledgeBase Request", + "description": "Batch Move Node", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/domain.CreateKnowledgeBaseReq" + "$ref": "#/definitions/domain.BatchMoveReq" } } ], @@ -1920,14 +1758,14 @@ const docTemplate = `{ } } }, - "/api/v1/knowledge_base/detail": { + "/api/v1/node/detail": { "get": { "security": [ { "bearerAuth": [] } ], - "description": "GetKnowledgeBaseDetail", + "description": "Get Node Detail", "consumes": [ "application/json" ], @@ -1935,16 +1773,26 @@ const docTemplate = `{ "application/json" ], "tags": [ - "knowledge_base" + "node" ], - "summary": "GetKnowledgeBaseDetail", + "summary": "Get Node Detail", "parameters": [ { "type": "string", - "description": "Knowledge Base ID", + "name": "format", + "in": "query" + }, + { + "type": "string", "name": "id", "in": "query", "required": true + }, + { + "type": "string", + "name": "kb_id", + "in": "query", + "required": true } ], "responses": { @@ -1959,7 +1807,7 @@ const docTemplate = `{ "type": "object", "properties": { "data": { - "$ref": "#/definitions/domain.KnowledgeBaseDetail" + "$ref": "#/definitions/v1.NodeDetailResp" } } } @@ -1969,7 +1817,12 @@ const docTemplate = `{ } }, "put": { - "description": "UpdateKnowledgeBase", + "security": [ + { + "bearerAuth": [] + } + ], + "description": "Update Node Detail", "consumes": [ "application/json" ], @@ -1977,17 +1830,17 @@ const docTemplate = `{ "application/json" ], "tags": [ - "knowledge_base" + "node" ], - "summary": "UpdateKnowledgeBase", + "summary": "Update Node Detail", "parameters": [ { - "description": "UpdateKnowledgeBase Request", + "description": "Node", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/domain.UpdateKnowledgeBaseReq" + "$ref": "#/definitions/domain.UpdateNodeReq" } } ], @@ -1999,9 +1852,16 @@ const docTemplate = `{ } } } - }, - "delete": { - "description": "DeleteKnowledgeBase", + } + }, + "/api/v1/node/list": { + "get": { + "security": [ + { + "bearerAuth": [] + } + ], + "description": "Get Node List", "consumes": [ "application/json" ], @@ -2009,41 +1869,22 @@ const docTemplate = `{ "application/json" ], "tags": [ - "knowledge_base" + "node" ], - "summary": "DeleteKnowledgeBase", + "summary": "Get Node List", "parameters": [ { "type": "string", - "description": "Knowledge Base ID", - "name": "id", + "name": "kb_id", "in": "query", "required": true + }, + { + "type": "string", + "name": "search", + "in": "query" } ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.Response" - } - } - } - } - }, - "/api/v1/knowledge_base/list": { - "get": { - "description": "GetKnowledgeBaseList", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "knowledge_base" - ], - "summary": "GetKnowledgeBaseList", "responses": { "200": { "description": "OK", @@ -2058,7 +1899,7 @@ const docTemplate = `{ "data": { "type": "array", "items": { - "$ref": "#/definitions/domain.KnowledgeBaseListItem" + "$ref": "#/definitions/domain.NodeListItemResp" } } } @@ -2069,9 +1910,14 @@ const docTemplate = `{ } } }, - "/api/v1/knowledge_base/release": { + "/api/v1/node/move": { "post": { - "description": "CreateKBRelease", + "security": [ + { + "bearerAuth": [] + } + ], + "description": "Move Node", "consumes": [ "application/json" ], @@ -2079,17 +1925,17 @@ const docTemplate = `{ "application/json" ], "tags": [ - "knowledge_base" + "node" ], - "summary": "CreateKBRelease", + "summary": "Move Node", "parameters": [ { - "description": "CreateKBRelease Request", + "description": "Move Node", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/domain.CreateKBReleaseReq" + "$ref": "#/definitions/domain.MoveNodeReq" } } ], @@ -2103,9 +1949,14 @@ const docTemplate = `{ } } }, - "/api/v1/knowledge_base/release/list": { + "/api/v1/node/permission": { "get": { - "description": "GetKBReleaseList", + "security": [ + { + "bearerAuth": [] + } + ], + "description": "文档授权信息获取", "consumes": [ "application/json" ], @@ -2113,13 +1964,19 @@ const docTemplate = `{ "application/json" ], "tags": [ - "knowledge_base" + "NodePermission" ], - "summary": "GetKBReleaseList", + "summary": "文档授权信息获取", + "operationId": "v1-NodePermission", "parameters": [ { "type": "string", - "description": "Knowledge Base ID", + "name": "id", + "in": "query", + "required": true + }, + { + "type": "string", "name": "kb_id", "in": "query", "required": true @@ -2131,13 +1988,13 @@ const docTemplate = `{ "schema": { "allOf": [ { - "$ref": "#/definitions/domain.PWResponse" + "$ref": "#/definitions/domain.Response" }, { "type": "object", "properties": { "data": { - "$ref": "#/definitions/domain.GetKBReleaseListResp" + "$ref": "#/definitions/v1.NodePermissionResp" } } } @@ -2147,56 +2004,14 @@ const docTemplate = `{ } } }, - "/api/v1/knowledge_base/user/delete": { - "delete": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "Remove user from knowledge base", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "knowledge_base" - ], - "summary": "KBUserDelete", - "parameters": [ - { - "type": "string", - "name": "kb_id", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "user_id", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.Response" - } - } - } - } - }, - "/api/v1/knowledge_base/user/invite": { - "post": { + "/api/v1/node/permission/edit": { + "patch": { "security": [ { "bearerAuth": [] } ], - "description": "Invite user to knowledge base", + "description": "文档授权信息更新", "consumes": [ "application/json" ], @@ -2204,17 +2019,18 @@ const docTemplate = `{ "application/json" ], "tags": [ - "knowledge_base" + "NodePermission" ], - "summary": "KBUserInvite", + "summary": "文档授权信息更新", + "operationId": "v1-NodePermissionEdit", "parameters": [ { - "description": "Invite User Request", + "description": "para", "name": "param", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.KBUserInviteReq" + "$ref": "#/definitions/v1.NodePermissionEditReq" } } ], @@ -2222,20 +2038,32 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/domain.Response" + "allOf": [ + { + "$ref": "#/definitions/domain.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/v1.NodePermissionEditResp" + } + } + } + ] } } } } }, - "/api/v1/knowledge_base/user/list": { + "/api/v1/node/recommend_nodes": { "get": { "security": [ { "bearerAuth": [] } ], - "description": "KBUserList", + "description": "Recommend Nodes", "consumes": [ "application/json" ], @@ -2243,16 +2071,25 @@ const docTemplate = `{ "application/json" ], "tags": [ - "knowledge_base" + "node" ], - "summary": "KBUserList", + "summary": "Recommend Nodes", "parameters": [ { "type": "string", - "description": "Knowledge Base ID", "name": "kb_id", "in": "query", "required": true + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "csv", + "name": "node_ids", + "in": "query", + "required": true } ], "responses": { @@ -2269,7 +2106,7 @@ const docTemplate = `{ "data": { "type": "array", "items": { - "$ref": "#/definitions/v1.KBUserListItemResp" + "$ref": "#/definitions/domain.RecommendNodeListResp" } } } @@ -2280,14 +2117,14 @@ const docTemplate = `{ } } }, - "/api/v1/knowledge_base/user/update": { - "patch": { + "/api/v1/node/summary": { + "post": { "security": [ { "bearerAuth": [] } ], - "description": "Update user permission in knowledge base", + "description": "Summary Node", "consumes": [ "application/json" ], @@ -2295,17 +2132,17 @@ const docTemplate = `{ "application/json" ], "tags": [ - "knowledge_base" + "node" ], - "summary": "KBUserUpdate", + "summary": "Summary Node", "parameters": [ { - "description": "Update User Permission Request", - "name": "param", + "description": "Summary Node", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.KBUserUpdateReq" + "$ref": "#/definitions/domain.NodeSummaryReq" } } ], @@ -2319,9 +2156,14 @@ const docTemplate = `{ } } }, - "/api/v1/model": { - "put": { - "description": "update model", + "/api/v1/stat/browsers": { + "get": { + "security": [ + { + "bearerAuth": [] + } + ], + "description": "客户端统计", "consumes": [ "application/json" ], @@ -2329,30 +2171,64 @@ const docTemplate = `{ "application/json" ], "tags": [ - "model" + "stat" ], + "summary": "客户端统计", "parameters": [ { - "description": "update model request", - "name": "model", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.UpdateModelReq" - } + "enum": [ + 1, + 7, + 30, + 90 + ], + "type": "integer", + "x-enum-varnames": [ + "StatDay1", + "StatDay7", + "StatDay30", + "StatDay90" + ], + "name": "day", + "in": "query" + }, + { + "type": "string", + "name": "kb_id", + "in": "query", + "required": true } ], "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/domain.Response" + "allOf": [ + { + "$ref": "#/definitions/domain.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/domain.HotBrowser" + } + } + } + ] } } } - }, - "post": { - "description": "create model", + } + }, + "/api/v1/stat/conversation_distribution": { + "get": { + "security": [ + { + "bearerAuth": [] + } + ], + "description": "问答来源", "consumes": [ "application/json" ], @@ -2360,33 +2236,67 @@ const docTemplate = `{ "application/json" ], "tags": [ - "model" + "stat" ], - "summary": "create model", + "summary": "问答来源", "parameters": [ { - "description": "create model request", - "name": "model", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.CreateModelReq" - } + "enum": [ + 1, + 7, + 30, + 90 + ], + "type": "integer", + "x-enum-varnames": [ + "StatDay1", + "StatDay7", + "StatDay30", + "StatDay90" + ], + "name": "day", + "in": "query" + }, + { + "type": "string", + "name": "kb_id", + "in": "query", + "required": true } ], "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/domain.Response" + "allOf": [ + { + "$ref": "#/definitions/domain.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.ConversationDistribution" + } + } + } + } + ] } } } } }, - "/api/v1/model/check": { - "post": { - "description": "check model", + "/api/v1/stat/count": { + "get": { + "security": [ + { + "bearerAuth": [] + } + ], + "description": "全局统计", "consumes": [ "application/json" ], @@ -2394,18 +2304,32 @@ const docTemplate = `{ "application/json" ], "tags": [ - "model" + "stat" ], - "summary": "check model", + "summary": "全局统计", "parameters": [ { - "description": "check model request", - "name": "model", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.CheckModelReq" - } + "enum": [ + 1, + 7, + 30, + 90 + ], + "type": "integer", + "x-enum-varnames": [ + "StatDay1", + "StatDay7", + "StatDay30", + "StatDay90" + ], + "name": "day", + "in": "query" + }, + { + "type": "string", + "name": "kb_id", + "in": "query", + "required": true } ], "responses": { @@ -2414,13 +2338,13 @@ const docTemplate = `{ "schema": { "allOf": [ { - "$ref": "#/definitions/domain.Response" + "$ref": "#/definitions/domain.PWResponse" }, { "type": "object", "properties": { "data": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.CheckModelResp" + "$ref": "#/definitions/v1.StatCountResp" } } } @@ -2430,9 +2354,14 @@ const docTemplate = `{ } } }, - "/api/v1/model/list": { + "/api/v1/stat/geo_count": { "get": { - "description": "get model list", + "security": [ + { + "bearerAuth": [] + } + ], + "description": "用户地理分布", "consumes": [ "application/json" ], @@ -2440,34 +2369,52 @@ const docTemplate = `{ "application/json" ], "tags": [ - "model" + "stat" + ], + "summary": "用户地理分布", + "parameters": [ + { + "enum": [ + 1, + 7, + 30, + 90 + ], + "type": "integer", + "x-enum-varnames": [ + "StatDay1", + "StatDay7", + "StatDay30", + "StatDay90" + ], + "name": "day", + "in": "query" + }, + { + "type": "string", + "name": "kb_id", + "in": "query", + "required": true + } ], - "summary": "get model list", "responses": { "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelListItem" - } - } - } - ] + "$ref": "#/definitions/domain.Response" } } } } }, - "/api/v1/model/provider/supported": { - "post": { - "description": "get provider supported model list", + "/api/v1/stat/hot_pages": { + "get": { + "security": [ + { + "bearerAuth": [] + } + ], + "description": "热门文档", "consumes": [ "application/json" ], @@ -2475,18 +2422,32 @@ const docTemplate = `{ "application/json" ], "tags": [ - "model" + "stat" ], - "summary": "get provider supported model list", + "summary": "热门文档", "parameters": [ { - "description": "get supported model list request", - "name": "params", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.GetProviderModelListReq" - } + "enum": [ + 1, + 7, + 30, + 90 + ], + "type": "integer", + "x-enum-varnames": [ + "StatDay1", + "StatDay7", + "StatDay30", + "StatDay90" + ], + "name": "day", + "in": "query" + }, + { + "type": "string", + "name": "kb_id", + "in": "query", + "required": true } ], "responses": { @@ -2495,13 +2456,16 @@ const docTemplate = `{ "schema": { "allOf": [ { - "$ref": "#/definitions/domain.PWResponse" + "$ref": "#/definitions/domain.Response" }, { "type": "object", "properties": { "data": { - "$ref": "#/definitions/domain.GetProviderModelListResp" + "type": "array", + "items": { + "$ref": "#/definitions/domain.HotPage" + } } } } @@ -2511,14 +2475,14 @@ const docTemplate = `{ } } }, - "/api/v1/node": { - "post": { + "/api/v1/stat/instant_count": { + "get": { "security": [ { "bearerAuth": [] } ], - "description": "Create Node", + "description": "GetInstantCount", "consumes": [ "application/json" ], @@ -2526,18 +2490,15 @@ const docTemplate = `{ "application/json" ], "tags": [ - "node" + "stat" ], - "summary": "Create Node", + "summary": "GetInstantCount", "parameters": [ { - "description": "Node", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.CreateNodeReq" - } + "type": "string", + "name": "kb_id", + "in": "query", + "required": true } ], "responses": { @@ -2546,15 +2507,15 @@ const docTemplate = `{ "schema": { "allOf": [ { - "$ref": "#/definitions/domain.PWResponse" + "$ref": "#/definitions/domain.Response" }, { "type": "object", "properties": { "data": { - "type": "object", - "additionalProperties": { - "type": "string" + "type": "array", + "items": { + "$ref": "#/definitions/domain.InstantCountResp" } } } @@ -2565,14 +2526,14 @@ const docTemplate = `{ } } }, - "/api/v1/node/action": { - "post": { + "/api/v1/stat/instant_pages": { + "get": { "security": [ { "bearerAuth": [] } ], - "description": "Node Action", + "description": "GetInstantPages", "consumes": [ "application/json" ], @@ -2580,18 +2541,15 @@ const docTemplate = `{ "application/json" ], "tags": [ - "node" + "stat" ], - "summary": "Node Action", + "summary": "GetInstantPages", "parameters": [ { - "description": "Action", - "name": "action", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.NodeActionReq" - } + "type": "string", + "name": "kb_id", + "in": "query", + "required": true } ], "responses": { @@ -2600,15 +2558,15 @@ const docTemplate = `{ "schema": { "allOf": [ { - "$ref": "#/definitions/domain.PWResponse" + "$ref": "#/definitions/domain.Response" }, { "type": "object", "properties": { "data": { - "type": "object", - "additionalProperties": { - "type": "string" + "type": "array", + "items": { + "$ref": "#/definitions/domain.InstantPageResp" } } } @@ -2619,14 +2577,14 @@ const docTemplate = `{ } } }, - "/api/v1/node/batch_move": { - "post": { + "/api/v1/stat/referer_hosts": { + "get": { "security": [ { "bearerAuth": [] } ], - "description": "Batch Move Node", + "description": "来源域名", "consumes": [ "application/json" ], @@ -2634,38 +2592,82 @@ const docTemplate = `{ "application/json" ], "tags": [ - "node" + "stat" ], - "summary": "Batch Move Node", + "summary": "来源域名", "parameters": [ { - "description": "Batch Move Node", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.BatchMoveReq" - } + "enum": [ + 1, + 7, + 30, + 90 + ], + "type": "integer", + "x-enum-varnames": [ + "StatDay1", + "StatDay7", + "StatDay30", + "StatDay90" + ], + "name": "day", + "in": "query" + }, + { + "type": "string", + "name": "kb_id", + "in": "query", + "required": true } ], "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/domain.Response" + "allOf": [ + { + "$ref": "#/definitions/domain.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.HotRefererHost" + } + } + } + } + ] } } } } }, - "/api/v1/node/detail": { + "/api/v1/user": { "get": { - "security": [ - { - "bearerAuth": [] - } + "description": "GetUser", + "consumes": [ + "application/json" ], - "description": "Get Node Detail", + "tags": [ + "user" + ], + "summary": "GetUser", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1.UserInfoResp" + } + } + } + } + }, + "/api/v1/user/create": { + "post": { + "description": "CreateUser", "consumes": [ "application/json" ], @@ -2673,26 +2675,18 @@ const docTemplate = `{ "application/json" ], "tags": [ - "node" + "user" ], - "summary": "Get Node Detail", + "summary": "CreateUser", "parameters": [ { - "type": "string", - "name": "format", - "in": "query" - }, - { - "type": "string", - "name": "id", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "kb_id", - "in": "query", - "required": true + "description": "CreateUser Request", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.CreateUserReq" + } } ], "responses": { @@ -2701,13 +2695,13 @@ const docTemplate = `{ "schema": { "allOf": [ { - "$ref": "#/definitions/domain.PWResponse" + "$ref": "#/definitions/domain.Response" }, { "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.NodeDetailResp" + "$ref": "#/definitions/v1.CreateUserResp" } } } @@ -2715,14 +2709,11 @@ const docTemplate = `{ } } } - }, - "put": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "Update Node Detail", + } + }, + "/api/v1/user/delete": { + "delete": { + "description": "DeleteUser", "consumes": [ "application/json" ], @@ -2730,18 +2721,15 @@ const docTemplate = `{ "application/json" ], "tags": [ - "node" + "user" ], - "summary": "Update Node Detail", + "summary": "DeleteUser", "parameters": [ { - "description": "Node", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.UpdateNodeReq" - } + "type": "string", + "name": "user_id", + "in": "query", + "required": true } ], "responses": { @@ -2754,14 +2742,9 @@ const docTemplate = `{ } } }, - "/api/v1/node/list": { + "/api/v1/user/list": { "get": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "Get Node List", + "description": "ListUsers", "consumes": [ "application/json" ], @@ -2769,22 +2752,9 @@ const docTemplate = `{ "application/json" ], "tags": [ - "node" - ], - "summary": "Get Node List", - "parameters": [ - { - "type": "string", - "name": "kb_id", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "search", - "in": "query" - } + "user" ], + "summary": "ListUsers", "responses": { "200": { "description": "OK", @@ -2797,10 +2767,7 @@ const docTemplate = `{ "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.NodeListItemResp" - } + "$ref": "#/definitions/v1.UserListResp" } } } @@ -2810,14 +2777,43 @@ const docTemplate = `{ } } }, - "/api/v1/node/move": { + "/api/v1/user/login": { "post": { - "security": [ + "description": "Login", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Login", + "parameters": [ { - "bearerAuth": [] + "description": "Login Request", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.LoginReq" + } } ], - "description": "Move Node", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1.LoginResp" + } + } + } + } + }, + "/api/v1/user/reset_password": { + "put": { + "description": "ResetPassword", "consumes": [ "application/json" ], @@ -2825,17 +2821,17 @@ const docTemplate = `{ "application/json" ], "tags": [ - "node" + "user" ], - "summary": "Move Node", + "summary": "ResetPassword", "parameters": [ { - "description": "Move Node", + "description": "ResetPassword Request", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/domain.MoveNodeReq" + "$ref": "#/definitions/v1.ResetPasswordReq" } } ], @@ -2849,14 +2845,9 @@ const docTemplate = `{ } } }, - "/api/v1/node/permission": { + "/share/v1/app/web/info": { "get": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "文档授权信息获取", + "description": "GetAppInfo", "consumes": [ "application/json" ], @@ -2864,21 +2855,15 @@ const docTemplate = `{ "application/json" ], "tags": [ - "NodePermission" + "share_app" ], - "summary": "文档授权信息获取", - "operationId": "v1-NodePermission", + "summary": "GetAppInfo", "parameters": [ { "type": "string", - "name": "id", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "kb_id", - "in": "query", + "description": "kb id", + "name": "X-KB-ID", + "in": "header", "required": true } ], @@ -2894,7 +2879,7 @@ const docTemplate = `{ "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.NodePermissionResp" + "$ref": "#/definitions/domain.AppInfoResp" } } } @@ -2904,14 +2889,9 @@ const docTemplate = `{ } } }, - "/api/v1/node/permission/edit": { - "patch": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "文档授权信息更新", + "/share/v1/app/wechat/service/answer": { + "get": { + "description": "GetWechatAnswer", "consumes": [ "application/json" ], @@ -2919,20 +2899,82 @@ const docTemplate = `{ "application/json" ], "tags": [ - "NodePermission" + "Wechat" ], - "summary": "文档授权信息更新", - "operationId": "v1-NodePermissionEdit", + "summary": "GetWechatAnswer", "parameters": [ { - "description": "para", - "name": "param", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.NodePermissionEditReq" + "type": "string", + "description": "conversation id", + "name": "id", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.Response" + } + } + } + } + }, + "/share/v1/app/widget/info": { + "get": { + "description": "GetWidgetAppInfo", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "share_app" + ], + "summary": "GetWidgetAppInfo", + "parameters": [ + { + "type": "string", + "description": "kb id", + "name": "X-KB-ID", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.Response" } } + } + } + }, + "/share/v1/auth/get": { + "get": { + "description": "AuthGet", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "share_auth" + ], + "summary": "AuthGet", + "operationId": "v1-AuthGet", + "parameters": [ + { + "type": "string", + "description": "kb_id", + "name": "X-KB-ID", + "in": "header", + "required": true + } ], "responses": { "200": { @@ -2940,13 +2982,13 @@ const docTemplate = `{ "schema": { "allOf": [ { - "$ref": "#/definitions/domain.Response" + "$ref": "#/definitions/domain.PWResponse" }, { "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.NodePermissionEditResp" + "$ref": "#/definitions/github_com_chaitin_panda-wiki_api_share_v1.AuthGetResp" } } } @@ -2956,14 +2998,9 @@ const docTemplate = `{ } } }, - "/api/v1/node/recommend_nodes": { - "get": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "Recommend Nodes", + "/share/v1/auth/github": { + "post": { + "description": "GitHub登录", "consumes": [ "application/json" ], @@ -2971,25 +3008,26 @@ const docTemplate = `{ "application/json" ], "tags": [ - "node" + "ShareAuth" ], - "summary": "Recommend Nodes", + "summary": "GitHub登录", + "operationId": "v1-AuthGitHub", "parameters": [ { "type": "string", - "name": "kb_id", - "in": "query", + "description": "kb id", + "name": "X-KB-ID", + "in": "header", "required": true }, { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "csv", - "name": "node_ids", - "in": "query", - "required": true + "description": "para", + "name": "param", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.AuthGitHubReq" + } } ], "responses": { @@ -3004,10 +3042,7 @@ const docTemplate = `{ "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.RecommendNodeListResp" - } + "$ref": "#/definitions/v1.AuthGitHubResp" } } } @@ -3017,14 +3052,9 @@ const docTemplate = `{ } } }, - "/api/v1/node/summary": { + "/share/v1/auth/login/simple": { "post": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "Summary Node", + "description": "AuthLoginSimple", "consumes": [ "application/json" ], @@ -3032,17 +3062,25 @@ const docTemplate = `{ "application/json" ], "tags": [ - "node" + "share_auth" ], - "summary": "Summary Node", + "summary": "AuthLoginSimple", + "operationId": "v1-AuthLoginSimple", "parameters": [ { - "description": "Summary Node", - "name": "body", + "type": "string", + "description": "kb_id", + "name": "X-KB-ID", + "in": "header", + "required": true + }, + { + "description": "para", + "name": "param", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/domain.NodeSummaryReq" + "$ref": "#/definitions/v1.AuthLoginSimpleReq" } } ], @@ -3056,14 +3094,9 @@ const docTemplate = `{ } } }, - "/api/v1/stat/browsers": { - "get": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "客户端统计", + "/share/v1/captcha/challenge": { + "post": { + "description": "CreateCaptcha", "consumes": [ "application/json" ], @@ -3071,31 +3104,15 @@ const docTemplate = `{ "application/json" ], "tags": [ - "stat" + "share_captcha" ], - "summary": "客户端统计", + "summary": "CreateCaptcha", "parameters": [ - { - "enum": [ - 1, - 7, - 30, - 90 - ], - "type": "integer", - "x-enum-varnames": [ - "StatDay1", - "StatDay7", - "StatDay30", - "StatDay90" - ], - "name": "day", - "in": "query" - }, { "type": "string", - "name": "kb_id", - "in": "query", + "description": "kb id", + "name": "X-KB-ID", + "in": "header", "required": true } ], @@ -3103,32 +3120,15 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.Response" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/domain.HotBrowser" - } - } - } - ] + "$ref": "#/definitions/gocap.ChallengeData" } } } } }, - "/api/v1/stat/conversation_distribution": { - "get": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "问答来源", + "/share/v1/captcha/redeem": { + "post": { + "description": "RedeemCaptcha", "consumes": [ "application/json" ], @@ -3136,67 +3136,40 @@ const docTemplate = `{ "application/json" ], "tags": [ - "stat" + "share_captcha" ], - "summary": "问答来源", + "summary": "RedeemCaptcha", "parameters": [ - { - "enum": [ - 1, - 7, - 30, - 90 - ], - "type": "integer", - "x-enum-varnames": [ - "StatDay1", - "StatDay7", - "StatDay30", - "StatDay90" - ], - "name": "day", - "in": "query" - }, { "type": "string", - "name": "kb_id", - "in": "query", + "description": "kb id", + "name": "X-KB-ID", + "in": "header", "required": true + }, + { + "description": "request", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/consts.RedeemCaptchaReq" + } } ], "responses": { "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.Response" - }, - { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.ConversationDistribution" - } - } - } - } - ] + "$ref": "#/definitions/gocap.VerificationResult" } } } } }, - "/api/v1/stat/count": { - "get": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "全局统计", + "/share/v1/chat/completions": { + "post": { + "description": "OpenAI API compatible chat completions endpoint", "consumes": [ "application/json" ], @@ -3204,64 +3177,46 @@ const docTemplate = `{ "application/json" ], "tags": [ - "stat" + "share_chat" ], - "summary": "全局统计", + "summary": "ChatCompletions", "parameters": [ - { - "enum": [ - 1, - 7, - 30, - 90 - ], - "type": "integer", - "x-enum-varnames": [ - "StatDay1", - "StatDay7", - "StatDay30", - "StatDay90" - ], - "name": "day", - "in": "query" - }, { "type": "string", - "name": "kb_id", - "in": "query", + "description": "Knowledge Base ID", + "name": "X-KB-ID", + "in": "header", "required": true + }, + { + "description": "OpenAI API request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.OpenAICompletionsRequest" + } } ], "responses": { "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.StatCountResp" - } - } - } - ] + "$ref": "#/definitions/domain.OpenAICompletionsResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/domain.OpenAIErrorResponse" } } } } }, - "/api/v1/stat/geo_count": { - "get": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "用户地理分布", + "/share/v1/chat/feedback": { + "post": { + "description": "Process user feedback for chat conversations", "consumes": [ "application/json" ], @@ -3269,32 +3224,18 @@ const docTemplate = `{ "application/json" ], "tags": [ - "stat" + "share_chat" ], - "summary": "用户地理分布", + "summary": "Handle chat feedback", "parameters": [ { - "enum": [ - 1, - 7, - 30, - 90 - ], - "type": "integer", - "x-enum-varnames": [ - "StatDay1", - "StatDay7", - "StatDay30", - "StatDay90" - ], - "name": "day", - "in": "query" - }, - { - "type": "string", - "name": "kb_id", - "in": "query", - "required": true + "description": "feedback request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.FeedbackRequest" + } } ], "responses": { @@ -3307,14 +3248,9 @@ const docTemplate = `{ } } }, - "/api/v1/stat/hot_pages": { - "get": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "热门文档", + "/share/v1/chat/message": { + "post": { + "description": "ChatMessage", "consumes": [ "application/json" ], @@ -3322,67 +3258,40 @@ const docTemplate = `{ "application/json" ], "tags": [ - "stat" + "share_chat" ], - "summary": "热门文档", + "summary": "ChatMessage", "parameters": [ - { - "enum": [ - 1, - 7, - 30, - 90 - ], - "type": "integer", - "x-enum-varnames": [ - "StatDay1", - "StatDay7", - "StatDay30", - "StatDay90" - ], - "name": "day", - "in": "query" - }, { "type": "string", - "name": "kb_id", + "description": "app type", + "name": "app_type", "in": "query", "required": true + }, + { + "description": "request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.ChatRequest" + } } ], "responses": { "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.Response" - }, - { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.HotPage" - } - } - } - } - ] + "$ref": "#/definitions/domain.Response" } } } } }, - "/api/v1/stat/instant_count": { - "get": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "GetInstantCount", + "/share/v1/chat/search": { + "post": { + "description": "ChatSearch", "consumes": [ "application/json" ], @@ -3390,15 +3299,18 @@ const docTemplate = `{ "application/json" ], "tags": [ - "stat" + "share_chat_search" ], - "summary": "GetInstantCount", + "summary": "ChatSearch", "parameters": [ { - "type": "string", - "name": "kb_id", - "in": "query", - "required": true + "description": "request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.ChatSearchReq" + } } ], "responses": { @@ -3413,10 +3325,7 @@ const docTemplate = `{ "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.InstantCountResp" - } + "$ref": "#/definitions/domain.ChatSearchResp" } } } @@ -3426,14 +3335,9 @@ const docTemplate = `{ } } }, - "/api/v1/stat/instant_pages": { - "get": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "GetInstantPages", + "/share/v1/chat/widget": { + "post": { + "description": "ChatWidget", "consumes": [ "application/json" ], @@ -3441,50 +3345,40 @@ const docTemplate = `{ "application/json" ], "tags": [ - "stat" + "share_chat" ], - "summary": "GetInstantPages", + "summary": "ChatWidget", "parameters": [ { "type": "string", - "name": "kb_id", + "description": "app type", + "name": "app_type", "in": "query", "required": true + }, + { + "description": "request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.ChatRequest" + } } ], "responses": { "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.Response" - }, - { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.InstantPageResp" - } - } - } - } - ] + "$ref": "#/definitions/domain.Response" } } } } }, - "/api/v1/stat/referer_hosts": { - "get": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "来源域名", + "/share/v1/comment": { + "post": { + "description": "CreateComment", "consumes": [ "application/json" ], @@ -3492,50 +3386,33 @@ const docTemplate = `{ "application/json" ], "tags": [ - "stat" + "share_comment" ], - "summary": "来源域名", + "summary": "CreateComment", "parameters": [ { - "enum": [ - 1, - 7, - 30, - 90 - ], - "type": "integer", - "x-enum-varnames": [ - "StatDay1", - "StatDay7", - "StatDay30", - "StatDay90" - ], - "name": "day", - "in": "query" - }, - { - "type": "string", - "name": "kb_id", - "in": "query", - "required": true + "description": "Comment", + "name": "comment", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.CommentReq" + } } ], "responses": { "200": { - "description": "OK", + "description": "CommentID", "schema": { "allOf": [ { - "$ref": "#/definitions/domain.Response" + "$ref": "#/definitions/domain.PWResponse" }, { "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.HotRefererHost" - } + "type": "string" } } } @@ -3545,29 +3422,9 @@ const docTemplate = `{ } } }, - "/api/v1/user": { + "/share/v1/comment/list": { "get": { - "description": "GetUser", - "consumes": [ - "application/json" - ], - "tags": [ - "user" - ], - "summary": "GetUser", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/v1.UserInfoResp" - } - } - } - } - }, - "/api/v1/user/create": { - "post": { - "description": "CreateUser", + "description": "GetCommentList", "consumes": [ "application/json" ], @@ -3575,33 +3432,31 @@ const docTemplate = `{ "application/json" ], "tags": [ - "user" + "share_comment" ], - "summary": "CreateUser", + "summary": "GetCommentList", "parameters": [ { - "description": "CreateUser Request", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.CreateUserReq" - } + "type": "string", + "description": "nodeID", + "name": "id", + "in": "query", + "required": true } ], "responses": { "200": { - "description": "OK", + "description": "CommentList", "schema": { "allOf": [ { - "$ref": "#/definitions/domain.Response" + "$ref": "#/definitions/domain.PWResponse" }, { "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.CreateUserResp" + "$ref": "#/definitions/share.ShareCommentLists" } } } @@ -3611,24 +3466,40 @@ const docTemplate = `{ } } }, - "/api/v1/user/delete": { - "delete": { - "description": "DeleteUser", + "/share/v1/common/file/upload": { + "post": { + "description": "前台用户上传文件,目前只支持图片文件上传", "consumes": [ - "application/json" + "multipart/form-data" ], "produces": [ "application/json" ], "tags": [ - "user" + "ShareFile" ], - "summary": "DeleteUser", + "summary": "文件上传", + "operationId": "share-FileUpload", "parameters": [ { "type": "string", - "name": "user_id", - "in": "query", + "description": "kb id", + "name": "X-KB-ID", + "in": "header", + "required": true + }, + { + "type": "file", + "description": "File", + "name": "file", + "in": "formData", + "required": true + }, + { + "type": "string", + "description": "captcha_token", + "name": "captcha_token", + "in": "formData", "required": true } ], @@ -3636,15 +3507,27 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/domain.Response" + "allOf": [ + { + "$ref": "#/definitions/domain.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/v1.FileUploadResp" + } + } + } + ] } } } } }, - "/api/v1/user/list": { + "/share/v1/conversation/detail": { "get": { - "description": "ListUsers", + "description": "GetConversationDetail", "consumes": [ "application/json" ], @@ -3652,9 +3535,25 @@ const docTemplate = `{ "application/json" ], "tags": [ - "user" + "share_conversation" + ], + "summary": "GetConversationDetail", + "parameters": [ + { + "type": "string", + "description": "kb id", + "name": "X-KB-ID", + "in": "header", + "required": true + }, + { + "type": "string", + "description": "conversation id", + "name": "id", + "in": "query", + "required": true + } ], - "summary": "ListUsers", "responses": { "200": { "description": "OK", @@ -3667,7 +3566,7 @@ const docTemplate = `{ "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.UserListResp" + "$ref": "#/definitions/domain.ShareConversationDetailResp" } } } @@ -3677,9 +3576,9 @@ const docTemplate = `{ } } }, - "/api/v1/user/login": { - "post": { - "description": "Login", + "/share/v1/node/detail": { + "get": { + "description": "GetNodeDetail", "consumes": [ "application/json" ], @@ -3687,33 +3586,45 @@ const docTemplate = `{ "application/json" ], "tags": [ - "user" + "share_node" ], - "summary": "Login", + "summary": "GetNodeDetail", "parameters": [ { - "description": "Login Request", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.LoginReq" - } + "type": "string", + "description": "kb id", + "name": "X-KB-ID", + "in": "header", + "required": true + }, + { + "type": "string", + "description": "node id", + "name": "id", + "in": "query", + "required": true + }, + { + "type": "string", + "description": "format", + "name": "format", + "in": "query", + "required": true } ], "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.LoginResp" + "$ref": "#/definitions/domain.Response" } } } } }, - "/api/v1/user/reset_password": { - "put": { - "description": "ResetPassword", + "/share/v1/node/list": { + "get": { + "description": "GetNodeList", "consumes": [ "application/json" ], @@ -3721,18 +3632,16 @@ const docTemplate = `{ "application/json" ], "tags": [ - "user" + "share_node" ], - "summary": "ResetPassword", + "summary": "GetNodeList", "parameters": [ { - "description": "ResetPassword Request", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.ResetPasswordReq" - } + "type": "string", + "description": "kb id", + "name": "X-KB-ID", + "in": "header", + "required": true } ], "responses": { @@ -3745,9 +3654,9 @@ const docTemplate = `{ } } }, - "/share/v1/app/web/info": { + "/share/v1/openapi/github/callback": { "get": { - "description": "GetAppInfo", + "description": "GitHub回调", "consumes": [ "application/json" ], @@ -3755,16 +3664,20 @@ const docTemplate = `{ "application/json" ], "tags": [ - "share_app" + "ShareOpenapi" ], - "summary": "GetAppInfo", + "summary": "GitHub回调", + "operationId": "v1-GitHubCallback", "parameters": [ { "type": "string", - "description": "kb id", - "name": "X-KB-ID", - "in": "header", - "required": true + "name": "code", + "in": "query" + }, + { + "type": "string", + "name": "state", + "in": "query" } ], "responses": { @@ -3773,13 +3686,13 @@ const docTemplate = `{ "schema": { "allOf": [ { - "$ref": "#/definitions/domain.Response" + "$ref": "#/definitions/domain.PWResponse" }, { "type": "object", "properties": { "data": { - "$ref": "#/definitions/domain.AppInfoResp" + "$ref": "#/definitions/github_com_chaitin_panda-wiki_api_share_v1.GitHubCallbackResp" } } } @@ -3789,9 +3702,9 @@ const docTemplate = `{ } } }, - "/share/v1/app/wechat/service/answer": { - "get": { - "description": "GetWechatAnswer", + "/share/v1/openapi/lark/bot/{kb_id}": { + "post": { + "description": "Lark机器人请求", "consumes": [ "application/json" ], @@ -3799,823 +3712,10 @@ const docTemplate = `{ "application/json" ], "tags": [ - "Wechat" + "ShareOpenapi" ], - "summary": "GetWechatAnswer", - "parameters": [ - { - "type": "string", - "description": "conversation id", - "name": "id", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.Response" - } - } - } - } - }, - "/share/v1/app/widget/info": { - "get": { - "description": "GetWidgetAppInfo", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_app" - ], - "summary": "GetWidgetAppInfo", - "parameters": [ - { - "type": "string", - "description": "kb id", - "name": "X-KB-ID", - "in": "header", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.Response" - } - } - } - } - }, - "/share/v1/auth/get": { - "get": { - "description": "AuthGet", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_auth" - ], - "summary": "AuthGet", - "operationId": "v1-AuthGet", - "parameters": [ - { - "type": "string", - "description": "kb_id", - "name": "X-KB-ID", - "in": "header", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_api_share_v1.AuthGetResp" - } - } - } - ] - } - } - } - } - }, - "/share/v1/auth/github": { - "post": { - "description": "GitHub登录", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "ShareAuth" - ], - "summary": "GitHub登录", - "operationId": "v1-AuthGitHub", - "parameters": [ - { - "type": "string", - "description": "kb id", - "name": "X-KB-ID", - "in": "header", - "required": true - }, - { - "description": "para", - "name": "param", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.AuthGitHubReq" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.AuthGitHubResp" - } - } - } - ] - } - } - } - } - }, - "/share/v1/auth/login/simple": { - "post": { - "description": "AuthLoginSimple", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_auth" - ], - "summary": "AuthLoginSimple", - "operationId": "v1-AuthLoginSimple", - "parameters": [ - { - "type": "string", - "description": "kb_id", - "name": "X-KB-ID", - "in": "header", - "required": true - }, - { - "description": "para", - "name": "param", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.AuthLoginSimpleReq" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.Response" - } - } - } - } - }, - "/share/v1/captcha/challenge": { - "post": { - "description": "CreateCaptcha", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_captcha" - ], - "summary": "CreateCaptcha", - "parameters": [ - { - "type": "string", - "description": "kb id", - "name": "X-KB-ID", - "in": "header", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/gocap.ChallengeData" - } - } - } - } - }, - "/share/v1/captcha/redeem": { - "post": { - "description": "RedeemCaptcha", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_captcha" - ], - "summary": "RedeemCaptcha", - "parameters": [ - { - "type": "string", - "description": "kb id", - "name": "X-KB-ID", - "in": "header", - "required": true - }, - { - "description": "request", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/consts.RedeemCaptchaReq" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/gocap.VerificationResult" - } - } - } - } - }, - "/share/v1/chat/completions": { - "post": { - "description": "OpenAI API compatible chat completions endpoint", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_chat" - ], - "summary": "ChatCompletions", - "parameters": [ - { - "type": "string", - "description": "Knowledge Base ID", - "name": "X-KB-ID", - "in": "header", - "required": true - }, - { - "description": "OpenAI API request", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.OpenAICompletionsRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.OpenAICompletionsResponse" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/domain.OpenAIErrorResponse" - } - } - } - } - }, - "/share/v1/chat/feedback": { - "post": { - "description": "Process user feedback for chat conversations", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_chat" - ], - "summary": "Handle chat feedback", - "parameters": [ - { - "description": "feedback request", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.FeedbackRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.Response" - } - } - } - } - }, - "/share/v1/chat/message": { - "post": { - "description": "ChatMessage", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_chat" - ], - "summary": "ChatMessage", - "parameters": [ - { - "type": "string", - "description": "app type", - "name": "app_type", - "in": "query", - "required": true - }, - { - "description": "request", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.ChatRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.Response" - } - } - } - } - }, - "/share/v1/chat/search": { - "post": { - "description": "ChatSearch", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_chat_search" - ], - "summary": "ChatSearch", - "parameters": [ - { - "description": "request", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.ChatSearchReq" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.Response" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/domain.ChatSearchResp" - } - } - } - ] - } - } - } - } - }, - "/share/v1/chat/widget": { - "post": { - "description": "ChatWidget", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_chat" - ], - "summary": "ChatWidget", - "parameters": [ - { - "type": "string", - "description": "app type", - "name": "app_type", - "in": "query", - "required": true - }, - { - "description": "request", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.ChatRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.Response" - } - } - } - } - }, - "/share/v1/comment": { - "post": { - "description": "CreateComment", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_comment" - ], - "summary": "CreateComment", - "parameters": [ - { - "description": "Comment", - "name": "comment", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.CommentReq" - } - } - ], - "responses": { - "200": { - "description": "CommentID", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "type": "string" - } - } - } - ] - } - } - } - } - }, - "/share/v1/comment/list": { - "get": { - "description": "GetCommentList", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_comment" - ], - "summary": "GetCommentList", - "parameters": [ - { - "type": "string", - "description": "nodeID", - "name": "id", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "CommentList", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/share.ShareCommentLists" - } - } - } - ] - } - } - } - } - }, - "/share/v1/common/file/upload": { - "post": { - "description": "前台用户上传文件,目前只支持图片文件上传", - "consumes": [ - "multipart/form-data" - ], - "produces": [ - "application/json" - ], - "tags": [ - "ShareFile" - ], - "summary": "文件上传", - "operationId": "share-FileUpload", - "parameters": [ - { - "type": "string", - "description": "kb id", - "name": "X-KB-ID", - "in": "header", - "required": true - }, - { - "type": "file", - "description": "File", - "name": "file", - "in": "formData", - "required": true - }, - { - "type": "string", - "description": "captcha_token", - "name": "captcha_token", - "in": "formData", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.Response" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.FileUploadResp" - } - } - } - ] - } - } - } - } - }, - "/share/v1/conversation/detail": { - "get": { - "description": "GetConversationDetail", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_conversation" - ], - "summary": "GetConversationDetail", - "parameters": [ - { - "type": "string", - "description": "kb id", - "name": "X-KB-ID", - "in": "header", - "required": true - }, - { - "type": "string", - "description": "conversation id", - "name": "id", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/domain.ShareConversationDetailResp" - } - } - } - ] - } - } - } - } - }, - "/share/v1/node/detail": { - "get": { - "description": "GetNodeDetail", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_node" - ], - "summary": "GetNodeDetail", - "parameters": [ - { - "type": "string", - "description": "kb id", - "name": "X-KB-ID", - "in": "header", - "required": true - }, - { - "type": "string", - "description": "node id", - "name": "id", - "in": "query", - "required": true - }, - { - "type": "string", - "description": "format", - "name": "format", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.Response" - } - } - } - } - }, - "/share/v1/node/list": { - "get": { - "description": "GetNodeList", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_node" - ], - "summary": "GetNodeList", - "parameters": [ - { - "type": "string", - "description": "kb id", - "name": "X-KB-ID", - "in": "header", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.Response" - } - } - } - } - }, - "/share/v1/openapi/github/callback": { - "get": { - "description": "GitHub回调", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "ShareOpenapi" - ], - "summary": "GitHub回调", - "operationId": "v1-GitHubCallback", - "parameters": [ - { - "type": "string", - "name": "code", - "in": "query" - }, - { - "type": "string", - "name": "state", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_api_share_v1.GitHubCallbackResp" - } - } - } - ] - } - } - } - } - }, - "/share/v1/openapi/lark/bot/{kb_id}": { - "post": { - "description": "Lark机器人请求", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "ShareOpenapi" - ], - "summary": "Lark机器人请求", - "operationId": "v1-LarkBot", + "summary": "Lark机器人请求", + "operationId": "v1-LarkBot", "parameters": [ { "type": "string", @@ -4671,6 +3771,40 @@ const docTemplate = `{ } }, "definitions": { + "anydoc.Child": { + "type": "object", + "properties": { + "children": { + "type": "array", + "items": { + "$ref": "#/definitions/anydoc.Child" + } + }, + "value": { + "$ref": "#/definitions/anydoc.Value" + } + } + }, + "anydoc.Value": { + "type": "object", + "properties": { + "file": { + "type": "boolean" + }, + "file_type": { + "type": "string" + }, + "id": { + "type": "string" + }, + "summary": { + "type": "string" + }, + "title": { + "type": "string" + } + } + }, "consts.AuthType": { "type": "string", "enum": [ @@ -4717,6 +3851,37 @@ const docTemplate = `{ "CopySettingDisabled" ] }, + "consts.CrawlerSource": { + "type": "string", + "enum": [ + "url", + "rss", + "sitemap", + "notion", + "feishu", + "file", + "epub", + "yuque", + "siyuan", + "mindoc", + "wikijs", + "confluence" + ], + "x-enum-varnames": [ + "CrawlerSourceUrl", + "CrawlerSourceRSS", + "CrawlerSourceSitemap", + "CrawlerSourceNotion", + "CrawlerSourceFeishu", + "CrawlerSourceFile", + "CrawlerSourceEpub", + "CrawlerSourceYuque", + "CrawlerSourceSiyuan", + "CrawlerSourceMindoc", + "CrawlerSourceWikijs", + "CrawlerSourceConfluence" + ] + }, "consts.CrawlerStatus": { "type": "string", "enum": [ @@ -5047,323 +4212,47 @@ const docTemplate = `{ "domain.AppDetailResp": { "type": "object", "properties": { - "id": { - "type": "string" - }, - "kb_id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "recommend_nodes": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.RecommendNodeListResp" - } - }, - "settings": { - "$ref": "#/definitions/domain.AppSettingsResp" - }, - "type": { - "$ref": "#/definitions/domain.AppType" - } - } - }, - "domain.AppInfoResp": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "recommend_nodes": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.RecommendNodeListResp" - } - }, - "settings": { - "$ref": "#/definitions/domain.AppSettingsResp" - } - } - }, - "domain.AppSettings": { - "type": "object", - "properties": { - "ai_feedback_settings": { - "description": "AI feedback", - "allOf": [ - { - "$ref": "#/definitions/domain.AIFeedbackSettings" - } - ] - }, - "auto_sitemap": { - "type": "boolean" - }, - "body_code": { - "type": "string" - }, - "btns": { - "type": "array", - "items": {} - }, - "catalog_settings": { - "description": "catalog settings", - "allOf": [ - { - "$ref": "#/definitions/domain.CatalogSettings" - } - ] - }, - "contribute_settings": { - "$ref": "#/definitions/domain.ContributeSettings" - }, - "copy_setting": { - "enum": [ - "", - "append", - "disabled" - ], - "allOf": [ - { - "$ref": "#/definitions/consts.CopySetting" - } - ] - }, - "desc": { - "description": "seo", - "type": "string" - }, - "dingtalk_bot_client_id": { - "type": "string" - }, - "dingtalk_bot_client_secret": { - "type": "string" - }, - "dingtalk_bot_is_enabled": { - "description": "DingTalkBot", - "type": "boolean" - }, - "dingtalk_bot_template_id": { - "type": "string" - }, - "disclaimer_settings": { - "description": "Disclaimer Settings", - "allOf": [ - { - "$ref": "#/definitions/domain.DisclaimerSettings" - } - ] - }, - "discord_bot_is_enabled": { - "description": "DisCordBot", - "type": "boolean" - }, - "discord_bot_token": { - "type": "string" - }, - "document_feedback_is_enabled": { - "description": "document feedback", - "type": "boolean" - }, - "feishu_bot_app_id": { - "type": "string" - }, - "feishu_bot_app_secret": { - "type": "string" - }, - "feishu_bot_is_enabled": { - "description": "FeishuBot", - "type": "boolean" - }, - "footer_settings": { - "description": "footer settings", - "allOf": [ - { - "$ref": "#/definitions/domain.FooterSettings" - } - ] - }, - "head_code": { - "description": "inject code", - "type": "string" - }, - "home_page_setting": { - "$ref": "#/definitions/consts.HomePageSetting" - }, - "icon": { - "type": "string" - }, - "keyword": { - "type": "string" - }, - "lark_bot_settings": { - "description": "LarkBot", - "allOf": [ - { - "$ref": "#/definitions/domain.LarkBotSettings" - } - ] - }, - "openai_api_bot_settings": { - "description": "OpenAI API Bot settings", - "allOf": [ - { - "$ref": "#/definitions/domain.OpenAIAPIBotSettings" - } - ] - }, - "recommend_node_ids": { - "type": "array", - "items": { - "type": "string" - } - }, - "recommend_questions": { - "type": "array", - "items": { - "type": "string" - } - }, - "search_placeholder": { - "type": "string" - }, - "theme_and_style": { - "$ref": "#/definitions/domain.ThemeAndStyle" - }, - "theme_mode": { - "description": "theme", - "type": "string" - }, - "title": { - "description": "nav", - "type": "string" - }, - "watermark_content": { - "type": "string" - }, - "watermark_setting": { - "enum": [ - "", - "hidden", - "visible" - ], - "allOf": [ - { - "$ref": "#/definitions/consts.WatermarkSetting" - } - ] - }, - "web_app_comment_settings": { - "description": "webapp comment settings", - "allOf": [ - { - "$ref": "#/definitions/domain.WebAppCommentSettings" - } - ] - }, - "web_app_custom_style": { - "description": "WebAppCustomStyle", - "allOf": [ - { - "$ref": "#/definitions/domain.WebAppCustomSettings" - } - ] - }, - "web_app_landing_configs": { - "description": "WebAppLandingConfigs", - "type": "array", - "items": { - "$ref": "#/definitions/domain.WebAppLandingConfig" - } - }, - "wechat_app_agent_id": { - "type": "string" - }, - "wechat_app_corpid": { - "type": "string" - }, - "wechat_app_encodingaeskey": { - "type": "string" - }, - "wechat_app_is_enabled": { - "description": "WechatAppBot 企业微信机器人", - "type": "boolean" - }, - "wechat_app_secret": { - "type": "string" - }, - "wechat_app_token": { - "type": "string" - }, - "wechat_official_account_app_id": { - "type": "string" - }, - "wechat_official_account_app_secret": { + "id": { "type": "string" }, - "wechat_official_account_encodingaeskey": { + "kb_id": { "type": "string" }, - "wechat_official_account_is_enabled": { - "description": "WechatOfficialAccount", - "type": "boolean" - }, - "wechat_official_account_token": { + "name": { "type": "string" }, - "wechat_service_contain_keywords": { + "recommend_nodes": { "type": "array", "items": { - "type": "string" + "$ref": "#/definitions/domain.RecommendNodeListResp" } }, - "wechat_service_corpid": { - "type": "string" + "settings": { + "$ref": "#/definitions/domain.AppSettingsResp" }, - "wechat_service_encodingaeskey": { + "type": { + "$ref": "#/definitions/domain.AppType" + } + } + }, + "domain.AppInfoResp": { + "type": "object", + "properties": { + "name": { "type": "string" }, - "wechat_service_equal_keywords": { + "recommend_nodes": { "type": "array", "items": { - "type": "string" + "$ref": "#/definitions/domain.RecommendNodeListResp" } }, - "wechat_service_is_enabled": { - "description": "WechatServiceBot", - "type": "boolean" - }, - "wechat_service_secret": { - "type": "string" - }, - "wechat_service_token": { - "type": "string" - }, - "wecom_ai_bot_settings": { - "description": "WecomAIBotSettings 企业微信智能机器人", - "allOf": [ - { - "$ref": "#/definitions/domain.WecomAIBotSettings" - } - ] - }, - "welcome_str": { - "description": "welcome", - "type": "string" - }, - "widget_bot_settings": { - "description": "Widget bot settings", - "allOf": [ - { - "$ref": "#/definitions/domain.WidgetBotSettings" - } - ] + "settings": { + "$ref": "#/definitions/domain.AppSettingsResp" } } }, - "domain.AppSettingsResp": { + "domain.AppSettings": { "type": "object", "properties": { "ai_feedback_settings": { @@ -5396,7 +4285,16 @@ const docTemplate = `{ "$ref": "#/definitions/domain.ContributeSettings" }, "copy_setting": { - "$ref": "#/definitions/consts.CopySetting" + "enum": [ + "", + "append", + "disabled" + ], + "allOf": [ + { + "$ref": "#/definitions/consts.CopySetting" + } + ] }, "desc": { "description": "seo", @@ -5474,7 +4372,7 @@ const docTemplate = `{ ] }, "openai_api_bot_settings": { - "description": "OpenAI API settings", + "description": "OpenAI API Bot settings", "allOf": [ { "$ref": "#/definitions/domain.OpenAIAPIBotSettings" @@ -5511,7 +4409,16 @@ const docTemplate = `{ "type": "string" }, "watermark_setting": { - "$ref": "#/definitions/consts.WatermarkSetting" + "enum": [ + "", + "hidden", + "visible" + ], + "allOf": [ + { + "$ref": "#/definitions/consts.WatermarkSetting" + } + ] }, "web_app_comment_settings": { "description": "webapp comment settings", @@ -5530,10 +4437,10 @@ const docTemplate = `{ ] }, "web_app_landing_configs": { - "description": "WebApp Landing Settings", + "description": "WebAppLandingConfigs", "type": "array", "items": { - "$ref": "#/definitions/domain.WebAppLandingConfigResp" + "$ref": "#/definitions/domain.WebAppLandingConfig" } }, "wechat_app_agent_id": { @@ -5546,7 +4453,7 @@ const docTemplate = `{ "type": "string" }, "wechat_app_is_enabled": { - "description": "WechatAppBot", + "description": "WechatAppBot 企业微信机器人", "type": "boolean" }, "wechat_app_secret": { @@ -5557,1827 +4464,1640 @@ const docTemplate = `{ }, "wechat_official_account_app_id": { "type": "string" - }, - "wechat_official_account_app_secret": { - "type": "string" - }, - "wechat_official_account_encodingaeskey": { - "type": "string" - }, - "wechat_official_account_is_enabled": { - "description": "WechatOfficialAccount", - "type": "boolean" - }, - "wechat_official_account_token": { - "type": "string" - }, - "wechat_service_contain_keywords": { - "type": "array", - "items": { - "type": "string" - } - }, - "wechat_service_corpid": { - "type": "string" - }, - "wechat_service_encodingaeskey": { - "type": "string" - }, - "wechat_service_equal_keywords": { - "type": "array", - "items": { - "type": "string" - } - }, - "wechat_service_is_enabled": { - "description": "WechatServiceBot", - "type": "boolean" - }, - "wechat_service_secret": { - "type": "string" - }, - "wechat_service_token": { - "type": "string" - }, - "wecom_ai_bot_settings": { - "$ref": "#/definitions/domain.WecomAIBotSettings" - }, - "welcome_str": { - "description": "welcome", - "type": "string" - }, - "widget_bot_settings": { - "description": "WidgetBot", - "allOf": [ - { - "$ref": "#/definitions/domain.WidgetBotSettings" - } - ] - } - } - }, - "domain.AppType": { - "type": "integer", - "format": "int32", - "enum": [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11 - ], - "x-enum-varnames": [ - "AppTypeWeb", - "AppTypeWidget", - "AppTypeDingTalkBot", - "AppTypeFeishuBot", - "AppTypeWechatBot", - "AppTypeWechatServiceBot", - "AppTypeDisCordBot", - "AppTypeWechatOfficialAccount", - "AppTypeOpenAIAPI", - "AppTypeWecomAIBot", - "AppTypeLarkBot" - ] - }, - "domain.AuthUserInfo": { - "type": "object", - "properties": { - "avatar_url": { - "type": "string" - }, - "email": { - "type": "string" - }, - "username": { - "type": "string" - } - } - }, - "domain.BannerConfig": { - "type": "object", - "properties": { - "bg_url": { - "type": "string" - }, - "btns": { - "type": "array", - "items": { - "type": "object", - "properties": { - "href": { - "type": "string" - }, - "id": { - "type": "string" - }, - "text": { - "type": "string" - }, - "type": { - "type": "string" - } - } - } - }, - "hot_search": { - "type": "array", - "items": { - "type": "string" - } - }, - "placeholder": { - "type": "string" - }, - "subtitle": { - "type": "string" - }, - "subtitle_color": { - "type": "string" - }, - "subtitle_font_size": { - "type": "integer" - }, - "title": { - "type": "string" - }, - "title_color": { - "type": "string" - }, - "title_font_size": { - "type": "integer" - } - } - }, - "domain.BasicDocConfig": { - "type": "object", - "properties": { - "bg_color": { + }, + "wechat_official_account_app_secret": { "type": "string" }, - "title": { + "wechat_official_account_encodingaeskey": { "type": "string" }, - "title_color": { + "wechat_official_account_is_enabled": { + "description": "WechatOfficialAccount", + "type": "boolean" + }, + "wechat_official_account_token": { "type": "string" - } - } - }, - "domain.BatchMoveReq": { - "type": "object", - "required": [ - "ids", - "kb_id" - ], - "properties": { - "ids": { + }, + "wechat_service_contain_keywords": { "type": "array", "items": { "type": "string" } }, - "kb_id": { + "wechat_service_corpid": { "type": "string" }, - "parent_id": { + "wechat_service_encodingaeskey": { "type": "string" - } - } - }, - "domain.BrandGroup": { - "type": "object", - "properties": { - "links": { + }, + "wechat_service_equal_keywords": { "type": "array", "items": { - "$ref": "#/definitions/domain.Link" + "type": "string" } }, - "name": { + "wechat_service_is_enabled": { + "description": "WechatServiceBot", + "type": "boolean" + }, + "wechat_service_secret": { "type": "string" - } - } - }, - "domain.BrowserCount": { - "type": "object", - "properties": { - "count": { - "type": "integer" }, - "name": { + "wechat_service_token": { + "type": "string" + }, + "wecom_ai_bot_settings": { + "description": "WecomAIBotSettings 企业微信智能机器人", + "allOf": [ + { + "$ref": "#/definitions/domain.WecomAIBotSettings" + } + ] + }, + "welcome_str": { + "description": "welcome", "type": "string" + }, + "widget_bot_settings": { + "description": "Widget bot settings", + "allOf": [ + { + "$ref": "#/definitions/domain.WidgetBotSettings" + } + ] } } }, - "domain.CarouselConfig": { + "domain.AppSettingsResp": { "type": "object", "properties": { - "bg_color": { + "ai_feedback_settings": { + "description": "AI feedback", + "allOf": [ + { + "$ref": "#/definitions/domain.AIFeedbackSettings" + } + ] + }, + "auto_sitemap": { + "type": "boolean" + }, + "body_code": { "type": "string" }, - "list": { + "btns": { "type": "array", - "items": { - "type": "object", - "properties": { - "desc": { - "type": "string" - }, - "id": { - "type": "string" - }, - "title": { - "type": "string" - }, - "url": { - "type": "string" - } + "items": {} + }, + "catalog_settings": { + "description": "catalog settings", + "allOf": [ + { + "$ref": "#/definitions/domain.CatalogSettings" } - } + ] }, - "title": { + "contribute_settings": { + "$ref": "#/definitions/domain.ContributeSettings" + }, + "copy_setting": { + "$ref": "#/definitions/consts.CopySetting" + }, + "desc": { + "description": "seo", "type": "string" - } - } - }, - "domain.CatalogSettings": { - "type": "object", - "properties": { - "catalog_folder": { - "description": "1: 展开, 2: 折叠, default: 1", - "type": "integer" }, - "catalog_visible": { - "description": "1: 显示, 2: 隐藏, default: 1", - "type": "integer" + "dingtalk_bot_client_id": { + "type": "string" }, - "catalog_width": { - "description": "200 - 300, default: 260", - "type": "integer" - } - } - }, - "domain.ChatRequest": { - "type": "object", - "required": [ - "app_type", - "message" - ], - "properties": { - "app_type": { - "enum": [ - 1, - 2 - ], + "dingtalk_bot_client_secret": { + "type": "string" + }, + "dingtalk_bot_is_enabled": { + "description": "DingTalkBot", + "type": "boolean" + }, + "dingtalk_bot_template_id": { + "type": "string" + }, + "disclaimer_settings": { + "description": "Disclaimer Settings", "allOf": [ { - "$ref": "#/definitions/domain.AppType" + "$ref": "#/definitions/domain.DisclaimerSettings" } ] }, - "captcha_token": { + "discord_bot_is_enabled": { + "description": "DisCordBot", + "type": "boolean" + }, + "discord_bot_token": { "type": "string" }, - "conversation_id": { + "document_feedback_is_enabled": { + "description": "document feedback", + "type": "boolean" + }, + "feishu_bot_app_id": { "type": "string" }, - "message": { + "feishu_bot_app_secret": { "type": "string" }, - "nonce": { + "feishu_bot_is_enabled": { + "description": "FeishuBot", + "type": "boolean" + }, + "footer_settings": { + "description": "footer settings", + "allOf": [ + { + "$ref": "#/definitions/domain.FooterSettings" + } + ] + }, + "head_code": { + "description": "inject code", "type": "string" - } - } - }, - "domain.ChatSearchReq": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "captcha_token": { + }, + "home_page_setting": { + "$ref": "#/definitions/consts.HomePageSetting" + }, + "icon": { "type": "string" }, - "message": { + "keyword": { "type": "string" - } - } - }, - "domain.ChatSearchResp": { - "type": "object", - "properties": { - "node_result": { + }, + "lark_bot_settings": { + "description": "LarkBot", + "allOf": [ + { + "$ref": "#/definitions/domain.LarkBotSettings" + } + ] + }, + "openai_api_bot_settings": { + "description": "OpenAI API settings", + "allOf": [ + { + "$ref": "#/definitions/domain.OpenAIAPIBotSettings" + } + ] + }, + "recommend_node_ids": { "type": "array", "items": { - "$ref": "#/definitions/domain.NodeContentChunkSSE" + "type": "string" } - } - } - }, - "domain.CommentInfo": { - "type": "object", - "properties": { - "auth_user_id": { - "type": "integer" }, - "avatar": { - "description": "avatar", - "type": "string" + "recommend_questions": { + "type": "array", + "items": { + "type": "string" + } }, - "email": { + "search_placeholder": { "type": "string" }, - "remote_ip": { - "type": "string" + "theme_and_style": { + "$ref": "#/definitions/domain.ThemeAndStyle" }, - "user_name": { - "type": "string" - } - } - }, - "domain.CommentListItem": { - "type": "object", - "properties": { - "content": { + "theme_mode": { + "description": "theme", "type": "string" }, - "created_at": { + "title": { + "description": "nav", "type": "string" }, - "id": { + "watermark_content": { "type": "string" }, - "info": { - "$ref": "#/definitions/domain.CommentInfo" + "watermark_setting": { + "$ref": "#/definitions/consts.WatermarkSetting" }, - "ip_address": { - "description": "ip地址", + "web_app_comment_settings": { + "description": "webapp comment settings", "allOf": [ { - "$ref": "#/definitions/domain.IPAddress" + "$ref": "#/definitions/domain.WebAppCommentSettings" } ] }, - "node_id": { - "type": "string" - }, - "node_name": { - "description": "文档标题", - "type": "string" - }, - "node_type": { - "type": "integer" - }, - "root_id": { - "type": "string" - }, - "status": { - "description": "status : -1 reject 0 pending 1 accept", + "web_app_custom_style": { + "description": "WebAppCustomStyle", "allOf": [ { - "$ref": "#/definitions/domain.CommentStatus" + "$ref": "#/definitions/domain.WebAppCustomSettings" } ] - } - } - }, - "domain.CommentReq": { - "type": "object", - "required": [ - "content", - "node_id", - "pic_urls" - ], - "properties": { - "captcha_token": { - "type": "string" }, - "content": { + "web_app_landing_configs": { + "description": "WebApp Landing Settings", + "type": "array", + "items": { + "$ref": "#/definitions/domain.WebAppLandingConfigResp" + } + }, + "wechat_app_agent_id": { "type": "string" }, - "node_id": { + "wechat_app_corpid": { "type": "string" }, - "parent_id": { + "wechat_app_encodingaeskey": { "type": "string" }, - "pic_urls": { - "type": "array", - "items": { - "type": "string" - } + "wechat_app_is_enabled": { + "description": "WechatAppBot", + "type": "boolean" }, - "root_id": { + "wechat_app_secret": { "type": "string" }, - "user_name": { - "type": "string" - } - } - }, - "domain.CommentStatus": { - "type": "integer", - "format": "int32", - "enum": [ - -1, - 0, - 1 - ], - "x-enum-varnames": [ - "CommentStatusReject", - "CommentStatusPending", - "CommentStatusAccepted" - ] - }, - "domain.CompleteReq": { - "type": "object", - "properties": { - "prefix": { - "description": "For FIM (Fill in Middle) style completion", + "wechat_app_token": { "type": "string" }, - "suffix": { - "type": "string" - } - } - }, - "domain.ContributeSettings": { - "type": "object", - "properties": { - "is_enable": { - "type": "boolean" - } - } - }, - "domain.ConversationDetailResp": { - "type": "object", - "properties": { - "app_id": { + "wechat_official_account_app_id": { "type": "string" }, - "created_at": { + "wechat_official_account_app_secret": { "type": "string" }, - "id": { + "wechat_official_account_encodingaeskey": { "type": "string" }, - "ip_address": { - "$ref": "#/definitions/domain.IPAddress" + "wechat_official_account_is_enabled": { + "description": "WechatOfficialAccount", + "type": "boolean" }, - "messages": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.ConversationMessage" - } + "wechat_official_account_token": { + "type": "string" }, - "references": { + "wechat_service_contain_keywords": { "type": "array", "items": { - "$ref": "#/definitions/domain.ConversationReference" + "type": "string" } }, - "remote_ip": { + "wechat_service_corpid": { "type": "string" }, - "subject": { - "type": "string" - } - } - }, - "domain.ConversationDistribution": { - "type": "object", - "properties": { - "app_id": { + "wechat_service_encodingaeskey": { "type": "string" }, - "app_type": { - "$ref": "#/definitions/domain.AppType" + "wechat_service_equal_keywords": { + "type": "array", + "items": { + "type": "string" + } }, - "count": { - "type": "integer" - } - } - }, - "domain.ConversationInfo": { - "type": "object", - "properties": { - "user_info": { - "$ref": "#/definitions/domain.UserInfo" - } - } - }, - "domain.ConversationListItem": { - "type": "object", - "properties": { - "app_name": { - "type": "string" + "wechat_service_is_enabled": { + "description": "WechatServiceBot", + "type": "boolean" }, - "app_type": { - "$ref": "#/definitions/domain.AppType" + "wechat_service_secret": { + "type": "string" }, - "created_at": { + "wechat_service_token": { "type": "string" }, - "feedback_info": { - "description": "用户反馈信息", - "allOf": [ - { - "$ref": "#/definitions/domain.FeedBackInfo" - } - ] + "wecom_ai_bot_settings": { + "$ref": "#/definitions/domain.WecomAIBotSettings" }, - "id": { + "welcome_str": { + "description": "welcome", "type": "string" }, - "info": { - "description": "用户信息", + "widget_bot_settings": { + "description": "WidgetBot", "allOf": [ { - "$ref": "#/definitions/domain.ConversationInfo" + "$ref": "#/definitions/domain.WidgetBotSettings" } ] + } + } + }, + "domain.AppType": { + "type": "integer", + "format": "int32", + "enum": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "x-enum-varnames": [ + "AppTypeWeb", + "AppTypeWidget", + "AppTypeDingTalkBot", + "AppTypeFeishuBot", + "AppTypeWechatBot", + "AppTypeWechatServiceBot", + "AppTypeDisCordBot", + "AppTypeWechatOfficialAccount", + "AppTypeOpenAIAPI", + "AppTypeWecomAIBot", + "AppTypeLarkBot" + ] + }, + "domain.AuthUserInfo": { + "type": "object", + "properties": { + "avatar_url": { + "type": "string" }, - "ip_address": { - "$ref": "#/definitions/domain.IPAddress" - }, - "remote_ip": { + "email": { "type": "string" }, - "subject": { + "username": { "type": "string" } } }, - "domain.ConversationMessage": { + "domain.BannerConfig": { "type": "object", "properties": { - "app_id": { - "type": "string" - }, - "completion_tokens": { - "type": "integer" - }, - "content": { - "type": "string" - }, - "conversation_id": { - "type": "string" - }, - "created_at": { - "type": "string" - }, - "id": { + "bg_url": { "type": "string" }, - "info": { - "description": "feedbackinfo", - "allOf": [ - { - "$ref": "#/definitions/domain.FeedBackInfo" + "btns": { + "type": "array", + "items": { + "type": "object", + "properties": { + "href": { + "type": "string" + }, + "id": { + "type": "string" + }, + "text": { + "type": "string" + }, + "type": { + "type": "string" + } } - ] + } }, - "kb_id": { + "hot_search": { + "type": "array", + "items": { + "type": "string" + } + }, + "placeholder": { "type": "string" }, - "model": { + "subtitle": { "type": "string" }, - "parent_id": { - "description": "parent_id", + "subtitle_color": { "type": "string" }, - "prompt_tokens": { + "subtitle_font_size": { "type": "integer" }, - "provider": { - "description": "model", - "allOf": [ - { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelProvider" - } - ] - }, - "remote_ip": { - "description": "stats", + "title": { "type": "string" }, - "role": { - "$ref": "#/definitions/schema.RoleType" + "title_color": { + "type": "string" }, - "total_tokens": { + "title_font_size": { "type": "integer" } } }, - "domain.ConversationMessageListItem": { + "domain.BasicDocConfig": { "type": "object", "properties": { - "app_id": { - "type": "string" - }, - "app_type": { - "$ref": "#/definitions/domain.AppType" - }, - "conversation_id": { + "bg_color": { "type": "string" }, - "conversation_info": { - "description": "userInfo", - "allOf": [ - { - "$ref": "#/definitions/domain.ConversationInfo" - } - ] - }, - "created_at": { + "title": { "type": "string" }, - "id": { + "title_color": { "type": "string" + } + } + }, + "domain.BatchMoveReq": { + "type": "object", + "required": [ + "ids", + "kb_id" + ], + "properties": { + "ids": { + "type": "array", + "items": { + "type": "string" + } }, - "info": { - "description": "feedbackInfo", - "allOf": [ - { - "$ref": "#/definitions/domain.FeedBackInfo" - } - ] - }, - "ip_address": { - "$ref": "#/definitions/domain.IPAddress" - }, - "question": { + "kb_id": { "type": "string" }, - "remote_ip": { - "description": "stats", + "parent_id": { "type": "string" } } }, - "domain.ConversationReference": { + "domain.BrandGroup": { "type": "object", "properties": { - "app_id": { - "type": "string" - }, - "conversation_id": { - "type": "string" + "links": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.Link" + } }, "name": { "type": "string" + } + } + }, + "domain.BrowserCount": { + "type": "object", + "properties": { + "count": { + "type": "integer" }, - "node_id": { - "type": "string" - }, - "url": { + "name": { "type": "string" } } }, - "domain.CreateKBReleaseReq": { + "domain.CarouselConfig": { "type": "object", - "required": [ - "kb_id", - "message", - "tag" - ], "properties": { - "kb_id": { - "type": "string" - }, - "message": { + "bg_color": { "type": "string" }, - "node_ids": { - "description": "create release after these nodes published", + "list": { "type": "array", "items": { - "type": "string" + "type": "object", + "properties": { + "desc": { + "type": "string" + }, + "id": { + "type": "string" + }, + "title": { + "type": "string" + }, + "url": { + "type": "string" + } + } } }, - "tag": { + "title": { "type": "string" } } }, - "domain.CreateKnowledgeBaseReq": { + "domain.CatalogSettings": { + "type": "object", + "properties": { + "catalog_folder": { + "description": "1: 展开, 2: 折叠, default: 1", + "type": "integer" + }, + "catalog_visible": { + "description": "1: 显示, 2: 隐藏, default: 1", + "type": "integer" + }, + "catalog_width": { + "description": "200 - 300, default: 260", + "type": "integer" + } + } + }, + "domain.ChatRequest": { "type": "object", "required": [ - "name" + "app_type", + "message" ], "properties": { - "hosts": { - "type": "array", - "items": { - "type": "string" - } + "app_type": { + "enum": [ + 1, + 2 + ], + "allOf": [ + { + "$ref": "#/definitions/domain.AppType" + } + ] }, - "name": { + "captcha_token": { "type": "string" }, - "ports": { - "type": "array", - "items": { - "type": "integer" - } + "conversation_id": { + "type": "string" }, - "private_key": { + "message": { "type": "string" }, - "public_key": { + "nonce": { + "type": "string" + } + } + }, + "domain.ChatSearchReq": { + "type": "object", + "required": [ + "message" + ], + "properties": { + "captcha_token": { "type": "string" }, - "ssl_ports": { + "message": { + "type": "string" + } + } + }, + "domain.ChatSearchResp": { + "type": "object", + "properties": { + "node_result": { "type": "array", "items": { - "type": "integer" + "$ref": "#/definitions/domain.NodeContentChunkSSE" } } } }, - "domain.CreateModelReq": { + "domain.CommentInfo": { "type": "object", - "required": [ - "base_url", - "model", - "provider", - "type" - ], "properties": { - "api_header": { - "type": "string" + "auth_user_id": { + "type": "integer" }, - "api_key": { + "avatar": { + "description": "avatar", "type": "string" }, - "api_version": { - "description": "for azure openai", + "email": { "type": "string" }, - "base_url": { + "remote_ip": { "type": "string" }, - "model": { + "user_name": { "type": "string" - }, - "parameters": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelParam" - }, - "provider": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelProvider" - }, - "type": { - "enum": [ - "chat", - "embedding", - "rerank", - "analysis", - "analysis-vl" - ], - "allOf": [ - { - "$ref": "#/definitions/domain.ModelType" - } - ] } } }, - "domain.CreateNodeReq": { + "domain.CommentListItem": { "type": "object", - "required": [ - "kb_id", - "name", - "type" - ], "properties": { "content": { "type": "string" }, - "emoji": { + "created_at": { "type": "string" }, - "kb_id": { + "id": { "type": "string" }, - "name": { + "info": { + "$ref": "#/definitions/domain.CommentInfo" + }, + "ip_address": { + "description": "ip地址", + "allOf": [ + { + "$ref": "#/definitions/domain.IPAddress" + } + ] + }, + "node_id": { "type": "string" }, - "parent_id": { + "node_name": { + "description": "文档标题", "type": "string" }, - "position": { - "type": "number" + "node_type": { + "type": "integer" }, - "summary": { + "root_id": { "type": "string" }, - "type": { - "enum": [ - 1, - 2 - ], + "status": { + "description": "status : -1 reject 0 pending 1 accept", "allOf": [ { - "$ref": "#/definitions/domain.NodeType" + "$ref": "#/definitions/domain.CommentStatus" } ] } } }, - "domain.DirDocConfig": { + "domain.CommentReq": { "type": "object", + "required": [ + "content", + "node_id", + "pic_urls" + ], "properties": { - "bg_color": { + "captcha_token": { "type": "string" }, - "title": { + "content": { "type": "string" }, - "title_color": { + "node_id": { + "type": "string" + }, + "parent_id": { + "type": "string" + }, + "pic_urls": { + "type": "array", + "items": { + "type": "string" + } + }, + "root_id": { + "type": "string" + }, + "user_name": { "type": "string" } } }, - "domain.DisclaimerSettings": { + "domain.CommentStatus": { + "type": "integer", + "format": "int32", + "enum": [ + -1, + 0, + 1 + ], + "x-enum-varnames": [ + "CommentStatusReject", + "CommentStatusPending", + "CommentStatusAccepted" + ] + }, + "domain.CompleteReq": { "type": "object", "properties": { - "content": { + "prefix": { + "description": "For FIM (Fill in Middle) style completion", + "type": "string" + }, + "suffix": { "type": "string" } } }, - "domain.EnterpriseAuth": { + "domain.ContributeSettings": { "type": "object", "properties": { - "enabled": { + "is_enable": { "type": "boolean" } } }, - "domain.FaqConfig": { + "domain.ConversationDetailResp": { "type": "object", "properties": { - "bg_color": { + "app_id": { "type": "string" }, - "list": { + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "ip_address": { + "$ref": "#/definitions/domain.IPAddress" + }, + "messages": { "type": "array", "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "link": { - "type": "string" - }, - "question": { - "type": "string" - } - } + "$ref": "#/definitions/domain.ConversationMessage" } }, - "title": { + "references": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.ConversationReference" + } + }, + "remote_ip": { "type": "string" }, - "title_color": { + "subject": { "type": "string" } } }, - "domain.FeedBackInfo": { + "domain.ConversationDistribution": { "type": "object", "properties": { - "feedback_content": { + "app_id": { "type": "string" }, - "feedback_type": { + "app_type": { + "$ref": "#/definitions/domain.AppType" + }, + "count": { + "type": "integer" + } + } + }, + "domain.ConversationInfo": { + "type": "object", + "properties": { + "user_info": { + "$ref": "#/definitions/domain.UserInfo" + } + } + }, + "domain.ConversationListItem": { + "type": "object", + "properties": { + "app_name": { "type": "string" }, - "score": { - "$ref": "#/definitions/domain.ScoreType" + "app_type": { + "$ref": "#/definitions/domain.AppType" + }, + "created_at": { + "type": "string" + }, + "feedback_info": { + "description": "用户反馈信息", + "allOf": [ + { + "$ref": "#/definitions/domain.FeedBackInfo" + } + ] + }, + "id": { + "type": "string" + }, + "info": { + "description": "用户信息", + "allOf": [ + { + "$ref": "#/definitions/domain.ConversationInfo" + } + ] + }, + "ip_address": { + "$ref": "#/definitions/domain.IPAddress" + }, + "remote_ip": { + "type": "string" + }, + "subject": { + "type": "string" } } }, - "domain.FeedbackRequest": { + "domain.ConversationMessage": { "type": "object", - "required": [ - "message_id" - ], "properties": { + "app_id": { + "type": "string" + }, + "completion_tokens": { + "type": "integer" + }, + "content": { + "type": "string" + }, "conversation_id": { "type": "string" }, - "feedback_content": { - "description": "限制内容长度", - "type": "string", - "maxLength": 200 + "created_at": { + "type": "string" }, - "message_id": { + "id": { "type": "string" }, - "score": { - "description": "-1 踩 ,0 1 赞成", + "info": { + "description": "feedbackinfo", "allOf": [ { - "$ref": "#/definitions/domain.ScoreType" + "$ref": "#/definitions/domain.FeedBackInfo" } ] }, - "type": { - "description": "内容不准确,没有帮助,.......", - "type": "string" - } - } - }, - "domain.FooterSettings": { - "type": "object", - "properties": { - "brand_desc": { + "kb_id": { "type": "string" }, - "brand_groups": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.BrandGroup" - } - }, - "brand_logo": { + "model": { "type": "string" }, - "brand_name": { + "parent_id": { + "description": "parent_id", "type": "string" }, - "corp_name": { - "type": "string" + "prompt_tokens": { + "type": "integer" }, - "footer_style": { - "type": "string" + "provider": { + "description": "model", + "allOf": [ + { + "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelProvider" + } + ] }, - "icp": { + "remote_ip": { + "description": "stats", "type": "string" - } - } - }, - "domain.GetKBReleaseListResp": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.KBReleaseListItemResp" - } }, - "total": { + "role": { + "$ref": "#/definitions/schema.RoleType" + }, + "total_tokens": { "type": "integer" } } }, - "domain.GetProviderModelListReq": { + "domain.ConversationMessageListItem": { "type": "object", - "required": [ - "base_url", - "provider", - "type" - ], "properties": { - "api_header": { + "app_id": { "type": "string" }, - "api_key": { + "app_type": { + "$ref": "#/definitions/domain.AppType" + }, + "conversation_id": { "type": "string" }, - "base_url": { + "conversation_info": { + "description": "userInfo", + "allOf": [ + { + "$ref": "#/definitions/domain.ConversationInfo" + } + ] + }, + "created_at": { "type": "string" }, - "provider": { + "id": { "type": "string" }, - "type": { - "enum": [ - "chat", - "embedding", - "rerank", - "analysis", - "analysis-vl" - ], + "info": { + "description": "feedbackInfo", "allOf": [ { - "$ref": "#/definitions/domain.ModelType" + "$ref": "#/definitions/domain.FeedBackInfo" } ] - } - } - }, - "domain.GetProviderModelListResp": { - "type": "object", - "properties": { - "models": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.ProviderModelListItem" - } - } - } - }, - "domain.HotBrowser": { - "type": "object", - "properties": { - "browser": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.BrowserCount" - } - }, - "os": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.BrowserCount" - } - } - } - }, - "domain.HotPage": { - "type": "object", - "properties": { - "count": { - "type": "integer" }, - "node_id": { - "type": "string" + "ip_address": { + "$ref": "#/definitions/domain.IPAddress" }, - "node_name": { + "question": { "type": "string" }, - "scene": { - "$ref": "#/definitions/domain.StatPageScene" - } - } - }, - "domain.HotRefererHost": { - "type": "object", - "properties": { - "count": { - "type": "integer" - }, - "referer_host": { + "remote_ip": { + "description": "stats", "type": "string" } } }, - "domain.IPAddress": { + "domain.ConversationReference": { "type": "object", "properties": { - "city": { + "app_id": { "type": "string" }, - "country": { + "conversation_id": { "type": "string" }, - "ip": { + "name": { "type": "string" }, - "province": { + "node_id": { "type": "string" - } - } - }, - "domain.InstantCountResp": { - "type": "object", - "properties": { - "count": { - "type": "integer" }, - "time": { + "url": { "type": "string" } } }, - "domain.InstantPageResp": { + "domain.CreateKBReleaseReq": { "type": "object", + "required": [ + "kb_id", + "message", + "tag" + ], "properties": { - "created_at": { + "kb_id": { "type": "string" }, - "info": { - "$ref": "#/definitions/domain.AuthUserInfo" - }, - "ip": { + "message": { "type": "string" }, - "ip_address": { - "$ref": "#/definitions/domain.IPAddress" - }, - "node_id": { - "type": "string" + "node_ids": { + "description": "create release after these nodes published", + "type": "array", + "items": { + "type": "string" + } }, - "node_name": { + "tag": { "type": "string" - }, - "scene": { - "$ref": "#/definitions/domain.StatPageScene" - }, - "user_id": { - "type": "integer" } } }, - "domain.KBReleaseListItemResp": { + "domain.CreateKnowledgeBaseReq": { "type": "object", + "required": [ + "name" + ], "properties": { - "created_at": { - "type": "string" + "hosts": { + "type": "array", + "items": { + "type": "string" + } }, - "id": { + "name": { "type": "string" }, - "kb_id": { - "type": "string" + "ports": { + "type": "array", + "items": { + "type": "integer" + } }, - "message": { + "private_key": { "type": "string" }, - "tag": { + "public_key": { "type": "string" + }, + "ssl_ports": { + "type": "array", + "items": { + "type": "integer" + } } } }, - "domain.KnowledgeBaseDetail": { + "domain.CreateModelReq": { "type": "object", + "required": [ + "base_url", + "model", + "provider", + "type" + ], "properties": { - "access_settings": { - "$ref": "#/definitions/domain.AccessSettings" + "api_header": { + "type": "string" }, - "created_at": { + "api_key": { "type": "string" }, - "dataset_id": { + "api_version": { + "description": "for azure openai", "type": "string" }, - "id": { + "base_url": { "type": "string" }, - "name": { + "model": { "type": "string" }, - "perm": { - "description": "用户对知识库的权限", + "parameters": { + "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelParam" + }, + "provider": { + "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelProvider" + }, + "type": { + "enum": [ + "chat", + "embedding", + "rerank", + "analysis", + "analysis-vl" + ], "allOf": [ { - "$ref": "#/definitions/consts.UserKBPermission" + "$ref": "#/definitions/domain.ModelType" } ] - }, - "updated_at": { - "type": "string" } } }, - "domain.KnowledgeBaseListItem": { + "domain.CreateNodeReq": { "type": "object", + "required": [ + "kb_id", + "name", + "type" + ], "properties": { - "access_settings": { - "$ref": "#/definitions/domain.AccessSettings" - }, - "created_at": { + "content": { "type": "string" }, - "dataset_id": { + "emoji": { "type": "string" }, - "id": { + "kb_id": { "type": "string" }, "name": { "type": "string" }, - "updated_at": { + "parent_id": { + "type": "string" + }, + "position": { + "type": "number" + }, + "summary": { "type": "string" + }, + "type": { + "enum": [ + 1, + 2 + ], + "allOf": [ + { + "$ref": "#/definitions/domain.NodeType" + } + ] } } }, - "domain.LarkBotSettings": { + "domain.DirDocConfig": { "type": "object", "properties": { - "app_id": { - "type": "string" - }, - "app_secret": { + "bg_color": { "type": "string" }, - "encrypt_key": { + "title": { "type": "string" }, - "is_enabled": { - "type": "boolean" - }, - "verify_token": { + "title_color": { "type": "string" } } }, - "domain.Link": { + "domain.DisclaimerSettings": { "type": "object", "properties": { - "name": { - "type": "string" - }, - "url": { + "content": { "type": "string" } } }, - "domain.MessageFrom": { - "type": "integer", - "enum": [ - 1, - 2 - ], - "x-enum-varnames": [ - "MessageFromGroup", - "MessageFromPrivate" - ] - }, - "domain.ModelType": { - "type": "string", - "enum": [ - "chat", - "embedding", - "rerank", - "analysis", - "analysis-vl" - ], - "x-enum-varnames": [ - "ModelTypeChat", - "ModelTypeEmbedding", - "ModelTypeRerank", - "ModelTypeAnalysis", - "ModelTypeAnalysisVL" - ] - }, - "domain.MoveNodeReq": { + "domain.EnterpriseAuth": { "type": "object", - "required": [ - "id", - "kb_id" - ], "properties": { - "id": { - "type": "string" - }, - "kb_id": { - "type": "string" - }, - "next_id": { - "type": "string" - }, - "parent_id": { - "type": "string" - }, - "prev_id": { - "type": "string" + "enabled": { + "type": "boolean" } } }, - "domain.NodeActionReq": { + "domain.FaqConfig": { "type": "object", - "required": [ - "action", - "ids", - "kb_id" - ], "properties": { - "action": { - "type": "string", - "enum": [ - "delete" - ] + "bg_color": { + "type": "string" }, - "ids": { + "list": { "type": "array", "items": { - "type": "string" + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "link": { + "type": "string" + }, + "question": { + "type": "string" + } + } } }, - "kb_id": { + "title": { + "type": "string" + }, + "title_color": { "type": "string" } } }, - "domain.NodeContentChunkSSE": { + "domain.FeedBackInfo": { "type": "object", "properties": { - "emoji": { - "type": "string" - }, - "name": { + "feedback_content": { "type": "string" }, - "node_id": { + "feedback_type": { "type": "string" }, - "summary": { - "type": "string" + "score": { + "$ref": "#/definitions/domain.ScoreType" } } }, - "domain.NodeGroupDetail": { + "domain.FeedbackRequest": { "type": "object", + "required": [ + "message_id" + ], "properties": { - "auth_group_id": { - "type": "integer" + "conversation_id": { + "type": "string" }, - "auth_ids": { - "type": "array", - "items": { - "type": "integer" - } + "feedback_content": { + "description": "限制内容长度", + "type": "string", + "maxLength": 200 }, - "kb_id": { + "message_id": { "type": "string" }, - "name": { - "type": "string" + "score": { + "description": "-1 踩 ,0 1 赞成", + "allOf": [ + { + "$ref": "#/definitions/domain.ScoreType" + } + ] }, - "node_id": { + "type": { + "description": "内容不准确,没有帮助,.......", "type": "string" - }, - "perm": { - "$ref": "#/definitions/consts.NodePermName" } } }, - "domain.NodeListItemResp": { + "domain.FooterSettings": { "type": "object", "properties": { - "created_at": { - "type": "string" - }, - "creator": { - "type": "string" - }, - "creator_id": { - "type": "string" - }, - "editor": { - "type": "string" - }, - "editor_id": { - "type": "string" - }, - "emoji": { - "type": "string" - }, - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "parent_id": { + "brand_desc": { "type": "string" }, - "permissions": { - "$ref": "#/definitions/domain.NodePermissions" + "brand_groups": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.BrandGroup" + } }, - "position": { - "type": "number" + "brand_logo": { + "type": "string" }, - "status": { - "$ref": "#/definitions/domain.NodeStatus" + "brand_name": { + "type": "string" }, - "summary": { + "corp_name": { "type": "string" }, - "type": { - "$ref": "#/definitions/domain.NodeType" + "footer_style": { + "type": "string" }, - "updated_at": { + "icp": { "type": "string" } } }, - "domain.NodeMeta": { + "domain.GetKBReleaseListResp": { "type": "object", "properties": { - "emoji": { - "type": "string" + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.KBReleaseListItemResp" + } }, - "summary": { - "type": "string" + "total": { + "type": "integer" } } }, - "domain.NodePermissions": { + "domain.GetProviderModelListReq": { "type": "object", + "required": [ + "base_url", + "provider", + "type" + ], "properties": { - "answerable": { - "description": "可被问答", - "allOf": [ - { - "$ref": "#/definitions/consts.NodeAccessPerm" - } - ] + "api_header": { + "type": "string" }, - "visible": { - "description": "导航内可见", - "allOf": [ - { - "$ref": "#/definitions/consts.NodeAccessPerm" - } - ] + "api_key": { + "type": "string" }, - "visitable": { - "description": "可被访问", + "base_url": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "type": { + "enum": [ + "chat", + "embedding", + "rerank", + "analysis", + "analysis-vl" + ], "allOf": [ { - "$ref": "#/definitions/consts.NodeAccessPerm" + "$ref": "#/definitions/domain.ModelType" } ] } } }, - "domain.NodeStatus": { - "type": "integer", - "format": "int32", - "enum": [ - 1, - 2 - ], - "x-enum-varnames": [ - "NodeStatusDraft", - "NodeStatusReleased" - ] + "domain.GetProviderModelListResp": { + "type": "object", + "properties": { + "models": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.ProviderModelListItem" + } + } + } }, - "domain.NodeSummaryReq": { + "domain.HotBrowser": { "type": "object", - "required": [ - "ids", - "kb_id" - ], "properties": { - "ids": { + "browser": { "type": "array", "items": { - "type": "string" + "$ref": "#/definitions/domain.BrowserCount" } }, - "kb_id": { - "type": "string" + "os": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.BrowserCount" + } } } }, - "domain.NodeType": { - "type": "integer", - "format": "int32", - "enum": [ - 1, - 2 - ], - "x-enum-varnames": [ - "NodeTypeFolder", - "NodeTypeDocument" - ] - }, - "domain.ObjectUploadResp": { + "domain.HotPage": { "type": "object", "properties": { - "filename": { + "count": { + "type": "integer" + }, + "node_id": { "type": "string" }, - "key": { + "node_name": { "type": "string" + }, + "scene": { + "$ref": "#/definitions/domain.StatPageScene" } } }, - "domain.OpenAIAPIBotSettings": { + "domain.HotRefererHost": { "type": "object", "properties": { - "is_enabled": { - "type": "boolean" + "count": { + "type": "integer" }, - "secret_key": { + "referer_host": { "type": "string" } } }, - "domain.OpenAIChoice": { + "domain.IPAddress": { "type": "object", "properties": { - "delta": { - "description": "for streaming", - "allOf": [ - { - "$ref": "#/definitions/domain.OpenAIMessage" - } - ] + "city": { + "type": "string" }, - "finish_reason": { + "country": { "type": "string" }, - "index": { - "type": "integer" + "ip": { + "type": "string" }, - "message": { - "$ref": "#/definitions/domain.OpenAIMessage" + "province": { + "type": "string" } } }, - "domain.OpenAICompletionsRequest": { + "domain.InstantCountResp": { "type": "object", - "required": [ - "messages", - "model" - ], "properties": { - "frequency_penalty": { - "type": "number" - }, - "max_tokens": { + "count": { "type": "integer" }, - "messages": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.OpenAIMessage" - } + "time": { + "type": "string" + } + } + }, + "domain.InstantPageResp": { + "type": "object", + "properties": { + "created_at": { + "type": "string" }, - "model": { + "info": { + "$ref": "#/definitions/domain.AuthUserInfo" + }, + "ip": { "type": "string" }, - "presence_penalty": { - "type": "number" + "ip_address": { + "$ref": "#/definitions/domain.IPAddress" }, - "response_format": { - "$ref": "#/definitions/domain.OpenAIResponseFormat" + "node_id": { + "type": "string" }, - "stop": { - "type": "array", - "items": { - "type": "string" - } + "node_name": { + "type": "string" }, - "stream": { - "type": "boolean" + "scene": { + "$ref": "#/definitions/domain.StatPageScene" }, - "temperature": { - "type": "number" + "user_id": { + "type": "integer" + } + } + }, + "domain.KBReleaseListItemResp": { + "type": "object", + "properties": { + "created_at": { + "type": "string" }, - "tool_choice": { - "$ref": "#/definitions/domain.OpenAIToolChoice" + "id": { + "type": "string" }, - "tools": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.OpenAITool" - } + "kb_id": { + "type": "string" }, - "top_p": { - "type": "number" + "message": { + "type": "string" }, - "user": { + "tag": { "type": "string" } } }, - "domain.OpenAICompletionsResponse": { + "domain.KnowledgeBaseDetail": { "type": "object", "properties": { - "choices": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.OpenAIChoice" - } + "access_settings": { + "$ref": "#/definitions/domain.AccessSettings" + }, + "created_at": { + "type": "string" }, - "created": { - "type": "integer" + "dataset_id": { + "type": "string" }, "id": { "type": "string" }, - "model": { + "name": { "type": "string" }, - "object": { - "type": "string" + "perm": { + "description": "用户对知识库的权限", + "allOf": [ + { + "$ref": "#/definitions/consts.UserKBPermission" + } + ] }, - "usage": { - "$ref": "#/definitions/domain.OpenAIUsage" + "updated_at": { + "type": "string" } } }, - "domain.OpenAIError": { + "domain.KnowledgeBaseListItem": { "type": "object", "properties": { - "code": { + "access_settings": { + "$ref": "#/definitions/domain.AccessSettings" + }, + "created_at": { "type": "string" }, - "message": { + "dataset_id": { "type": "string" }, - "param": { + "id": { "type": "string" }, - "type": { + "name": { + "type": "string" + }, + "updated_at": { "type": "string" } } }, - "domain.OpenAIErrorResponse": { - "type": "object", - "properties": { - "error": { - "$ref": "#/definitions/domain.OpenAIError" - } - } - }, - "domain.OpenAIFunction": { + "domain.LarkBotSettings": { "type": "object", - "required": [ - "name" - ], "properties": { - "description": { + "app_id": { "type": "string" }, - "name": { + "app_secret": { "type": "string" }, - "parameters": { - "type": "object", - "additionalProperties": true - } - } - }, - "domain.OpenAIFunctionCall": { - "type": "object", - "required": [ - "arguments", - "name" - ], - "properties": { - "arguments": { + "encrypt_key": { "type": "string" }, - "name": { + "is_enabled": { + "type": "boolean" + }, + "verify_token": { "type": "string" } } }, - "domain.OpenAIFunctionChoice": { + "domain.Link": { "type": "object", - "required": [ - "name" - ], "properties": { "name": { "type": "string" + }, + "url": { + "type": "string" } } }, - "domain.OpenAIMessage": { + "domain.MessageFrom": { + "type": "integer", + "enum": [ + 1, + 2 + ], + "x-enum-varnames": [ + "MessageFromGroup", + "MessageFromPrivate" + ] + }, + "domain.ModelType": { + "type": "string", + "enum": [ + "chat", + "embedding", + "rerank", + "analysis", + "analysis-vl" + ], + "x-enum-varnames": [ + "ModelTypeChat", + "ModelTypeEmbedding", + "ModelTypeRerank", + "ModelTypeAnalysis", + "ModelTypeAnalysisVL" + ] + }, + "domain.MoveNodeReq": { "type": "object", "required": [ - "role" + "id", + "kb_id" ], "properties": { - "content": { + "id": { "type": "string" }, - "name": { + "kb_id": { "type": "string" }, - "role": { + "next_id": { "type": "string" }, - "tool_call_id": { + "parent_id": { "type": "string" }, - "tool_calls": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.OpenAIToolCall" - } - } - } - }, - "domain.OpenAIResponseFormat": { - "type": "object", - "required": [ - "type" - ], - "properties": { - "type": { + "prev_id": { "type": "string" } } }, - "domain.OpenAITool": { + "domain.NodeActionReq": { "type": "object", "required": [ - "type" + "action", + "ids", + "kb_id" ], "properties": { - "function": { - "$ref": "#/definitions/domain.OpenAIFunction" + "action": { + "type": "string", + "enum": [ + "delete" + ] }, - "type": { + "ids": { + "type": "array", + "items": { + "type": "string" + } + }, + "kb_id": { "type": "string" } } }, - "domain.OpenAIToolCall": { + "domain.NodeContentChunkSSE": { "type": "object", - "required": [ - "function", - "id", - "type" - ], "properties": { - "function": { - "$ref": "#/definitions/domain.OpenAIFunctionCall" + "emoji": { + "type": "string" }, - "id": { + "name": { "type": "string" }, - "type": { + "node_id": { "type": "string" - } - } - }, - "domain.OpenAIToolChoice": { - "type": "object", - "properties": { - "function": { - "$ref": "#/definitions/domain.OpenAIFunctionChoice" }, - "type": { + "summary": { "type": "string" } } }, - "domain.OpenAIUsage": { + "domain.NodeGroupDetail": { "type": "object", "properties": { - "completion_tokens": { + "auth_group_id": { "type": "integer" }, - "prompt_tokens": { - "type": "integer" + "auth_ids": { + "type": "array", + "items": { + "type": "integer" + } }, - "total_tokens": { - "type": "integer" - } - } - }, - "domain.PWResponse": { - "type": "object", - "properties": { - "code": { - "type": "integer" + "kb_id": { + "type": "string" }, - "data": {}, - "message": { + "name": { "type": "string" }, - "success": { - "type": "boolean" - } - } - }, - "domain.PaginatedResult-array_domain_ConversationMessageListItem": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.ConversationMessageListItem" - } + "node_id": { + "type": "string" }, - "total": { - "type": "integer" + "perm": { + "$ref": "#/definitions/consts.NodePermName" } } }, - "domain.ProviderModelListItem": { + "domain.NodeListItemResp": { "type": "object", "properties": { - "model": { + "created_at": { "type": "string" - } - } - }, - "domain.RecommendNodeListResp": { - "type": "object", - "properties": { + }, + "creator": { + "type": "string" + }, + "creator_id": { + "type": "string" + }, + "editor": { + "type": "string" + }, + "editor_id": { + "type": "string" + }, "emoji": { "type": "string" }, @@ -7396,1351 +6116,1338 @@ const docTemplate = `{ "position": { "type": "number" }, - "recommend_nodes": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.RecommendNodeListResp" - } + "status": { + "$ref": "#/definitions/domain.NodeStatus" }, "summary": { "type": "string" }, "type": { "$ref": "#/definitions/domain.NodeType" + }, + "updated_at": { + "type": "string" } } }, - "domain.Response": { + "domain.NodeMeta": { "type": "object", "properties": { - "data": {}, - "message": { + "emoji": { "type": "string" }, - "success": { - "type": "boolean" + "summary": { + "type": "string" } } }, - "domain.ScoreType": { - "type": "integer", - "enum": [ - 1, - -1 - ], - "x-enum-varnames": [ - "Like", - "DisLike" - ] - }, - "domain.ShareCommentListItem": { + "domain.NodePermissions": { "type": "object", "properties": { - "content": { - "type": "string" - }, - "created_at": { - "type": "string" - }, - "id": { - "type": "string" - }, - "info": { - "$ref": "#/definitions/domain.CommentInfo" - }, - "ip_address": { - "description": "ip地址", + "answerable": { + "description": "可被问答", "allOf": [ { - "$ref": "#/definitions/domain.IPAddress" + "$ref": "#/definitions/consts.NodeAccessPerm" } ] }, - "kb_id": { - "type": "string" - }, - "node_id": { - "type": "string" - }, - "parent_id": { - "type": "string" - }, - "pic_urls": { - "type": "array", - "items": { - "type": "string" - } + "visible": { + "description": "导航内可见", + "allOf": [ + { + "$ref": "#/definitions/consts.NodeAccessPerm" + } + ] }, - "root_id": { - "type": "string" + "visitable": { + "description": "可被访问", + "allOf": [ + { + "$ref": "#/definitions/consts.NodeAccessPerm" + } + ] } } }, - "domain.ShareConversationDetailResp": { + "domain.NodeStatus": { + "type": "integer", + "format": "int32", + "enum": [ + 1, + 2 + ], + "x-enum-varnames": [ + "NodeStatusDraft", + "NodeStatusReleased" + ] + }, + "domain.NodeSummaryReq": { "type": "object", + "required": [ + "ids", + "kb_id" + ], "properties": { - "created_at": { - "type": "string" - }, - "id": { - "type": "string" - }, - "messages": { + "ids": { "type": "array", "items": { - "$ref": "#/definitions/domain.ShareConversationMessage" + "type": "string" } }, - "subject": { + "kb_id": { "type": "string" } } }, - "domain.ShareConversationMessage": { + "domain.NodeType": { + "type": "integer", + "format": "int32", + "enum": [ + 1, + 2 + ], + "x-enum-varnames": [ + "NodeTypeFolder", + "NodeTypeDocument" + ] + }, + "domain.ObjectUploadResp": { "type": "object", "properties": { - "content": { + "filename": { "type": "string" }, - "created_at": { + "key": { "type": "string" - }, - "role": { - "$ref": "#/definitions/schema.RoleType" } } }, - "domain.SimpleAuth": { + "domain.OpenAIAPIBotSettings": { "type": "object", "properties": { - "enabled": { + "is_enabled": { "type": "boolean" }, - "password": { + "secret_key": { "type": "string" } } }, - "domain.SimpleDocConfig": { + "domain.OpenAIChoice": { "type": "object", "properties": { - "bg_color": { - "type": "string" + "delta": { + "description": "for streaming", + "allOf": [ + { + "$ref": "#/definitions/domain.OpenAIMessage" + } + ] }, - "title": { + "finish_reason": { "type": "string" }, - "title_color": { - "type": "string" + "index": { + "type": "integer" + }, + "message": { + "$ref": "#/definitions/domain.OpenAIMessage" } } }, - "domain.SocialMediaAccount": { + "domain.OpenAICompletionsRequest": { "type": "object", + "required": [ + "messages", + "model" + ], "properties": { - "channel": { - "type": "string" + "frequency_penalty": { + "type": "number" }, - "icon": { - "type": "string" + "max_tokens": { + "type": "integer" }, - "link": { - "type": "string" + "messages": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.OpenAIMessage" + } }, - "phone": { + "model": { "type": "string" }, - "text": { - "type": "string" - } - } - }, - "domain.StatPageReq": { - "type": "object", - "required": [ - "scene" - ], - "properties": { - "node_id": { - "type": "string" + "presence_penalty": { + "type": "number" }, - "scene": { - "enum": [ - 1, - 2, - 3, - 4 - ], - "allOf": [ - { - "$ref": "#/definitions/domain.StatPageScene" - } - ] + "response_format": { + "$ref": "#/definitions/domain.OpenAIResponseFormat" + }, + "stop": { + "type": "array", + "items": { + "type": "string" + } + }, + "stream": { + "type": "boolean" + }, + "temperature": { + "type": "number" + }, + "tool_choice": { + "$ref": "#/definitions/domain.OpenAIToolChoice" + }, + "tools": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.OpenAITool" + } + }, + "top_p": { + "type": "number" + }, + "user": { + "type": "string" } } }, - "domain.StatPageScene": { - "type": "integer", - "enum": [ - 1, - 2, - 3, - 4 - ], - "x-enum-varnames": [ - "StatPageSceneWelcome", - "StatPageSceneNodeDetail", - "StatPageSceneChat", - "StatPageSceneLogin" - ] - }, - "domain.TextReq": { + "domain.OpenAICompletionsResponse": { "type": "object", - "required": [ - "text" - ], "properties": { - "action": { - "description": "action: improve, summary, extend, shorten, etc.", + "choices": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.OpenAIChoice" + } + }, + "created": { + "type": "integer" + }, + "id": { "type": "string" }, - "text": { + "model": { + "type": "string" + }, + "object": { "type": "string" + }, + "usage": { + "$ref": "#/definitions/domain.OpenAIUsage" } } }, - "domain.ThemeAndStyle": { + "domain.OpenAIError": { "type": "object", "properties": { - "bg_image": { + "code": { "type": "string" }, - "doc_width": { + "message": { + "type": "string" + }, + "param": { + "type": "string" + }, + "type": { "type": "string" } } }, - "domain.UpdateAppReq": { + "domain.OpenAIErrorResponse": { "type": "object", "properties": { - "kb_id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "settings": { - "$ref": "#/definitions/domain.AppSettings" + "error": { + "$ref": "#/definitions/domain.OpenAIError" } } }, - "domain.UpdateKnowledgeBaseReq": { + "domain.OpenAIFunction": { "type": "object", "required": [ - "id" + "name" ], "properties": { - "access_settings": { - "$ref": "#/definitions/domain.AccessSettings" - }, - "id": { + "description": { "type": "string" }, "name": { "type": "string" + }, + "parameters": { + "type": "object", + "additionalProperties": true } } }, - "domain.UpdateModelReq": { + "domain.OpenAIFunctionCall": { "type": "object", "required": [ - "base_url", - "id", - "model", - "provider", - "type" + "arguments", + "name" ], "properties": { - "api_header": { - "type": "string" - }, - "api_key": { - "type": "string" - }, - "api_version": { - "description": "for azure openai", - "type": "string" - }, - "base_url": { - "type": "string" - }, - "id": { + "arguments": { "type": "string" }, - "is_active": { - "type": "boolean" - }, - "model": { + "name": { "type": "string" - }, - "parameters": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelParam" - }, - "provider": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelProvider" - }, - "type": { - "enum": [ - "chat", - "embedding", - "rerank", - "analysis", - "analysis-vl" - ], - "allOf": [ - { - "$ref": "#/definitions/domain.ModelType" - } - ] } } }, - "domain.UpdateNodeReq": { + "domain.OpenAIFunctionChoice": { "type": "object", "required": [ - "id", - "kb_id" + "name" ], "properties": { - "content": { - "type": "string" - }, - "emoji": { - "type": "string" - }, - "id": { - "type": "string" - }, - "kb_id": { - "type": "string" - }, "name": { "type": "string" - }, - "position": { - "type": "number" - }, - "summary": { - "type": "string" } } }, - "domain.UserInfo": { + "domain.OpenAIMessage": { "type": "object", + "required": [ + "role" + ], "properties": { - "auth_user_id": { - "type": "integer" - }, - "avatar": { - "description": "avatar", - "type": "string" - }, - "email": { + "content": { "type": "string" }, - "from": { - "$ref": "#/definitions/domain.MessageFrom" - }, "name": { "type": "string" }, - "real_name": { + "role": { "type": "string" }, - "user_id": { + "tool_call_id": { "type": "string" - } - } - }, - "domain.WebAppCommentSettings": { - "type": "object", - "properties": { - "is_enable": { - "type": "boolean" }, - "moderation_enable": { - "type": "boolean" + "tool_calls": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.OpenAIToolCall" + } } } }, - "domain.WebAppCustomSettings": { + "domain.OpenAIResponseFormat": { "type": "object", + "required": [ + "type" + ], "properties": { - "allow_theme_switching": { - "type": "boolean" - }, - "footer_show_intro": { - "type": "boolean" - }, - "header_search_placeholder": { + "type": { "type": "string" - }, - "show_brand_info": { - "type": "boolean" - }, - "social_media_accounts": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.SocialMediaAccount" - } } } }, - "domain.WebAppLandingConfig": { + "domain.OpenAITool": { "type": "object", + "required": [ + "type" + ], "properties": { - "banner_config": { - "$ref": "#/definitions/domain.BannerConfig" - }, - "basic_doc_config": { - "$ref": "#/definitions/domain.BasicDocConfig" - }, - "carousel_config": { - "$ref": "#/definitions/domain.CarouselConfig" - }, - "com_config_order": { - "type": "array", - "items": { - "type": "string" - } - }, - "dir_doc_config": { - "$ref": "#/definitions/domain.DirDocConfig" - }, - "faq_config": { - "$ref": "#/definitions/domain.FaqConfig" - }, - "node_ids": { - "type": "array", - "items": { - "type": "string" - } - }, - "simple_doc_config": { - "$ref": "#/definitions/domain.SimpleDocConfig" + "function": { + "$ref": "#/definitions/domain.OpenAIFunction" }, "type": { "type": "string" } } }, - "domain.WebAppLandingConfigResp": { + "domain.OpenAIToolCall": { "type": "object", - "properties": { - "banner_config": { - "$ref": "#/definitions/domain.BannerConfig" - }, - "basic_doc_config": { - "$ref": "#/definitions/domain.BasicDocConfig" - }, - "carousel_config": { - "$ref": "#/definitions/domain.CarouselConfig" - }, - "com_config_order": { - "type": "array", - "items": { - "type": "string" - } - }, - "dir_doc_config": { - "$ref": "#/definitions/domain.DirDocConfig" - }, - "faq_config": { - "$ref": "#/definitions/domain.FaqConfig" - }, - "node_ids": { - "type": "array", - "items": { - "type": "string" - } - }, - "nodes": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.RecommendNodeListResp" - } + "required": [ + "function", + "id", + "type" + ], + "properties": { + "function": { + "$ref": "#/definitions/domain.OpenAIFunctionCall" }, - "simple_doc_config": { - "$ref": "#/definitions/domain.SimpleDocConfig" + "id": { + "type": "string" }, "type": { "type": "string" } } }, - "domain.WecomAIBotSettings": { + "domain.OpenAIToolChoice": { "type": "object", "properties": { - "encodingaeskey": { + "function": { + "$ref": "#/definitions/domain.OpenAIFunctionChoice" + }, + "type": { "type": "string" + } + } + }, + "domain.OpenAIUsage": { + "type": "object", + "properties": { + "completion_tokens": { + "type": "integer" }, - "is_enabled": { - "type": "boolean" + "prompt_tokens": { + "type": "integer" }, - "token": { - "type": "string" + "total_tokens": { + "type": "integer" } } }, - "domain.WidgetBotSettings": { + "domain.PWResponse": { "type": "object", "properties": { - "btn_logo": { - "type": "string" + "code": { + "type": "integer" }, - "btn_text": { + "data": {}, + "message": { "type": "string" }, - "is_open": { + "success": { "type": "boolean" - }, - "theme_mode": { - "type": "string" } } }, - "github_com_chaitin_panda-wiki_api_auth_v1.AuthGetResp": { + "domain.PaginatedResult-array_domain_ConversationMessageListItem": { "type": "object", "properties": { - "auths": { + "data": { "type": "array", "items": { - "$ref": "#/definitions/v1.AuthItem" + "$ref": "#/definitions/domain.ConversationMessageListItem" } }, - "client_id": { - "type": "string" - }, - "client_secret": { - "type": "string" - }, - "proxy": { - "type": "string" - }, - "source_type": { - "$ref": "#/definitions/consts.SourceType" + "total": { + "type": "integer" } } }, - "github_com_chaitin_panda-wiki_api_share_v1.AuthGetResp": { + "domain.ProviderModelListItem": { "type": "object", "properties": { - "auth_type": { - "$ref": "#/definitions/consts.AuthType" - }, - "license_edition": { - "$ref": "#/definitions/consts.LicenseEdition" - }, - "source_type": { - "$ref": "#/definitions/consts.SourceType" + "model": { + "type": "string" } } }, - "github_com_chaitin_panda-wiki_api_share_v1.GitHubCallbackResp": { - "type": "object" - }, - "github_com_chaitin_panda-wiki_domain.CheckModelReq": { + "domain.RecommendNodeListResp": { "type": "object", - "required": [ - "base_url", - "model", - "provider", - "type" - ], "properties": { - "api_header": { + "emoji": { "type": "string" }, - "api_key": { + "id": { "type": "string" }, - "api_version": { - "description": "for azure openai", + "name": { "type": "string" }, - "base_url": { + "parent_id": { "type": "string" }, - "model": { - "type": "string" + "permissions": { + "$ref": "#/definitions/domain.NodePermissions" }, - "parameters": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelParam" + "position": { + "type": "number" }, - "provider": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelProvider" + "recommend_nodes": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.RecommendNodeListResp" + } + }, + "summary": { + "type": "string" }, "type": { - "enum": [ - "chat", - "embedding", - "rerank", - "analysis", - "analysis-vl" - ], - "allOf": [ - { - "$ref": "#/definitions/domain.ModelType" - } - ] + "$ref": "#/definitions/domain.NodeType" } } }, - "github_com_chaitin_panda-wiki_domain.CheckModelResp": { + "domain.Response": { "type": "object", "properties": { - "content": { + "data": {}, + "message": { "type": "string" }, - "error": { - "type": "string" + "success": { + "type": "boolean" } } }, - "github_com_chaitin_panda-wiki_domain.ModelListItem": { + "domain.ScoreType": { + "type": "integer", + "enum": [ + 1, + -1 + ], + "x-enum-varnames": [ + "Like", + "DisLike" + ] + }, + "domain.ShareCommentListItem": { "type": "object", "properties": { - "api_header": { + "content": { "type": "string" }, - "api_key": { + "created_at": { "type": "string" }, - "api_version": { - "description": "for azure openai", + "id": { "type": "string" }, - "base_url": { - "type": "string" + "info": { + "$ref": "#/definitions/domain.CommentInfo" }, - "completion_tokens": { - "type": "integer" + "ip_address": { + "description": "ip地址", + "allOf": [ + { + "$ref": "#/definitions/domain.IPAddress" + } + ] }, - "id": { + "kb_id": { "type": "string" }, - "is_active": { - "type": "boolean" - }, - "model": { + "node_id": { "type": "string" }, - "parameters": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelParam" - }, - "prompt_tokens": { - "type": "integer" - }, - "provider": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelProvider" + "parent_id": { + "type": "string" }, - "total_tokens": { - "type": "integer" + "pic_urls": { + "type": "array", + "items": { + "type": "string" + } }, - "type": { - "$ref": "#/definitions/domain.ModelType" + "root_id": { + "type": "string" } } }, - "github_com_chaitin_panda-wiki_domain.ModelParam": { + "domain.ShareConversationDetailResp": { "type": "object", "properties": { - "context_window": { - "type": "integer" - }, - "max_tokens": { - "type": "integer" - }, - "r1_enabled": { - "type": "boolean" - }, - "support_computer_use": { - "type": "boolean" + "created_at": { + "type": "string" }, - "support_images": { - "type": "boolean" + "id": { + "type": "string" }, - "support_prompt_cache": { - "type": "boolean" + "messages": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.ShareConversationMessage" + } }, - "temperature": { - "type": "number" + "subject": { + "type": "string" } } }, - "github_com_chaitin_panda-wiki_domain.ModelProvider": { - "type": "string", - "enum": [ - "BaiZhiCloud" - ], - "x-enum-varnames": [ - "ModelProviderBrandBaiZhiCloud" - ] - }, - "gocap.ChallengeData": { + "domain.ShareConversationMessage": { "type": "object", "properties": { - "challenge": { - "$ref": "#/definitions/gocap.ChallengeItem" + "content": { + "type": "string" }, - "expires": { - "description": "过期时间,毫秒级时间戳", - "type": "integer" + "created_at": { + "type": "string" + }, + "role": { + "$ref": "#/definitions/schema.RoleType" + } + } + }, + "domain.SimpleAuth": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" }, - "token": { - "description": "质询令牌", + "password": { "type": "string" } } }, - "gocap.ChallengeItem": { + "domain.SimpleDocConfig": { "type": "object", "properties": { - "c": { - "description": "质询数量", - "type": "integer" + "bg_color": { + "type": "string" }, - "d": { - "description": "质询难度", - "type": "integer" + "title": { + "type": "string" }, - "s": { - "description": "质询大小", - "type": "integer" + "title_color": { + "type": "string" } } }, - "gocap.VerificationResult": { + "domain.SocialMediaAccount": { "type": "object", "properties": { - "expires": { - "description": "过期时间,毫秒级时间戳", - "type": "integer" + "channel": { + "type": "string" }, - "message": { + "icon": { "type": "string" }, - "success": { - "type": "boolean" + "link": { + "type": "string" }, - "token": { - "description": "验证令牌", + "phone": { + "type": "string" + }, + "text": { "type": "string" } } }, - "schema.RoleType": { - "type": "string", - "enum": [ - "assistant", - "user", - "system", - "tool" - ], - "x-enum-varnames": [ - "Assistant", - "User", - "System", - "Tool" - ] - }, - "share.ShareCommentLists": { + "domain.StatPageReq": { "type": "object", + "required": [ + "scene" + ], "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.ShareCommentListItem" - } + "node_id": { + "type": "string" }, - "total": { - "type": "integer" + "scene": { + "enum": [ + 1, + 2, + 3, + 4 + ], + "allOf": [ + { + "$ref": "#/definitions/domain.StatPageScene" + } + ] } } }, - "v1.AuthGitHubReq": { + "domain.StatPageScene": { + "type": "integer", + "enum": [ + 1, + 2, + 3, + 4 + ], + "x-enum-varnames": [ + "StatPageSceneWelcome", + "StatPageSceneNodeDetail", + "StatPageSceneChat", + "StatPageSceneLogin" + ] + }, + "domain.TextReq": { "type": "object", + "required": [ + "text" + ], "properties": { - "kb_id": { + "action": { + "description": "action: improve, summary, extend, shorten, etc.", "type": "string" }, - "redirect_url": { + "text": { "type": "string" } } }, - "v1.AuthGitHubResp": { + "domain.ThemeAndStyle": { "type": "object", "properties": { - "url": { + "bg_image": { + "type": "string" + }, + "doc_width": { "type": "string" } } }, - "v1.AuthItem": { + "domain.UpdateAppReq": { "type": "object", "properties": { - "avatar_url": { - "type": "string" - }, - "created_at": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "ip": { + "kb_id": { "type": "string" }, - "last_login_time": { + "name": { "type": "string" }, - "source_type": { - "$ref": "#/definitions/consts.SourceType" - }, - "username": { - "type": "string" + "settings": { + "$ref": "#/definitions/domain.AppSettings" } } }, - "v1.AuthLoginSimpleReq": { + "domain.UpdateKnowledgeBaseReq": { "type": "object", "required": [ - "password" + "id" ], "properties": { - "password": { + "access_settings": { + "$ref": "#/definitions/domain.AccessSettings" + }, + "id": { + "type": "string" + }, + "name": { "type": "string" } } }, - "v1.AuthSetReq": { + "domain.UpdateModelReq": { "type": "object", "required": [ - "source_type" + "base_url", + "id", + "model", + "provider", + "type" ], "properties": { - "client_id": { + "api_header": { "type": "string" }, - "client_secret": { + "api_key": { "type": "string" }, - "kb_id": { + "api_version": { + "description": "for azure openai", "type": "string" }, - "proxy": { + "base_url": { "type": "string" }, - "source_type": { + "id": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "model": { + "type": "string" + }, + "parameters": { + "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelParam" + }, + "provider": { + "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelProvider" + }, + "type": { "enum": [ - "github" + "chat", + "embedding", + "rerank", + "analysis", + "analysis-vl" ], "allOf": [ { - "$ref": "#/definitions/consts.SourceType" + "$ref": "#/definitions/domain.ModelType" } ] } } }, - "v1.CommentLists": { + "domain.UpdateNodeReq": { "type": "object", + "required": [ + "id", + "kb_id" + ], "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.CommentListItem" - } + "content": { + "type": "string" + }, + "emoji": { + "type": "string" }, - "total": { - "type": "integer" - } - } - }, - "v1.ConfluenceParseItem": { - "type": "object", - "properties": { "id": { "type": "string" }, - "title": { + "kb_id": { "type": "string" }, - "url": { + "name": { "type": "string" - } - } - }, - "v1.ConfluenceParseResp": { - "type": "object", - "properties": { - "docs": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.ConfluenceParseItem" - } }, - "id": { + "position": { + "type": "number" + }, + "summary": { "type": "string" } } }, - "v1.ConfluenceScrapeReq": { + "domain.UserInfo": { "type": "object", - "required": [ - "doc_id", - "id", - "kb_id" - ], "properties": { - "doc_id": { + "auth_user_id": { + "type": "integer" + }, + "avatar": { + "description": "avatar", "type": "string" }, - "id": { + "email": { "type": "string" }, - "kb_id": { + "from": { + "$ref": "#/definitions/domain.MessageFrom" + }, + "name": { + "type": "string" + }, + "real_name": { + "type": "string" + }, + "user_id": { "type": "string" } } }, - "v1.ConfluenceScrapeResp": { + "domain.WebAppCommentSettings": { "type": "object", "properties": { - "content": { - "type": "string" + "is_enable": { + "type": "boolean" + }, + "moderation_enable": { + "type": "boolean" } } }, - "v1.ConversationListItems": { + "domain.WebAppCustomSettings": { "type": "object", "properties": { - "data": { + "allow_theme_switching": { + "type": "boolean" + }, + "footer_show_intro": { + "type": "boolean" + }, + "header_search_placeholder": { + "type": "string" + }, + "show_brand_info": { + "type": "boolean" + }, + "social_media_accounts": { "type": "array", "items": { - "$ref": "#/definitions/domain.ConversationListItem" + "$ref": "#/definitions/domain.SocialMediaAccount" } - }, - "total": { - "type": "integer" } } }, - "v1.CrawlerResultItem": { + "domain.WebAppLandingConfig": { "type": "object", "properties": { - "content": { - "type": "string" + "banner_config": { + "$ref": "#/definitions/domain.BannerConfig" }, - "status": { - "$ref": "#/definitions/consts.CrawlerStatus" + "basic_doc_config": { + "$ref": "#/definitions/domain.BasicDocConfig" }, - "task_id": { + "carousel_config": { + "$ref": "#/definitions/domain.CarouselConfig" + }, + "com_config_order": { + "type": "array", + "items": { + "type": "string" + } + }, + "dir_doc_config": { + "$ref": "#/definitions/domain.DirDocConfig" + }, + "faq_config": { + "$ref": "#/definitions/domain.FaqConfig" + }, + "node_ids": { + "type": "array", + "items": { + "type": "string" + } + }, + "simple_doc_config": { + "$ref": "#/definitions/domain.SimpleDocConfig" + }, + "type": { "type": "string" } } }, - "v1.CrawlerResultResp": { + "domain.WebAppLandingConfigResp": { "type": "object", - "required": [ - "status" - ], "properties": { - "content": { - "type": "string" + "banner_config": { + "$ref": "#/definitions/domain.BannerConfig" }, - "status": { - "$ref": "#/definitions/consts.CrawlerStatus" - } - } - }, - "v1.CrawlerResultsReq": { - "type": "object", - "required": [ - "task_ids" - ], - "properties": { - "task_ids": { + "basic_doc_config": { + "$ref": "#/definitions/domain.BasicDocConfig" + }, + "carousel_config": { + "$ref": "#/definitions/domain.CarouselConfig" + }, + "com_config_order": { "type": "array", "items": { "type": "string" } - } - } - }, - "v1.CrawlerResultsResp": { - "type": "object", - "properties": { - "list": { + }, + "dir_doc_config": { + "$ref": "#/definitions/domain.DirDocConfig" + }, + "faq_config": { + "$ref": "#/definitions/domain.FaqConfig" + }, + "node_ids": { "type": "array", "items": { - "$ref": "#/definitions/v1.CrawlerResultItem" + "type": "string" } }, - "status": { - "$ref": "#/definitions/consts.CrawlerStatus" + "nodes": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.RecommendNodeListResp" + } + }, + "simple_doc_config": { + "$ref": "#/definitions/domain.SimpleDocConfig" + }, + "type": { + "type": "string" } } }, - "v1.CreateUserReq": { + "domain.WecomAIBotSettings": { "type": "object", - "required": [ - "account", - "password", - "role" - ], "properties": { - "account": { + "encodingaeskey": { "type": "string" }, - "password": { - "type": "string", - "minLength": 8 + "is_enabled": { + "type": "boolean" }, - "role": { - "enum": [ - "admin", - "user" - ], - "allOf": [ - { - "$ref": "#/definitions/consts.UserRole" - } - ] + "token": { + "type": "string" } } }, - "v1.CreateUserResp": { + "domain.WidgetBotSettings": { "type": "object", "properties": { - "id": { + "btn_logo": { + "type": "string" + }, + "btn_text": { + "type": "string" + }, + "is_open": { + "type": "boolean" + }, + "theme_mode": { "type": "string" } } }, - "v1.EpubParseReq": { + "github_com_chaitin_panda-wiki_api_auth_v1.AuthGetResp": { "type": "object", - "required": [ - "filename", - "kb_id", - "key" - ], "properties": { - "filename": { + "auths": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.AuthItem" + } + }, + "client_id": { "type": "string" }, - "kb_id": { + "client_secret": { "type": "string" }, - "key": { + "proxy": { "type": "string" + }, + "source_type": { + "$ref": "#/definitions/consts.SourceType" } } }, - "v1.EpubParseResp": { + "github_com_chaitin_panda-wiki_api_share_v1.AuthGetResp": { "type": "object", "properties": { - "task_id": { - "type": "string" + "auth_type": { + "$ref": "#/definitions/consts.AuthType" + }, + "license_edition": { + "$ref": "#/definitions/consts.LicenseEdition" + }, + "source_type": { + "$ref": "#/definitions/consts.SourceType" } } }, - "v1.FeishuGetDocReq": { + "github_com_chaitin_panda-wiki_api_share_v1.GitHubCallbackResp": { + "type": "object" + }, + "github_com_chaitin_panda-wiki_domain.CheckModelReq": { "type": "object", "required": [ - "doc_id", - "id", - "kb_id" + "base_url", + "model", + "provider", + "type" ], "properties": { - "doc_id": { + "api_header": { "type": "string" }, - "file_type": { + "api_key": { "type": "string" }, - "id": { + "api_version": { + "description": "for azure openai", "type": "string" }, - "kb_id": { + "base_url": { "type": "string" }, - "space_id": { + "model": { "type": "string" + }, + "parameters": { + "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelParam" + }, + "provider": { + "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelProvider" + }, + "type": { + "enum": [ + "chat", + "embedding", + "rerank", + "analysis", + "analysis-vl" + ], + "allOf": [ + { + "$ref": "#/definitions/domain.ModelType" + } + ] } } }, - "v1.FeishuGetDocResp": { + "github_com_chaitin_panda-wiki_domain.CheckModelResp": { "type": "object", "properties": { "content": { "type": "string" - } - } - }, - "v1.FeishuListCloudDocReq": { - "type": "object", - "required": [ - "app_id", - "app_secret", - "user_access_token" - ], - "properties": { - "app_id": { - "type": "string" - }, - "app_secret": { - "type": "string" }, - "user_access_token": { + "error": { "type": "string" } } - }, - "v1.FeishuListCloudDocResp": { - "type": "object", - "required": [ - "doc_id", - "id" - ], + }, + "github_com_chaitin_panda-wiki_domain.ModelListItem": { + "type": "object", "properties": { - "doc_id": { + "api_header": { "type": "string" }, - "file_type": { + "api_key": { "type": "string" }, - "id": { + "api_version": { + "description": "for azure openai", "type": "string" }, - "space_id": { + "base_url": { "type": "string" }, - "title": { + "completion_tokens": { + "type": "integer" + }, + "id": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "model": { "type": "string" + }, + "parameters": { + "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelParam" + }, + "prompt_tokens": { + "type": "integer" + }, + "provider": { + "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelProvider" + }, + "total_tokens": { + "type": "integer" + }, + "type": { + "$ref": "#/definitions/domain.ModelType" } } }, - "v1.FeishuSearchWikiReq": { + "github_com_chaitin_panda-wiki_domain.ModelParam": { "type": "object", - "required": [ - "app_id", - "app_secret", - "user_access_token" - ], "properties": { - "app_id": { - "type": "string" + "context_window": { + "type": "integer" }, - "app_secret": { - "type": "string" + "max_tokens": { + "type": "integer" }, - "space_id": { - "type": "string" + "r1_enabled": { + "type": "boolean" }, - "user_access_token": { - "type": "string" + "support_computer_use": { + "type": "boolean" + }, + "support_images": { + "type": "boolean" + }, + "support_prompt_cache": { + "type": "boolean" + }, + "temperature": { + "type": "number" } } }, - "v1.FeishuSearchWikiResp": { - "type": "object", - "required": [ - "doc_id", - "id" + "github_com_chaitin_panda-wiki_domain.ModelProvider": { + "type": "string", + "enum": [ + "BaiZhiCloud" ], + "x-enum-varnames": [ + "ModelProviderBrandBaiZhiCloud" + ] + }, + "gocap.ChallengeData": { + "type": "object", "properties": { - "doc_id": { - "type": "string" - }, - "file_type": { - "type": "string" - }, - "id": { - "type": "string" + "challenge": { + "$ref": "#/definitions/gocap.ChallengeItem" }, - "space_id": { - "type": "string" + "expires": { + "description": "过期时间,毫秒级时间戳", + "type": "integer" }, - "title": { + "token": { + "description": "质询令牌", "type": "string" } } }, - "v1.FeishuSpaceListReq": { + "gocap.ChallengeItem": { "type": "object", - "required": [ - "app_id", - "app_secret", - "user_access_token" - ], "properties": { - "app_id": { - "type": "string" + "c": { + "description": "质询数量", + "type": "integer" }, - "app_secret": { - "type": "string" + "d": { + "description": "质询难度", + "type": "integer" }, - "user_access_token": { - "type": "string" + "s": { + "description": "质询大小", + "type": "integer" } } }, - "v1.FeishuSpaceListResp": { + "gocap.VerificationResult": { "type": "object", "properties": { - "name": { + "expires": { + "description": "过期时间,毫秒级时间戳", + "type": "integer" + }, + "message": { "type": "string" }, - "space_id": { + "success": { + "type": "boolean" + }, + "token": { + "description": "验证令牌", "type": "string" } } }, - "v1.FileUploadResp": { + "schema.RoleType": { + "type": "string", + "enum": [ + "assistant", + "user", + "system", + "tool" + ], + "x-enum-varnames": [ + "Assistant", + "User", + "System", + "Tool" + ] + }, + "share.ShareCommentLists": { "type": "object", "properties": { - "key": { - "type": "string" + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.ShareCommentListItem" + } + }, + "total": { + "type": "integer" } } }, - "v1.KBUserInviteReq": { + "v1.AuthGitHubReq": { "type": "object", - "required": [ - "kb_id", - "perm", - "user_id" - ], "properties": { "kb_id": { "type": "string" }, - "perm": { - "enum": [ - "full_control", - "doc_manage", - "data_operate" - ], - "allOf": [ - { - "$ref": "#/definitions/consts.UserKBPermission" - } - ] - }, - "user_id": { + "redirect_url": { "type": "string" } } }, - "v1.KBUserListItemResp": { + "v1.AuthGitHubResp": { "type": "object", "properties": { - "account": { - "type": "string" - }, - "id": { + "url": { "type": "string" - }, - "perms": { - "$ref": "#/definitions/consts.UserKBPermission" - }, - "role": { - "$ref": "#/definitions/consts.UserRole" } } }, - "v1.KBUserUpdateReq": { + "v1.AuthItem": { "type": "object", - "required": [ - "kb_id", - "perm", - "user_id" - ], "properties": { - "kb_id": { + "avatar_url": { "type": "string" }, - "perm": { - "enum": [ - "full_control", - "doc_manage", - "data_operate" - ], - "allOf": [ - { - "$ref": "#/definitions/consts.UserKBPermission" - } - ] + "created_at": { + "type": "string" }, - "user_id": { + "id": { + "type": "integer" + }, + "ip": { + "type": "string" + }, + "last_login_time": { + "type": "string" + }, + "source_type": { + "$ref": "#/definitions/consts.SourceType" + }, + "username": { "type": "string" } } }, - "v1.LoginReq": { + "v1.AuthLoginSimpleReq": { "type": "object", "required": [ - "account", "password" ], "properties": { - "account": { - "type": "string" - }, "password": { "type": "string" } } }, - "v1.LoginResp": { + "v1.AuthSetReq": { "type": "object", + "required": [ + "source_type" + ], "properties": { - "token": { + "client_id": { + "type": "string" + }, + "client_secret": { + "type": "string" + }, + "kb_id": { + "type": "string" + }, + "proxy": { "type": "string" + }, + "source_type": { + "enum": [ + "github" + ], + "allOf": [ + { + "$ref": "#/definitions/consts.SourceType" + } + ] } } }, - "v1.MindocParseItem": { + "v1.CommentLists": { "type": "object", "properties": { - "id": { - "type": "string" - }, - "title": { - "type": "string" + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.CommentListItem" + } }, - "url": { - "type": "string" + "total": { + "type": "integer" } } }, - "v1.MindocParseResp": { + "v1.ConversationListItems": { "type": "object", "properties": { - "docs": { + "data": { "type": "array", "items": { - "$ref": "#/definitions/v1.MindocParseItem" + "$ref": "#/definitions/domain.ConversationListItem" } }, - "id": { - "type": "string" + "total": { + "type": "integer" } } }, - "v1.MindocScrapeReq": { + "v1.CrawlerExportReq": { "type": "object", "required": [ "doc_id", @@ -8751,423 +7458,415 @@ const docTemplate = `{ "doc_id": { "type": "string" }, + "file_type": { + "type": "string" + }, "id": { "type": "string" }, "kb_id": { "type": "string" - } - } - }, - "v1.MindocScrapeResp": { - "type": "object", - "properties": { - "content": { + }, + "space_id": { "type": "string" } } }, - "v1.NodeDetailResp": { + "v1.CrawlerExportResp": { "type": "object", "properties": { - "content": { - "type": "string" - }, - "created_at": { - "type": "string" - }, - "id": { - "type": "string" - }, - "kb_id": { - "type": "string" - }, - "meta": { - "$ref": "#/definitions/domain.NodeMeta" - }, - "name": { - "type": "string" - }, - "parent_id": { - "type": "string" - }, - "permissions": { - "$ref": "#/definitions/domain.NodePermissions" - }, - "status": { - "$ref": "#/definitions/domain.NodeStatus" - }, - "type": { - "$ref": "#/definitions/domain.NodeType" - }, - "updated_at": { + "task_id": { "type": "string" } } }, - "v1.NodePermissionEditReq": { + "v1.CrawlerParseReq": { "type": "object", "required": [ - "ids", + "crawler_source", "kb_id" ], "properties": { - "answerable_groups": { - "description": "可被问答", - "type": "array", - "items": { - "type": "integer" - } + "crawler_source": { + "$ref": "#/definitions/consts.CrawlerSource" }, - "ids": { - "type": "array", - "items": { - "type": "string" - } + "feishu_setting": { + "$ref": "#/definitions/v1.FeishuSetting" }, - "kb_id": { + "filename": { "type": "string" }, - "permissions": { - "$ref": "#/definitions/domain.NodePermissions" - }, - "visible_groups": { - "description": "导航内可见", - "type": "array", - "items": { - "type": "integer" - } + "kb_id": { + "type": "string" }, - "visitable_groups": { - "description": "可被访问", - "type": "array", - "items": { - "type": "integer" - } + "key": { + "type": "string" } } }, - "v1.NodePermissionEditResp": { - "type": "object" - }, - "v1.NodePermissionResp": { + "v1.CrawlerParseResp": { "type": "object", "properties": { - "answerable_groups": { - "description": "可被问答", - "type": "array", - "items": { - "$ref": "#/definitions/domain.NodeGroupDetail" - } + "docs": { + "$ref": "#/definitions/anydoc.Child" }, "id": { "type": "string" - }, - "permissions": { - "$ref": "#/definitions/domain.NodePermissions" - }, - "visible_groups": { - "description": "导航内可见", - "type": "array", - "items": { - "$ref": "#/definitions/domain.NodeGroupDetail" - } - }, - "visitable_groups": { - "description": "可被访问", - "type": "array", - "items": { - "$ref": "#/definitions/domain.NodeGroupDetail" - } } } }, - "v1.NotionParseItem": { + "v1.CrawlerResultItem": { "type": "object", "properties": { - "id": { + "content": { "type": "string" }, - "title": { + "status": { + "$ref": "#/definitions/consts.CrawlerStatus" + }, + "task_id": { "type": "string" } } }, - "v1.NotionParseReq": { + "v1.CrawlerResultReq": { "type": "object", "required": [ - "integration" + "task_id" ], "properties": { - "integration": { + "task_id": { "type": "string" } } }, - "v1.NotionParseResp": { + "v1.CrawlerResultResp": { "type": "object", + "required": [ + "status" + ], "properties": { - "docs": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.NotionParseItem" - } - }, - "id": { + "content": { "type": "string" + }, + "status": { + "$ref": "#/definitions/consts.CrawlerStatus" } } }, - "v1.NotionScrapeReq": { + "v1.CrawlerResultsReq": { "type": "object", "required": [ - "doc_id", - "id", - "kb_id" + "task_ids" ], "properties": { - "doc_id": { - "type": "string" - }, - "id": { - "type": "string" - }, - "kb_id": { - "type": "string" + "task_ids": { + "type": "array", + "items": { + "type": "string" + } } } }, - "v1.NotionScrapeResp": { + "v1.CrawlerResultsResp": { "type": "object", "properties": { - "content": { - "type": "string" + "list": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.CrawlerResultItem" + } + }, + "status": { + "$ref": "#/definitions/consts.CrawlerStatus" } } }, - "v1.ResetPasswordReq": { + "v1.CreateUserReq": { "type": "object", "required": [ - "id", - "new_password" + "account", + "password", + "role" ], "properties": { - "id": { + "account": { "type": "string" }, - "new_password": { + "password": { "type": "string", "minLength": 8 - } - } - }, - "v1.RssParseItem": { - "type": "object", - "properties": { - "desc": { - "type": "string" - }, - "title": { - "type": "string" }, - "url": { - "type": "string" + "role": { + "enum": [ + "admin", + "user" + ], + "allOf": [ + { + "$ref": "#/definitions/consts.UserRole" + } + ] } } }, - "v1.RssParseReq": { + "v1.CreateUserResp": { "type": "object", - "required": [ - "url" - ], "properties": { - "url": { + "id": { "type": "string" } } }, - "v1.RssParseResp": { + "v1.FeishuSetting": { "type": "object", "properties": { - "id": { + "app_id": { "type": "string" }, - "list": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.RssParseItem" - } - } - } - }, - "v1.RssScrapeReq": { - "type": "object", - "required": [ - "id", - "kb_id", - "url" - ], - "properties": { - "id": { + "app_secret": { "type": "string" }, - "kb_id": { + "space_id": { "type": "string" }, - "url": { + "user_access_token": { "type": "string" } } }, - "v1.RssScrapeResp": { + "v1.FileUploadResp": { "type": "object", "properties": { - "content": { + "key": { "type": "string" } } }, - "v1.ScrapeReq": { + "v1.KBUserInviteReq": { "type": "object", "required": [ "kb_id", - "url" + "perm", + "user_id" ], "properties": { "kb_id": { "type": "string" }, - "url": { + "perm": { + "enum": [ + "full_control", + "doc_manage", + "data_operate" + ], + "allOf": [ + { + "$ref": "#/definitions/consts.UserKBPermission" + } + ] + }, + "user_id": { "type": "string" } } }, - "v1.ScrapeResp": { + "v1.KBUserListItemResp": { "type": "object", "properties": { - "task_id": { + "account": { "type": "string" }, - "title": { + "id": { "type": "string" + }, + "perms": { + "$ref": "#/definitions/consts.UserKBPermission" + }, + "role": { + "$ref": "#/definitions/consts.UserRole" } } }, - "v1.SitemapParseItem": { + "v1.KBUserUpdateReq": { "type": "object", + "required": [ + "kb_id", + "perm", + "user_id" + ], "properties": { - "title": { + "kb_id": { "type": "string" }, - "url": { + "perm": { + "enum": [ + "full_control", + "doc_manage", + "data_operate" + ], + "allOf": [ + { + "$ref": "#/definitions/consts.UserKBPermission" + } + ] + }, + "user_id": { "type": "string" } } }, - "v1.SitemapParseReq": { + "v1.LoginReq": { "type": "object", "required": [ - "url" + "account", + "password" ], "properties": { - "url": { + "account": { + "type": "string" + }, + "password": { "type": "string" } } }, - "v1.SitemapParseResp": { + "v1.LoginResp": { "type": "object", "properties": { - "id": { + "token": { "type": "string" - }, - "list": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.SitemapParseItem" - } } } }, - "v1.SitemapScrapeReq": { + "v1.NodeDetailResp": { "type": "object", - "required": [ - "id", - "kb_id", - "url" - ], "properties": { + "content": { + "type": "string" + }, + "created_at": { + "type": "string" + }, "id": { "type": "string" }, "kb_id": { "type": "string" }, - "url": { + "meta": { + "$ref": "#/definitions/domain.NodeMeta" + }, + "name": { "type": "string" - } - } - }, - "v1.SitemapScrapeResp": { - "type": "object", - "properties": { - "content": { + }, + "parent_id": { + "type": "string" + }, + "permissions": { + "$ref": "#/definitions/domain.NodePermissions" + }, + "status": { + "$ref": "#/definitions/domain.NodeStatus" + }, + "type": { + "$ref": "#/definitions/domain.NodeType" + }, + "updated_at": { "type": "string" } } }, - "v1.SiyuanParseItem": { + "v1.NodePermissionEditReq": { "type": "object", + "required": [ + "ids", + "kb_id" + ], "properties": { - "id": { - "type": "string" + "answerable_groups": { + "description": "可被问答", + "type": "array", + "items": { + "type": "integer" + } }, - "title": { - "type": "string" + "ids": { + "type": "array", + "items": { + "type": "string" + } }, - "url": { + "kb_id": { "type": "string" + }, + "permissions": { + "$ref": "#/definitions/domain.NodePermissions" + }, + "visible_groups": { + "description": "导航内可见", + "type": "array", + "items": { + "type": "integer" + } + }, + "visitable_groups": { + "description": "可被访问", + "type": "array", + "items": { + "type": "integer" + } } } }, - "v1.SiyuanParseResp": { + "v1.NodePermissionEditResp": { + "type": "object" + }, + "v1.NodePermissionResp": { "type": "object", "properties": { - "docs": { + "answerable_groups": { + "description": "可被问答", "type": "array", "items": { - "$ref": "#/definitions/v1.SiyuanParseItem" + "$ref": "#/definitions/domain.NodeGroupDetail" } }, "id": { "type": "string" + }, + "permissions": { + "$ref": "#/definitions/domain.NodePermissions" + }, + "visible_groups": { + "description": "导航内可见", + "type": "array", + "items": { + "$ref": "#/definitions/domain.NodeGroupDetail" + } + }, + "visitable_groups": { + "description": "可被访问", + "type": "array", + "items": { + "$ref": "#/definitions/domain.NodeGroupDetail" + } } } }, - "v1.SiyuanScrapeReq": { + "v1.ResetPasswordReq": { "type": "object", "required": [ - "doc_id", "id", - "kb_id" + "new_password" ], "properties": { - "doc_id": { - "type": "string" - }, "id": { "type": "string" }, - "kb_id": { - "type": "string" - } - } - }, - "v1.SiyuanScrapeResp": { - "type": "object", - "properties": { - "content": { - "type": "string" + "new_password": { + "type": "string", + "minLength": 8 } } }, @@ -9241,99 +7940,6 @@ const docTemplate = `{ } } } - }, - "v1.WikijsParseItem": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "title": { - "type": "string" - } - } - }, - "v1.WikijsParseResp": { - "type": "object", - "properties": { - "docs": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.WikijsParseItem" - } - }, - "id": { - "type": "string" - } - } - }, - "v1.WikijsScrapeReq": { - "type": "object", - "required": [ - "doc_id", - "id", - "kb_id" - ], - "properties": { - "doc_id": { - "type": "string" - }, - "id": { - "type": "string" - }, - "kb_id": { - "type": "string" - } - } - }, - "v1.WikijsScrapeResp": { - "type": "object", - "properties": { - "content": { - "type": "string" - } - } - }, - "v1.YuqueParseItem": { - "type": "object", - "properties": { - "task_id": { - "type": "string" - }, - "title": { - "type": "string" - } - } - }, - "v1.YuqueParseReq": { - "type": "object", - "required": [ - "filename", - "kb_id", - "key" - ], - "properties": { - "filename": { - "type": "string" - }, - "kb_id": { - "type": "string" - }, - "key": { - "type": "string" - } - } - }, - "v1.YuqueParseResp": { - "type": "object", - "properties": { - "list": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.YuqueParseItem" - } - } - } } }, "securityDefinitions": { diff --git a/backend/docs/swagger.json b/backend/docs/swagger.json index 2d926d16..362eb1a8 100644 --- a/backend/docs/swagger.json +++ b/backend/docs/swagger.json @@ -656,11 +656,11 @@ } } }, - "/api/v1/crawler/confluence/parse": { + "/api/v1/crawler/export": { "post": { - "description": "Parse Confluence Export File and return document list", + "description": "CrawlerExport", "consumes": [ - "multipart/form-data" + "application/json" ], "produces": [ "application/json" @@ -668,21 +668,16 @@ "tags": [ "crawler" ], - "summary": "ConfluenceParse", + "summary": "CrawlerExport", "parameters": [ { - "type": "file", - "description": "file", - "name": "file", - "in": "formData", - "required": true - }, - { - "type": "string", - "description": "kb_id", - "name": "kb_id", - "in": "formData", - "required": true + "description": "Scrape", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.CrawlerExportReq" + } } ], "responses": { @@ -697,7 +692,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.ConfluenceParseResp" + "$ref": "#/definitions/v1.CrawlerExportResp" } } } @@ -707,9 +702,9 @@ } } }, - "/api/v1/crawler/confluence/scrape": { + "/api/v1/crawler/parse": { "post": { - "description": "Scrape specific Confluence documents by ID", + "description": "解析文档树", "consumes": [ "application/json" ], @@ -719,15 +714,15 @@ "tags": [ "crawler" ], - "summary": "ConfluenceScrape", + "summary": "解析文档树", "parameters": [ { - "description": "Scrape Request", + "description": "Scrape", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.ConfluenceScrapeReq" + "$ref": "#/definitions/v1.CrawlerParseReq" } } ], @@ -743,7 +738,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.ConfluenceScrapeResp" + "$ref": "#/definitions/v1.CrawlerParseResp" } } } @@ -753,9 +748,9 @@ } } }, - "/api/v1/crawler/epub/parse": { - "post": { - "description": "EpubParse", + "/api/v1/crawler/result": { + "get": { + "description": "Retrieve the result of a previously started scraping task", "consumes": [ "application/json" ], @@ -765,15 +760,15 @@ "tags": [ "crawler" ], - "summary": "EpubParse", + "summary": "Get Crawler Result", "parameters": [ { - "description": "Parse URL", + "description": "Crawler Result Request", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.EpubParseReq" + "$ref": "#/definitions/v1.CrawlerResultReq" } } ], @@ -789,7 +784,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.EpubParseResp" + "$ref": "#/definitions/v1.CrawlerResultResp" } } } @@ -799,9 +794,9 @@ } } }, - "/api/v1/crawler/feishu/get_doc": { + "/api/v1/crawler/results": { "post": { - "description": "Get Docx in Feishu Spaces", + "description": "Retrieve the results of a previously started scraping task", "consumes": [ "application/json" ], @@ -811,15 +806,15 @@ "tags": [ "crawler" ], - "summary": "FeishuDoc", + "summary": "Get Crawler Results", "parameters": [ { - "description": "Get Docx", - "name": "body", + "description": "Crawler Results Request", + "name": "param", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.FeishuGetDocReq" + "$ref": "#/definitions/v1.CrawlerResultsReq" } } ], @@ -835,7 +830,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.FeishuGetDocResp" + "$ref": "#/definitions/v1.CrawlerResultsResp" } } } @@ -845,9 +840,9 @@ } } }, - "/api/v1/crawler/feishu/list_doc": { + "/api/v1/creation/tab-complete": { "post": { - "description": "List Docx in Feishu Spaces", + "description": "Tab-based document completion similar to AI coding's FIM (Fill in Middle)", "consumes": [ "application/json" ], @@ -855,48 +850,33 @@ "application/json" ], "tags": [ - "crawler" + "creation" ], - "summary": "FeishuListCloudDoc", + "summary": "Tab-based document completion", "parameters": [ { - "description": "Search Docx", + "description": "tab completion request", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.FeishuListCloudDocReq" + "$ref": "#/definitions/domain.CompleteReq" } } ], "responses": { "200": { - "description": "OK", + "description": "success", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.FeishuListCloudDocResp" - } - } - } - } - ] + "type": "string" } } } } }, - "/api/v1/crawler/feishu/list_spaces": { + "/api/v1/creation/text": { "post": { - "description": "List All Feishu Spaces", + "description": "Text creation", "consumes": [ "application/json" ], @@ -904,119 +884,87 @@ "application/json" ], "tags": [ - "crawler" + "creation" ], - "summary": "FeishuListSpaces", + "summary": "Text creation", "parameters": [ { - "description": "List Spaces", + "description": "text creation request", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.FeishuSpaceListReq" + "$ref": "#/definitions/domain.TextReq" } } ], "responses": { "200": { - "description": "OK", + "description": "success", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.FeishuSpaceListResp" - } - } - } - } - ] + "type": "string" } } } } }, - "/api/v1/crawler/feishu/search_wiki": { + "/api/v1/file/upload": { "post": { - "description": "Search Wiki in Feishu Spaces", + "description": "Upload File", "consumes": [ - "application/json" - ], - "produces": [ - "application/json" + "multipart/form-data" ], "tags": [ - "crawler" + "file" ], - "summary": "FeishuWikiSearch", + "summary": "Upload File", "parameters": [ { - "description": "Search Wiki", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.FeishuSearchWikiReq" - } + "type": "file", + "description": "File", + "name": "file", + "in": "formData", + "required": true + }, + { + "type": "string", + "description": "Knowledge Base ID", + "name": "kb_id", + "in": "formData" } ], "responses": { "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.FeishuSearchWikiResp" - } - } - } - } - ] + "$ref": "#/definitions/domain.ObjectUploadResp" } } } } }, - "/api/v1/crawler/mindoc/parse": { + "/api/v1/file/upload/anydoc": { "post": { - "description": "Parse Mindoc Export File and return document list", + "description": "Upload Anydoc File", "consumes": [ "multipart/form-data" ], - "produces": [ - "application/json" - ], "tags": [ - "crawler" + "file" ], - "summary": "MindocParse", + "summary": "Upload Anydoc File", "parameters": [ { "type": "file", - "description": "file", + "description": "File", "name": "file", "in": "formData", "required": true }, { "type": "string", - "description": "kb_id", - "name": "kb_id", + "description": "File Path", + "name": "path", "in": "formData", "required": true } @@ -1025,27 +973,15 @@ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.MindocParseResp" - } - } - } - ] + "$ref": "#/definitions/domain.AnydocUploadResp" } } } } }, - "/api/v1/crawler/mindoc/scrape": { + "/api/v1/knowledge_base": { "post": { - "description": "Scrape specific Mindoc documents by ID", + "description": "CreateKnowledgeBase", "consumes": [ "application/json" ], @@ -1053,17 +989,17 @@ "application/json" ], "tags": [ - "crawler" + "knowledge_base" ], - "summary": "MindocScrape", + "summary": "CreateKnowledgeBase", "parameters": [ { - "description": "Scrape Request", + "description": "CreateKnowledgeBase Request", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.MindocScrapeReq" + "$ref": "#/definitions/domain.CreateKnowledgeBaseReq" } } ], @@ -1071,27 +1007,20 @@ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.MindocScrapeResp" - } - } - } - ] + "$ref": "#/definitions/domain.Response" } } } } }, - "/api/v1/crawler/notion/parse": { - "post": { - "description": "NotionParse", + "/api/v1/knowledge_base/detail": { + "get": { + "security": [ + { + "bearerAuth": [] + } + ], + "description": "GetKnowledgeBaseDetail", "consumes": [ "application/json" ], @@ -1099,18 +1028,16 @@ "application/json" ], "tags": [ - "crawler" + "knowledge_base" ], - "summary": "NotionParse", + "summary": "GetKnowledgeBaseDetail", "parameters": [ { - "description": "Scrape", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.NotionParseReq" - } + "type": "string", + "description": "Knowledge Base ID", + "name": "id", + "in": "query", + "required": true } ], "responses": { @@ -1125,7 +1052,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.NotionParseResp" + "$ref": "#/definitions/domain.KnowledgeBaseDetail" } } } @@ -1133,11 +1060,9 @@ } } } - } - }, - "/api/v1/crawler/notion/scrape": { - "post": { - "description": "NotionScrape", + }, + "put": { + "description": "UpdateKnowledgeBase", "consumes": [ "application/json" ], @@ -1145,17 +1070,17 @@ "application/json" ], "tags": [ - "crawler" + "knowledge_base" ], - "summary": "NotionScrape", + "summary": "UpdateKnowledgeBase", "parameters": [ { - "description": "Get Docs", + "description": "UpdateKnowledgeBase Request", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.NotionScrapeReq" + "$ref": "#/definitions/domain.UpdateKnowledgeBaseReq" } } ], @@ -1163,27 +1088,13 @@ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.NotionScrapeResp" - } - } - } - ] + "$ref": "#/definitions/domain.Response" } } } - } - }, - "/api/v1/crawler/result": { - "get": { - "description": "Retrieve the result of a previously started scraping task", + }, + "delete": { + "description": "DeleteKnowledgeBase", "consumes": [ "application/json" ], @@ -1191,13 +1102,14 @@ "application/json" ], "tags": [ - "crawler" + "knowledge_base" ], - "summary": "Get Crawler Result", + "summary": "DeleteKnowledgeBase", "parameters": [ { "type": "string", - "name": "task_id", + "description": "Knowledge Base ID", + "name": "id", "in": "query", "required": true } @@ -1206,27 +1118,15 @@ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.CrawlerResultResp" - } - } - } - ] + "$ref": "#/definitions/domain.Response" } } } } }, - "/api/v1/crawler/results": { - "post": { - "description": "Retrieve the results of a previously started scraping task", + "/api/v1/knowledge_base/list": { + "get": { + "description": "GetKnowledgeBaseList", "consumes": [ "application/json" ], @@ -1234,20 +1134,9 @@ "application/json" ], "tags": [ - "crawler" - ], - "summary": "Get Crawler Results", - "parameters": [ - { - "description": "Crawler Results Request", - "name": "param", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.CrawlerResultsReq" - } - } + "knowledge_base" ], + "summary": "GetKnowledgeBaseList", "responses": { "200": { "description": "OK", @@ -1260,7 +1149,10 @@ "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.CrawlerResultsResp" + "type": "array", + "items": { + "$ref": "#/definitions/domain.KnowledgeBaseListItem" + } } } } @@ -1270,9 +1162,9 @@ } } }, - "/api/v1/crawler/rss/parse": { + "/api/v1/knowledge_base/release": { "post": { - "description": "Parse RSS", + "description": "CreateKBRelease", "consumes": [ "application/json" ], @@ -1280,17 +1172,17 @@ "application/json" ], "tags": [ - "crawler" + "knowledge_base" ], - "summary": "Parse RSS", + "summary": "CreateKBRelease", "parameters": [ { - "description": "Parse URL", + "description": "CreateKBRelease Request", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.RssParseReq" + "$ref": "#/definitions/domain.CreateKBReleaseReq" } } ], @@ -1298,27 +1190,15 @@ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.RssParseResp" - } - } - } - ] + "$ref": "#/definitions/domain.Response" } } } } }, - "/api/v1/crawler/rss/scrape": { - "post": { - "description": "RSSScrape", + "/api/v1/knowledge_base/release/list": { + "get": { + "description": "GetKBReleaseList", "consumes": [ "application/json" ], @@ -1326,18 +1206,16 @@ "application/json" ], "tags": [ - "crawler" + "knowledge_base" ], - "summary": "RSSScrape", + "summary": "GetKBReleaseList", "parameters": [ { - "description": "Parse URL", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.RssScrapeReq" - } + "type": "string", + "description": "Knowledge Base ID", + "name": "kb_id", + "in": "query", + "required": true } ], "responses": { @@ -1352,7 +1230,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.RssScrapeResp" + "$ref": "#/definitions/domain.GetKBReleaseListResp" } } } @@ -1362,9 +1240,14 @@ } } }, - "/api/v1/crawler/scrape": { - "post": { - "description": "Scrape", + "/api/v1/knowledge_base/user/delete": { + "delete": { + "security": [ + { + "bearerAuth": [] + } + ], + "description": "Remove user from knowledge base", "consumes": [ "application/json" ], @@ -1372,45 +1255,41 @@ "application/json" ], "tags": [ - "crawler" + "knowledge_base" ], - "summary": "Scrape", + "summary": "KBUserDelete", "parameters": [ { - "description": "Scrape", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.ScrapeReq" - } + "type": "string", + "name": "kb_id", + "in": "query", + "required": true + }, + { + "type": "string", + "name": "user_id", + "in": "query", + "required": true } ], "responses": { "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.ScrapeResp" - } - } - } - ] + "$ref": "#/definitions/domain.Response" } } } } }, - "/api/v1/crawler/sitemap/parse": { + "/api/v1/knowledge_base/user/invite": { "post": { - "description": "Parse Sitemap", + "security": [ + { + "bearerAuth": [] + } + ], + "description": "Invite user to knowledge base", "consumes": [ "application/json" ], @@ -1418,17 +1297,17 @@ "application/json" ], "tags": [ - "crawler" + "knowledge_base" ], - "summary": "Parse Sitemap", + "summary": "KBUserInvite", "parameters": [ { - "description": "Parse URL", - "name": "body", + "description": "Invite User Request", + "name": "param", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.SitemapParseReq" + "$ref": "#/definitions/v1.KBUserInviteReq" } } ], @@ -1436,27 +1315,20 @@ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.SitemapParseResp" - } - } - } - ] + "$ref": "#/definitions/domain.Response" } } } } }, - "/api/v1/crawler/sitemap/scrape": { - "post": { - "description": "SitemapScrape", + "/api/v1/knowledge_base/user/list": { + "get": { + "security": [ + { + "bearerAuth": [] + } + ], + "description": "KBUserList", "consumes": [ "application/json" ], @@ -1464,18 +1336,16 @@ "application/json" ], "tags": [ - "crawler" + "knowledge_base" ], - "summary": "SitemapScrape", + "summary": "KBUserList", "parameters": [ { - "description": "Parse URL", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.SitemapScrapeReq" - } + "type": "string", + "description": "Knowledge Base ID", + "name": "kb_id", + "in": "query", + "required": true } ], "responses": { @@ -1490,7 +1360,10 @@ "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.SitemapScrapeResp" + "type": "array", + "items": { + "$ref": "#/definitions/v1.KBUserListItemResp" + } } } } @@ -1500,60 +1373,48 @@ } } }, - "/api/v1/crawler/siyuan/parse": { - "post": { - "description": "Parse Siyuan Export File and return document list", + "/api/v1/knowledge_base/user/update": { + "patch": { + "security": [ + { + "bearerAuth": [] + } + ], + "description": "Update user permission in knowledge base", "consumes": [ - "multipart/form-data" + "application/json" ], "produces": [ "application/json" ], "tags": [ - "crawler" + "knowledge_base" ], - "summary": "SiyuanParse", + "summary": "KBUserUpdate", "parameters": [ { - "type": "file", - "description": "file", - "name": "file", - "in": "formData", - "required": true - }, - { - "type": "string", - "description": "kb_id", - "name": "kb_id", - "in": "formData", - "required": true + "description": "Update User Permission Request", + "name": "param", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.KBUserUpdateReq" + } } ], "responses": { "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.SiyuanParseResp" - } - } - } - ] + "$ref": "#/definitions/domain.Response" } } } } }, - "/api/v1/crawler/siyuan/scrape": { - "post": { - "description": "Scrape specific Siyuan documents by ID", + "/api/v1/model": { + "put": { + "description": "update model", "consumes": [ "application/json" ], @@ -1561,17 +1422,16 @@ "application/json" ], "tags": [ - "crawler" + "model" ], - "summary": "SiyuanScrape", "parameters": [ { - "description": "Scrape Request", - "name": "body", + "description": "update model request", + "name": "model", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.SiyuanScrapeReq" + "$ref": "#/definitions/domain.UpdateModelReq" } } ], @@ -1579,78 +1439,47 @@ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.SiyuanScrapeResp" - } - } - } - ] + "$ref": "#/definitions/domain.Response" } } } - } - }, - "/api/v1/crawler/wikijs/parse": { + }, "post": { - "description": "Parse Wikijs Export File and return document list", + "description": "create model", "consumes": [ - "multipart/form-data" + "application/json" ], "produces": [ "application/json" ], "tags": [ - "crawler" + "model" ], - "summary": "WikijsParse", + "summary": "create model", "parameters": [ { - "type": "file", - "description": "file", - "name": "file", - "in": "formData", - "required": true - }, - { - "type": "string", - "description": "kb_id", - "name": "kb_id", - "in": "formData", - "required": true + "description": "create model request", + "name": "model", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.CreateModelReq" + } } ], "responses": { "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.WikijsParseResp" - } - } - } - ] + "$ref": "#/definitions/domain.Response" } } } } }, - "/api/v1/crawler/wikijs/scrape": { + "/api/v1/model/check": { "post": { - "description": "Scrape specific Wikijs documents by ID", + "description": "check model", "consumes": [ "application/json" ], @@ -1658,17 +1487,17 @@ "application/json" ], "tags": [ - "crawler" + "model" ], - "summary": "WikijsScrape", + "summary": "check model", "parameters": [ { - "description": "Scrape Request", - "name": "body", + "description": "check model request", + "name": "model", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.WikijsScrapeReq" + "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.CheckModelReq" } } ], @@ -1678,13 +1507,13 @@ "schema": { "allOf": [ { - "$ref": "#/definitions/domain.PWResponse" + "$ref": "#/definitions/domain.Response" }, { "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.WikijsScrapeResp" + "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.CheckModelResp" } } } @@ -1694,9 +1523,9 @@ } } }, - "/api/v1/crawler/yuque/parse": { - "post": { - "description": "YuqueParse", + "/api/v1/model/list": { + "get": { + "description": "get model list", "consumes": [ "application/json" ], @@ -1704,20 +1533,9 @@ "application/json" ], "tags": [ - "crawler" - ], - "summary": "YuqueParse", - "parameters": [ - { - "description": "Parse URL", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.YuqueParseReq" - } - } + "model" ], + "summary": "get model list", "responses": { "200": { "description": "OK", @@ -1730,7 +1548,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.YuqueParseResp" + "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelListItem" } } } @@ -1740,9 +1558,9 @@ } } }, - "/api/v1/creation/tab-complete": { + "/api/v1/model/provider/supported": { "post": { - "description": "Tab-based document completion similar to AI coding's FIM (Fill in Middle)", + "description": "get provider supported model list", "consumes": [ "application/json" ], @@ -1750,33 +1568,50 @@ "application/json" ], "tags": [ - "creation" + "model" ], - "summary": "Tab-based document completion", + "summary": "get provider supported model list", "parameters": [ { - "description": "tab completion request", - "name": "body", + "description": "get supported model list request", + "name": "params", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/domain.CompleteReq" + "$ref": "#/definitions/domain.GetProviderModelListReq" } } ], "responses": { "200": { - "description": "success", + "description": "OK", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/domain.PWResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/domain.GetProviderModelListResp" + } + } + } + ] } } } } }, - "/api/v1/creation/text": { + "/api/v1/node": { "post": { - "description": "Text creation", + "security": [ + { + "bearerAuth": [] + } + ], + "description": "Create Node", "consumes": [ "application/json" ], @@ -1784,104 +1619,107 @@ "application/json" ], "tags": [ - "creation" + "node" ], - "summary": "Text creation", + "summary": "Create Node", "parameters": [ { - "description": "text creation request", + "description": "Node", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/domain.TextReq" + "$ref": "#/definitions/domain.CreateNodeReq" } } ], "responses": { "200": { - "description": "success", + "description": "OK", "schema": { - "type": "string" + "allOf": [ + { + "$ref": "#/definitions/domain.PWResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + ] } } } } }, - "/api/v1/file/upload": { + "/api/v1/node/action": { "post": { - "description": "Upload File", - "consumes": [ - "multipart/form-data" - ], - "tags": [ - "file" - ], - "summary": "Upload File", - "parameters": [ - { - "type": "file", - "description": "File", - "name": "file", - "in": "formData", - "required": true - }, + "security": [ { - "type": "string", - "description": "Knowledge Base ID", - "name": "kb_id", - "in": "formData" + "bearerAuth": [] } ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.ObjectUploadResp" - } - } - } - } - }, - "/api/v1/file/upload/anydoc": { - "post": { - "description": "Upload Anydoc File", + "description": "Node Action", "consumes": [ - "multipart/form-data" + "application/json" + ], + "produces": [ + "application/json" ], "tags": [ - "file" + "node" ], - "summary": "Upload Anydoc File", + "summary": "Node Action", "parameters": [ { - "type": "file", - "description": "File", - "name": "file", - "in": "formData", - "required": true - }, - { - "type": "string", - "description": "File Path", - "name": "path", - "in": "formData", - "required": true + "description": "Action", + "name": "action", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.NodeActionReq" + } } ], "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/domain.AnydocUploadResp" + "allOf": [ + { + "$ref": "#/definitions/domain.PWResponse" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + ] } } } } }, - "/api/v1/knowledge_base": { + "/api/v1/node/batch_move": { "post": { - "description": "CreateKnowledgeBase", + "security": [ + { + "bearerAuth": [] + } + ], + "description": "Batch Move Node", "consumes": [ "application/json" ], @@ -1889,17 +1727,17 @@ "application/json" ], "tags": [ - "knowledge_base" + "node" ], - "summary": "CreateKnowledgeBase", + "summary": "Batch Move Node", "parameters": [ { - "description": "CreateKnowledgeBase Request", + "description": "Batch Move Node", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/domain.CreateKnowledgeBaseReq" + "$ref": "#/definitions/domain.BatchMoveReq" } } ], @@ -1913,14 +1751,14 @@ } } }, - "/api/v1/knowledge_base/detail": { + "/api/v1/node/detail": { "get": { "security": [ { "bearerAuth": [] } ], - "description": "GetKnowledgeBaseDetail", + "description": "Get Node Detail", "consumes": [ "application/json" ], @@ -1928,16 +1766,26 @@ "application/json" ], "tags": [ - "knowledge_base" + "node" ], - "summary": "GetKnowledgeBaseDetail", + "summary": "Get Node Detail", "parameters": [ { "type": "string", - "description": "Knowledge Base ID", + "name": "format", + "in": "query" + }, + { + "type": "string", "name": "id", "in": "query", "required": true + }, + { + "type": "string", + "name": "kb_id", + "in": "query", + "required": true } ], "responses": { @@ -1952,7 +1800,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/definitions/domain.KnowledgeBaseDetail" + "$ref": "#/definitions/v1.NodeDetailResp" } } } @@ -1962,7 +1810,12 @@ } }, "put": { - "description": "UpdateKnowledgeBase", + "security": [ + { + "bearerAuth": [] + } + ], + "description": "Update Node Detail", "consumes": [ "application/json" ], @@ -1970,17 +1823,17 @@ "application/json" ], "tags": [ - "knowledge_base" + "node" ], - "summary": "UpdateKnowledgeBase", + "summary": "Update Node Detail", "parameters": [ { - "description": "UpdateKnowledgeBase Request", + "description": "Node", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/domain.UpdateKnowledgeBaseReq" + "$ref": "#/definitions/domain.UpdateNodeReq" } } ], @@ -1992,9 +1845,16 @@ } } } - }, - "delete": { - "description": "DeleteKnowledgeBase", + } + }, + "/api/v1/node/list": { + "get": { + "security": [ + { + "bearerAuth": [] + } + ], + "description": "Get Node List", "consumes": [ "application/json" ], @@ -2002,41 +1862,22 @@ "application/json" ], "tags": [ - "knowledge_base" + "node" ], - "summary": "DeleteKnowledgeBase", + "summary": "Get Node List", "parameters": [ { "type": "string", - "description": "Knowledge Base ID", - "name": "id", + "name": "kb_id", "in": "query", "required": true + }, + { + "type": "string", + "name": "search", + "in": "query" } ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.Response" - } - } - } - } - }, - "/api/v1/knowledge_base/list": { - "get": { - "description": "GetKnowledgeBaseList", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "knowledge_base" - ], - "summary": "GetKnowledgeBaseList", "responses": { "200": { "description": "OK", @@ -2051,7 +1892,7 @@ "data": { "type": "array", "items": { - "$ref": "#/definitions/domain.KnowledgeBaseListItem" + "$ref": "#/definitions/domain.NodeListItemResp" } } } @@ -2062,9 +1903,14 @@ } } }, - "/api/v1/knowledge_base/release": { + "/api/v1/node/move": { "post": { - "description": "CreateKBRelease", + "security": [ + { + "bearerAuth": [] + } + ], + "description": "Move Node", "consumes": [ "application/json" ], @@ -2072,17 +1918,17 @@ "application/json" ], "tags": [ - "knowledge_base" + "node" ], - "summary": "CreateKBRelease", + "summary": "Move Node", "parameters": [ { - "description": "CreateKBRelease Request", + "description": "Move Node", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/domain.CreateKBReleaseReq" + "$ref": "#/definitions/domain.MoveNodeReq" } } ], @@ -2096,9 +1942,14 @@ } } }, - "/api/v1/knowledge_base/release/list": { + "/api/v1/node/permission": { "get": { - "description": "GetKBReleaseList", + "security": [ + { + "bearerAuth": [] + } + ], + "description": "文档授权信息获取", "consumes": [ "application/json" ], @@ -2106,13 +1957,19 @@ "application/json" ], "tags": [ - "knowledge_base" + "NodePermission" ], - "summary": "GetKBReleaseList", + "summary": "文档授权信息获取", + "operationId": "v1-NodePermission", "parameters": [ { "type": "string", - "description": "Knowledge Base ID", + "name": "id", + "in": "query", + "required": true + }, + { + "type": "string", "name": "kb_id", "in": "query", "required": true @@ -2124,13 +1981,13 @@ "schema": { "allOf": [ { - "$ref": "#/definitions/domain.PWResponse" + "$ref": "#/definitions/domain.Response" }, { "type": "object", "properties": { "data": { - "$ref": "#/definitions/domain.GetKBReleaseListResp" + "$ref": "#/definitions/v1.NodePermissionResp" } } } @@ -2140,56 +1997,14 @@ } } }, - "/api/v1/knowledge_base/user/delete": { - "delete": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "Remove user from knowledge base", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "knowledge_base" - ], - "summary": "KBUserDelete", - "parameters": [ - { - "type": "string", - "name": "kb_id", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "user_id", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.Response" - } - } - } - } - }, - "/api/v1/knowledge_base/user/invite": { - "post": { + "/api/v1/node/permission/edit": { + "patch": { "security": [ { "bearerAuth": [] } ], - "description": "Invite user to knowledge base", + "description": "文档授权信息更新", "consumes": [ "application/json" ], @@ -2197,17 +2012,18 @@ "application/json" ], "tags": [ - "knowledge_base" + "NodePermission" ], - "summary": "KBUserInvite", + "summary": "文档授权信息更新", + "operationId": "v1-NodePermissionEdit", "parameters": [ { - "description": "Invite User Request", + "description": "para", "name": "param", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.KBUserInviteReq" + "$ref": "#/definitions/v1.NodePermissionEditReq" } } ], @@ -2215,20 +2031,32 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/domain.Response" + "allOf": [ + { + "$ref": "#/definitions/domain.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/v1.NodePermissionEditResp" + } + } + } + ] } } } } }, - "/api/v1/knowledge_base/user/list": { + "/api/v1/node/recommend_nodes": { "get": { "security": [ { "bearerAuth": [] } ], - "description": "KBUserList", + "description": "Recommend Nodes", "consumes": [ "application/json" ], @@ -2236,16 +2064,25 @@ "application/json" ], "tags": [ - "knowledge_base" + "node" ], - "summary": "KBUserList", + "summary": "Recommend Nodes", "parameters": [ { "type": "string", - "description": "Knowledge Base ID", "name": "kb_id", "in": "query", "required": true + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "csv", + "name": "node_ids", + "in": "query", + "required": true } ], "responses": { @@ -2262,7 +2099,7 @@ "data": { "type": "array", "items": { - "$ref": "#/definitions/v1.KBUserListItemResp" + "$ref": "#/definitions/domain.RecommendNodeListResp" } } } @@ -2273,14 +2110,14 @@ } } }, - "/api/v1/knowledge_base/user/update": { - "patch": { + "/api/v1/node/summary": { + "post": { "security": [ { "bearerAuth": [] } ], - "description": "Update user permission in knowledge base", + "description": "Summary Node", "consumes": [ "application/json" ], @@ -2288,17 +2125,17 @@ "application/json" ], "tags": [ - "knowledge_base" + "node" ], - "summary": "KBUserUpdate", + "summary": "Summary Node", "parameters": [ { - "description": "Update User Permission Request", - "name": "param", + "description": "Summary Node", + "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v1.KBUserUpdateReq" + "$ref": "#/definitions/domain.NodeSummaryReq" } } ], @@ -2312,9 +2149,14 @@ } } }, - "/api/v1/model": { - "put": { - "description": "update model", + "/api/v1/stat/browsers": { + "get": { + "security": [ + { + "bearerAuth": [] + } + ], + "description": "客户端统计", "consumes": [ "application/json" ], @@ -2322,30 +2164,64 @@ "application/json" ], "tags": [ - "model" + "stat" ], + "summary": "客户端统计", "parameters": [ { - "description": "update model request", - "name": "model", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.UpdateModelReq" - } + "enum": [ + 1, + 7, + 30, + 90 + ], + "type": "integer", + "x-enum-varnames": [ + "StatDay1", + "StatDay7", + "StatDay30", + "StatDay90" + ], + "name": "day", + "in": "query" + }, + { + "type": "string", + "name": "kb_id", + "in": "query", + "required": true } ], "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/domain.Response" + "allOf": [ + { + "$ref": "#/definitions/domain.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/domain.HotBrowser" + } + } + } + ] } } } - }, - "post": { - "description": "create model", + } + }, + "/api/v1/stat/conversation_distribution": { + "get": { + "security": [ + { + "bearerAuth": [] + } + ], + "description": "问答来源", "consumes": [ "application/json" ], @@ -2353,33 +2229,67 @@ "application/json" ], "tags": [ - "model" + "stat" ], - "summary": "create model", + "summary": "问答来源", "parameters": [ { - "description": "create model request", - "name": "model", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.CreateModelReq" - } + "enum": [ + 1, + 7, + 30, + 90 + ], + "type": "integer", + "x-enum-varnames": [ + "StatDay1", + "StatDay7", + "StatDay30", + "StatDay90" + ], + "name": "day", + "in": "query" + }, + { + "type": "string", + "name": "kb_id", + "in": "query", + "required": true } ], "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/domain.Response" + "allOf": [ + { + "$ref": "#/definitions/domain.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.ConversationDistribution" + } + } + } + } + ] } } } } }, - "/api/v1/model/check": { - "post": { - "description": "check model", + "/api/v1/stat/count": { + "get": { + "security": [ + { + "bearerAuth": [] + } + ], + "description": "全局统计", "consumes": [ "application/json" ], @@ -2387,18 +2297,32 @@ "application/json" ], "tags": [ - "model" + "stat" ], - "summary": "check model", + "summary": "全局统计", "parameters": [ { - "description": "check model request", - "name": "model", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.CheckModelReq" - } + "enum": [ + 1, + 7, + 30, + 90 + ], + "type": "integer", + "x-enum-varnames": [ + "StatDay1", + "StatDay7", + "StatDay30", + "StatDay90" + ], + "name": "day", + "in": "query" + }, + { + "type": "string", + "name": "kb_id", + "in": "query", + "required": true } ], "responses": { @@ -2407,13 +2331,13 @@ "schema": { "allOf": [ { - "$ref": "#/definitions/domain.Response" + "$ref": "#/definitions/domain.PWResponse" }, { "type": "object", "properties": { "data": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.CheckModelResp" + "$ref": "#/definitions/v1.StatCountResp" } } } @@ -2423,9 +2347,14 @@ } } }, - "/api/v1/model/list": { + "/api/v1/stat/geo_count": { "get": { - "description": "get model list", + "security": [ + { + "bearerAuth": [] + } + ], + "description": "用户地理分布", "consumes": [ "application/json" ], @@ -2433,34 +2362,52 @@ "application/json" ], "tags": [ - "model" + "stat" + ], + "summary": "用户地理分布", + "parameters": [ + { + "enum": [ + 1, + 7, + 30, + 90 + ], + "type": "integer", + "x-enum-varnames": [ + "StatDay1", + "StatDay7", + "StatDay30", + "StatDay90" + ], + "name": "day", + "in": "query" + }, + { + "type": "string", + "name": "kb_id", + "in": "query", + "required": true + } ], - "summary": "get model list", "responses": { "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelListItem" - } - } - } - ] + "$ref": "#/definitions/domain.Response" } } } } }, - "/api/v1/model/provider/supported": { - "post": { - "description": "get provider supported model list", + "/api/v1/stat/hot_pages": { + "get": { + "security": [ + { + "bearerAuth": [] + } + ], + "description": "热门文档", "consumes": [ "application/json" ], @@ -2468,18 +2415,32 @@ "application/json" ], "tags": [ - "model" + "stat" ], - "summary": "get provider supported model list", + "summary": "热门文档", "parameters": [ { - "description": "get supported model list request", - "name": "params", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.GetProviderModelListReq" - } + "enum": [ + 1, + 7, + 30, + 90 + ], + "type": "integer", + "x-enum-varnames": [ + "StatDay1", + "StatDay7", + "StatDay30", + "StatDay90" + ], + "name": "day", + "in": "query" + }, + { + "type": "string", + "name": "kb_id", + "in": "query", + "required": true } ], "responses": { @@ -2488,13 +2449,16 @@ "schema": { "allOf": [ { - "$ref": "#/definitions/domain.PWResponse" + "$ref": "#/definitions/domain.Response" }, { "type": "object", "properties": { "data": { - "$ref": "#/definitions/domain.GetProviderModelListResp" + "type": "array", + "items": { + "$ref": "#/definitions/domain.HotPage" + } } } } @@ -2504,14 +2468,14 @@ } } }, - "/api/v1/node": { - "post": { + "/api/v1/stat/instant_count": { + "get": { "security": [ { "bearerAuth": [] } ], - "description": "Create Node", + "description": "GetInstantCount", "consumes": [ "application/json" ], @@ -2519,18 +2483,15 @@ "application/json" ], "tags": [ - "node" + "stat" ], - "summary": "Create Node", + "summary": "GetInstantCount", "parameters": [ { - "description": "Node", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.CreateNodeReq" - } + "type": "string", + "name": "kb_id", + "in": "query", + "required": true } ], "responses": { @@ -2539,15 +2500,15 @@ "schema": { "allOf": [ { - "$ref": "#/definitions/domain.PWResponse" + "$ref": "#/definitions/domain.Response" }, { "type": "object", "properties": { "data": { - "type": "object", - "additionalProperties": { - "type": "string" + "type": "array", + "items": { + "$ref": "#/definitions/domain.InstantCountResp" } } } @@ -2558,14 +2519,14 @@ } } }, - "/api/v1/node/action": { - "post": { + "/api/v1/stat/instant_pages": { + "get": { "security": [ { "bearerAuth": [] } ], - "description": "Node Action", + "description": "GetInstantPages", "consumes": [ "application/json" ], @@ -2573,18 +2534,15 @@ "application/json" ], "tags": [ - "node" + "stat" ], - "summary": "Node Action", + "summary": "GetInstantPages", "parameters": [ { - "description": "Action", - "name": "action", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.NodeActionReq" - } + "type": "string", + "name": "kb_id", + "in": "query", + "required": true } ], "responses": { @@ -2593,15 +2551,15 @@ "schema": { "allOf": [ { - "$ref": "#/definitions/domain.PWResponse" + "$ref": "#/definitions/domain.Response" }, { "type": "object", "properties": { "data": { - "type": "object", - "additionalProperties": { - "type": "string" + "type": "array", + "items": { + "$ref": "#/definitions/domain.InstantPageResp" } } } @@ -2612,14 +2570,14 @@ } } }, - "/api/v1/node/batch_move": { - "post": { + "/api/v1/stat/referer_hosts": { + "get": { "security": [ { "bearerAuth": [] } ], - "description": "Batch Move Node", + "description": "来源域名", "consumes": [ "application/json" ], @@ -2627,38 +2585,82 @@ "application/json" ], "tags": [ - "node" + "stat" ], - "summary": "Batch Move Node", + "summary": "来源域名", "parameters": [ { - "description": "Batch Move Node", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.BatchMoveReq" - } + "enum": [ + 1, + 7, + 30, + 90 + ], + "type": "integer", + "x-enum-varnames": [ + "StatDay1", + "StatDay7", + "StatDay30", + "StatDay90" + ], + "name": "day", + "in": "query" + }, + { + "type": "string", + "name": "kb_id", + "in": "query", + "required": true } ], "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/domain.Response" + "allOf": [ + { + "$ref": "#/definitions/domain.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.HotRefererHost" + } + } + } + } + ] } } } } }, - "/api/v1/node/detail": { + "/api/v1/user": { "get": { - "security": [ - { - "bearerAuth": [] - } + "description": "GetUser", + "consumes": [ + "application/json" ], - "description": "Get Node Detail", + "tags": [ + "user" + ], + "summary": "GetUser", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1.UserInfoResp" + } + } + } + } + }, + "/api/v1/user/create": { + "post": { + "description": "CreateUser", "consumes": [ "application/json" ], @@ -2666,26 +2668,18 @@ "application/json" ], "tags": [ - "node" + "user" ], - "summary": "Get Node Detail", + "summary": "CreateUser", "parameters": [ { - "type": "string", - "name": "format", - "in": "query" - }, - { - "type": "string", - "name": "id", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "kb_id", - "in": "query", - "required": true + "description": "CreateUser Request", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.CreateUserReq" + } } ], "responses": { @@ -2694,13 +2688,13 @@ "schema": { "allOf": [ { - "$ref": "#/definitions/domain.PWResponse" + "$ref": "#/definitions/domain.Response" }, { "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.NodeDetailResp" + "$ref": "#/definitions/v1.CreateUserResp" } } } @@ -2708,14 +2702,11 @@ } } } - }, - "put": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "Update Node Detail", + } + }, + "/api/v1/user/delete": { + "delete": { + "description": "DeleteUser", "consumes": [ "application/json" ], @@ -2723,18 +2714,15 @@ "application/json" ], "tags": [ - "node" + "user" ], - "summary": "Update Node Detail", + "summary": "DeleteUser", "parameters": [ { - "description": "Node", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.UpdateNodeReq" - } + "type": "string", + "name": "user_id", + "in": "query", + "required": true } ], "responses": { @@ -2747,14 +2735,9 @@ } } }, - "/api/v1/node/list": { + "/api/v1/user/list": { "get": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "Get Node List", + "description": "ListUsers", "consumes": [ "application/json" ], @@ -2762,22 +2745,9 @@ "application/json" ], "tags": [ - "node" - ], - "summary": "Get Node List", - "parameters": [ - { - "type": "string", - "name": "kb_id", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "search", - "in": "query" - } + "user" ], + "summary": "ListUsers", "responses": { "200": { "description": "OK", @@ -2790,10 +2760,7 @@ "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.NodeListItemResp" - } + "$ref": "#/definitions/v1.UserListResp" } } } @@ -2803,14 +2770,43 @@ } } }, - "/api/v1/node/move": { + "/api/v1/user/login": { "post": { - "security": [ + "description": "Login", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "user" + ], + "summary": "Login", + "parameters": [ { - "bearerAuth": [] + "description": "Login Request", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.LoginReq" + } } ], - "description": "Move Node", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1.LoginResp" + } + } + } + } + }, + "/api/v1/user/reset_password": { + "put": { + "description": "ResetPassword", "consumes": [ "application/json" ], @@ -2818,17 +2814,17 @@ "application/json" ], "tags": [ - "node" + "user" ], - "summary": "Move Node", + "summary": "ResetPassword", "parameters": [ { - "description": "Move Node", + "description": "ResetPassword Request", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/domain.MoveNodeReq" + "$ref": "#/definitions/v1.ResetPasswordReq" } } ], @@ -2842,14 +2838,9 @@ } } }, - "/api/v1/node/permission": { + "/share/v1/app/web/info": { "get": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "文档授权信息获取", + "description": "GetAppInfo", "consumes": [ "application/json" ], @@ -2857,21 +2848,15 @@ "application/json" ], "tags": [ - "NodePermission" + "share_app" ], - "summary": "文档授权信息获取", - "operationId": "v1-NodePermission", + "summary": "GetAppInfo", "parameters": [ { "type": "string", - "name": "id", - "in": "query", - "required": true - }, - { - "type": "string", - "name": "kb_id", - "in": "query", + "description": "kb id", + "name": "X-KB-ID", + "in": "header", "required": true } ], @@ -2887,7 +2872,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.NodePermissionResp" + "$ref": "#/definitions/domain.AppInfoResp" } } } @@ -2897,14 +2882,9 @@ } } }, - "/api/v1/node/permission/edit": { - "patch": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "文档授权信息更新", + "/share/v1/app/wechat/service/answer": { + "get": { + "description": "GetWechatAnswer", "consumes": [ "application/json" ], @@ -2912,20 +2892,82 @@ "application/json" ], "tags": [ - "NodePermission" + "Wechat" ], - "summary": "文档授权信息更新", - "operationId": "v1-NodePermissionEdit", + "summary": "GetWechatAnswer", "parameters": [ { - "description": "para", - "name": "param", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.NodePermissionEditReq" + "type": "string", + "description": "conversation id", + "name": "id", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.Response" + } + } + } + } + }, + "/share/v1/app/widget/info": { + "get": { + "description": "GetWidgetAppInfo", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "share_app" + ], + "summary": "GetWidgetAppInfo", + "parameters": [ + { + "type": "string", + "description": "kb id", + "name": "X-KB-ID", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/domain.Response" } } + } + } + }, + "/share/v1/auth/get": { + "get": { + "description": "AuthGet", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "share_auth" + ], + "summary": "AuthGet", + "operationId": "v1-AuthGet", + "parameters": [ + { + "type": "string", + "description": "kb_id", + "name": "X-KB-ID", + "in": "header", + "required": true + } ], "responses": { "200": { @@ -2933,13 +2975,13 @@ "schema": { "allOf": [ { - "$ref": "#/definitions/domain.Response" + "$ref": "#/definitions/domain.PWResponse" }, { "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.NodePermissionEditResp" + "$ref": "#/definitions/github_com_chaitin_panda-wiki_api_share_v1.AuthGetResp" } } } @@ -2949,14 +2991,9 @@ } } }, - "/api/v1/node/recommend_nodes": { - "get": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "Recommend Nodes", + "/share/v1/auth/github": { + "post": { + "description": "GitHub登录", "consumes": [ "application/json" ], @@ -2964,25 +3001,26 @@ "application/json" ], "tags": [ - "node" + "ShareAuth" ], - "summary": "Recommend Nodes", + "summary": "GitHub登录", + "operationId": "v1-AuthGitHub", "parameters": [ { "type": "string", - "name": "kb_id", - "in": "query", + "description": "kb id", + "name": "X-KB-ID", + "in": "header", "required": true }, { - "type": "array", - "items": { - "type": "string" - }, - "collectionFormat": "csv", - "name": "node_ids", - "in": "query", - "required": true + "description": "para", + "name": "param", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1.AuthGitHubReq" + } } ], "responses": { @@ -2997,10 +3035,7 @@ "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.RecommendNodeListResp" - } + "$ref": "#/definitions/v1.AuthGitHubResp" } } } @@ -3010,14 +3045,9 @@ } } }, - "/api/v1/node/summary": { + "/share/v1/auth/login/simple": { "post": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "Summary Node", + "description": "AuthLoginSimple", "consumes": [ "application/json" ], @@ -3025,17 +3055,25 @@ "application/json" ], "tags": [ - "node" + "share_auth" ], - "summary": "Summary Node", + "summary": "AuthLoginSimple", + "operationId": "v1-AuthLoginSimple", "parameters": [ { - "description": "Summary Node", - "name": "body", + "type": "string", + "description": "kb_id", + "name": "X-KB-ID", + "in": "header", + "required": true + }, + { + "description": "para", + "name": "param", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/domain.NodeSummaryReq" + "$ref": "#/definitions/v1.AuthLoginSimpleReq" } } ], @@ -3049,14 +3087,9 @@ } } }, - "/api/v1/stat/browsers": { - "get": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "客户端统计", + "/share/v1/captcha/challenge": { + "post": { + "description": "CreateCaptcha", "consumes": [ "application/json" ], @@ -3064,31 +3097,15 @@ "application/json" ], "tags": [ - "stat" + "share_captcha" ], - "summary": "客户端统计", + "summary": "CreateCaptcha", "parameters": [ - { - "enum": [ - 1, - 7, - 30, - 90 - ], - "type": "integer", - "x-enum-varnames": [ - "StatDay1", - "StatDay7", - "StatDay30", - "StatDay90" - ], - "name": "day", - "in": "query" - }, { "type": "string", - "name": "kb_id", - "in": "query", + "description": "kb id", + "name": "X-KB-ID", + "in": "header", "required": true } ], @@ -3096,32 +3113,15 @@ "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.Response" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/domain.HotBrowser" - } - } - } - ] + "$ref": "#/definitions/gocap.ChallengeData" } } } } }, - "/api/v1/stat/conversation_distribution": { - "get": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "问答来源", + "/share/v1/captcha/redeem": { + "post": { + "description": "RedeemCaptcha", "consumes": [ "application/json" ], @@ -3129,67 +3129,40 @@ "application/json" ], "tags": [ - "stat" + "share_captcha" ], - "summary": "问答来源", + "summary": "RedeemCaptcha", "parameters": [ - { - "enum": [ - 1, - 7, - 30, - 90 - ], - "type": "integer", - "x-enum-varnames": [ - "StatDay1", - "StatDay7", - "StatDay30", - "StatDay90" - ], - "name": "day", - "in": "query" - }, { "type": "string", - "name": "kb_id", - "in": "query", + "description": "kb id", + "name": "X-KB-ID", + "in": "header", "required": true + }, + { + "description": "request", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/consts.RedeemCaptchaReq" + } } ], "responses": { "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.Response" - }, - { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.ConversationDistribution" - } - } - } - } - ] + "$ref": "#/definitions/gocap.VerificationResult" } } } } }, - "/api/v1/stat/count": { - "get": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "全局统计", + "/share/v1/chat/completions": { + "post": { + "description": "OpenAI API compatible chat completions endpoint", "consumes": [ "application/json" ], @@ -3197,64 +3170,46 @@ "application/json" ], "tags": [ - "stat" + "share_chat" ], - "summary": "全局统计", + "summary": "ChatCompletions", "parameters": [ - { - "enum": [ - 1, - 7, - 30, - 90 - ], - "type": "integer", - "x-enum-varnames": [ - "StatDay1", - "StatDay7", - "StatDay30", - "StatDay90" - ], - "name": "day", - "in": "query" - }, { "type": "string", - "name": "kb_id", - "in": "query", + "description": "Knowledge Base ID", + "name": "X-KB-ID", + "in": "header", "required": true + }, + { + "description": "OpenAI API request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.OpenAICompletionsRequest" + } } ], "responses": { "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.StatCountResp" - } - } - } - ] + "$ref": "#/definitions/domain.OpenAICompletionsResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/domain.OpenAIErrorResponse" } } } } }, - "/api/v1/stat/geo_count": { - "get": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "用户地理分布", + "/share/v1/chat/feedback": { + "post": { + "description": "Process user feedback for chat conversations", "consumes": [ "application/json" ], @@ -3262,32 +3217,18 @@ "application/json" ], "tags": [ - "stat" + "share_chat" ], - "summary": "用户地理分布", + "summary": "Handle chat feedback", "parameters": [ { - "enum": [ - 1, - 7, - 30, - 90 - ], - "type": "integer", - "x-enum-varnames": [ - "StatDay1", - "StatDay7", - "StatDay30", - "StatDay90" - ], - "name": "day", - "in": "query" - }, - { - "type": "string", - "name": "kb_id", - "in": "query", - "required": true + "description": "feedback request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.FeedbackRequest" + } } ], "responses": { @@ -3300,14 +3241,9 @@ } } }, - "/api/v1/stat/hot_pages": { - "get": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "热门文档", + "/share/v1/chat/message": { + "post": { + "description": "ChatMessage", "consumes": [ "application/json" ], @@ -3315,67 +3251,40 @@ "application/json" ], "tags": [ - "stat" + "share_chat" ], - "summary": "热门文档", + "summary": "ChatMessage", "parameters": [ - { - "enum": [ - 1, - 7, - 30, - 90 - ], - "type": "integer", - "x-enum-varnames": [ - "StatDay1", - "StatDay7", - "StatDay30", - "StatDay90" - ], - "name": "day", - "in": "query" - }, { "type": "string", - "name": "kb_id", + "description": "app type", + "name": "app_type", "in": "query", "required": true + }, + { + "description": "request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.ChatRequest" + } } ], "responses": { "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.Response" - }, - { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.HotPage" - } - } - } - } - ] + "$ref": "#/definitions/domain.Response" } } } } }, - "/api/v1/stat/instant_count": { - "get": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "GetInstantCount", + "/share/v1/chat/search": { + "post": { + "description": "ChatSearch", "consumes": [ "application/json" ], @@ -3383,15 +3292,18 @@ "application/json" ], "tags": [ - "stat" + "share_chat_search" ], - "summary": "GetInstantCount", + "summary": "ChatSearch", "parameters": [ { - "type": "string", - "name": "kb_id", - "in": "query", - "required": true + "description": "request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.ChatSearchReq" + } } ], "responses": { @@ -3406,10 +3318,7 @@ "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.InstantCountResp" - } + "$ref": "#/definitions/domain.ChatSearchResp" } } } @@ -3419,14 +3328,9 @@ } } }, - "/api/v1/stat/instant_pages": { - "get": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "GetInstantPages", + "/share/v1/chat/widget": { + "post": { + "description": "ChatWidget", "consumes": [ "application/json" ], @@ -3434,50 +3338,40 @@ "application/json" ], "tags": [ - "stat" + "share_chat" ], - "summary": "GetInstantPages", + "summary": "ChatWidget", "parameters": [ { "type": "string", - "name": "kb_id", + "description": "app type", + "name": "app_type", "in": "query", "required": true + }, + { + "description": "request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.ChatRequest" + } } ], "responses": { "200": { "description": "OK", "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.Response" - }, - { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.InstantPageResp" - } - } - } - } - ] + "$ref": "#/definitions/domain.Response" } } } } }, - "/api/v1/stat/referer_hosts": { - "get": { - "security": [ - { - "bearerAuth": [] - } - ], - "description": "来源域名", + "/share/v1/comment": { + "post": { + "description": "CreateComment", "consumes": [ "application/json" ], @@ -3485,50 +3379,33 @@ "application/json" ], "tags": [ - "stat" + "share_comment" ], - "summary": "来源域名", + "summary": "CreateComment", "parameters": [ { - "enum": [ - 1, - 7, - 30, - 90 - ], - "type": "integer", - "x-enum-varnames": [ - "StatDay1", - "StatDay7", - "StatDay30", - "StatDay90" - ], - "name": "day", - "in": "query" - }, - { - "type": "string", - "name": "kb_id", - "in": "query", - "required": true + "description": "Comment", + "name": "comment", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/domain.CommentReq" + } } ], "responses": { "200": { - "description": "OK", + "description": "CommentID", "schema": { "allOf": [ { - "$ref": "#/definitions/domain.Response" + "$ref": "#/definitions/domain.PWResponse" }, { "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.HotRefererHost" - } + "type": "string" } } } @@ -3538,29 +3415,9 @@ } } }, - "/api/v1/user": { + "/share/v1/comment/list": { "get": { - "description": "GetUser", - "consumes": [ - "application/json" - ], - "tags": [ - "user" - ], - "summary": "GetUser", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/v1.UserInfoResp" - } - } - } - } - }, - "/api/v1/user/create": { - "post": { - "description": "CreateUser", + "description": "GetCommentList", "consumes": [ "application/json" ], @@ -3568,33 +3425,31 @@ "application/json" ], "tags": [ - "user" + "share_comment" ], - "summary": "CreateUser", + "summary": "GetCommentList", "parameters": [ { - "description": "CreateUser Request", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.CreateUserReq" - } + "type": "string", + "description": "nodeID", + "name": "id", + "in": "query", + "required": true } ], "responses": { "200": { - "description": "OK", + "description": "CommentList", "schema": { "allOf": [ { - "$ref": "#/definitions/domain.Response" + "$ref": "#/definitions/domain.PWResponse" }, { "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.CreateUserResp" + "$ref": "#/definitions/share.ShareCommentLists" } } } @@ -3604,24 +3459,40 @@ } } }, - "/api/v1/user/delete": { - "delete": { - "description": "DeleteUser", + "/share/v1/common/file/upload": { + "post": { + "description": "前台用户上传文件,目前只支持图片文件上传", "consumes": [ - "application/json" + "multipart/form-data" ], "produces": [ "application/json" ], "tags": [ - "user" + "ShareFile" ], - "summary": "DeleteUser", + "summary": "文件上传", + "operationId": "share-FileUpload", "parameters": [ { "type": "string", - "name": "user_id", - "in": "query", + "description": "kb id", + "name": "X-KB-ID", + "in": "header", + "required": true + }, + { + "type": "file", + "description": "File", + "name": "file", + "in": "formData", + "required": true + }, + { + "type": "string", + "description": "captcha_token", + "name": "captcha_token", + "in": "formData", "required": true } ], @@ -3629,15 +3500,27 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/domain.Response" + "allOf": [ + { + "$ref": "#/definitions/domain.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/v1.FileUploadResp" + } + } + } + ] } } } } }, - "/api/v1/user/list": { + "/share/v1/conversation/detail": { "get": { - "description": "ListUsers", + "description": "GetConversationDetail", "consumes": [ "application/json" ], @@ -3645,9 +3528,25 @@ "application/json" ], "tags": [ - "user" + "share_conversation" + ], + "summary": "GetConversationDetail", + "parameters": [ + { + "type": "string", + "description": "kb id", + "name": "X-KB-ID", + "in": "header", + "required": true + }, + { + "type": "string", + "description": "conversation id", + "name": "id", + "in": "query", + "required": true + } ], - "summary": "ListUsers", "responses": { "200": { "description": "OK", @@ -3660,7 +3559,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/definitions/v1.UserListResp" + "$ref": "#/definitions/domain.ShareConversationDetailResp" } } } @@ -3670,9 +3569,9 @@ } } }, - "/api/v1/user/login": { - "post": { - "description": "Login", + "/share/v1/node/detail": { + "get": { + "description": "GetNodeDetail", "consumes": [ "application/json" ], @@ -3680,33 +3579,45 @@ "application/json" ], "tags": [ - "user" + "share_node" ], - "summary": "Login", + "summary": "GetNodeDetail", "parameters": [ { - "description": "Login Request", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.LoginReq" - } + "type": "string", + "description": "kb id", + "name": "X-KB-ID", + "in": "header", + "required": true + }, + { + "type": "string", + "description": "node id", + "name": "id", + "in": "query", + "required": true + }, + { + "type": "string", + "description": "format", + "name": "format", + "in": "query", + "required": true } ], "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/v1.LoginResp" + "$ref": "#/definitions/domain.Response" } } } } }, - "/api/v1/user/reset_password": { - "put": { - "description": "ResetPassword", + "/share/v1/node/list": { + "get": { + "description": "GetNodeList", "consumes": [ "application/json" ], @@ -3714,18 +3625,16 @@ "application/json" ], "tags": [ - "user" + "share_node" ], - "summary": "ResetPassword", + "summary": "GetNodeList", "parameters": [ { - "description": "ResetPassword Request", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.ResetPasswordReq" - } + "type": "string", + "description": "kb id", + "name": "X-KB-ID", + "in": "header", + "required": true } ], "responses": { @@ -3738,9 +3647,9 @@ } } }, - "/share/v1/app/web/info": { + "/share/v1/openapi/github/callback": { "get": { - "description": "GetAppInfo", + "description": "GitHub回调", "consumes": [ "application/json" ], @@ -3748,16 +3657,20 @@ "application/json" ], "tags": [ - "share_app" + "ShareOpenapi" ], - "summary": "GetAppInfo", + "summary": "GitHub回调", + "operationId": "v1-GitHubCallback", "parameters": [ { "type": "string", - "description": "kb id", - "name": "X-KB-ID", - "in": "header", - "required": true + "name": "code", + "in": "query" + }, + { + "type": "string", + "name": "state", + "in": "query" } ], "responses": { @@ -3766,13 +3679,13 @@ "schema": { "allOf": [ { - "$ref": "#/definitions/domain.Response" + "$ref": "#/definitions/domain.PWResponse" }, { "type": "object", "properties": { "data": { - "$ref": "#/definitions/domain.AppInfoResp" + "$ref": "#/definitions/github_com_chaitin_panda-wiki_api_share_v1.GitHubCallbackResp" } } } @@ -3782,9 +3695,9 @@ } } }, - "/share/v1/app/wechat/service/answer": { - "get": { - "description": "GetWechatAnswer", + "/share/v1/openapi/lark/bot/{kb_id}": { + "post": { + "description": "Lark机器人请求", "consumes": [ "application/json" ], @@ -3792,823 +3705,10 @@ "application/json" ], "tags": [ - "Wechat" + "ShareOpenapi" ], - "summary": "GetWechatAnswer", - "parameters": [ - { - "type": "string", - "description": "conversation id", - "name": "id", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.Response" - } - } - } - } - }, - "/share/v1/app/widget/info": { - "get": { - "description": "GetWidgetAppInfo", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_app" - ], - "summary": "GetWidgetAppInfo", - "parameters": [ - { - "type": "string", - "description": "kb id", - "name": "X-KB-ID", - "in": "header", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.Response" - } - } - } - } - }, - "/share/v1/auth/get": { - "get": { - "description": "AuthGet", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_auth" - ], - "summary": "AuthGet", - "operationId": "v1-AuthGet", - "parameters": [ - { - "type": "string", - "description": "kb_id", - "name": "X-KB-ID", - "in": "header", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_api_share_v1.AuthGetResp" - } - } - } - ] - } - } - } - } - }, - "/share/v1/auth/github": { - "post": { - "description": "GitHub登录", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "ShareAuth" - ], - "summary": "GitHub登录", - "operationId": "v1-AuthGitHub", - "parameters": [ - { - "type": "string", - "description": "kb id", - "name": "X-KB-ID", - "in": "header", - "required": true - }, - { - "description": "para", - "name": "param", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.AuthGitHubReq" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.AuthGitHubResp" - } - } - } - ] - } - } - } - } - }, - "/share/v1/auth/login/simple": { - "post": { - "description": "AuthLoginSimple", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_auth" - ], - "summary": "AuthLoginSimple", - "operationId": "v1-AuthLoginSimple", - "parameters": [ - { - "type": "string", - "description": "kb_id", - "name": "X-KB-ID", - "in": "header", - "required": true - }, - { - "description": "para", - "name": "param", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1.AuthLoginSimpleReq" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.Response" - } - } - } - } - }, - "/share/v1/captcha/challenge": { - "post": { - "description": "CreateCaptcha", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_captcha" - ], - "summary": "CreateCaptcha", - "parameters": [ - { - "type": "string", - "description": "kb id", - "name": "X-KB-ID", - "in": "header", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/gocap.ChallengeData" - } - } - } - } - }, - "/share/v1/captcha/redeem": { - "post": { - "description": "RedeemCaptcha", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_captcha" - ], - "summary": "RedeemCaptcha", - "parameters": [ - { - "type": "string", - "description": "kb id", - "name": "X-KB-ID", - "in": "header", - "required": true - }, - { - "description": "request", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/consts.RedeemCaptchaReq" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/gocap.VerificationResult" - } - } - } - } - }, - "/share/v1/chat/completions": { - "post": { - "description": "OpenAI API compatible chat completions endpoint", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_chat" - ], - "summary": "ChatCompletions", - "parameters": [ - { - "type": "string", - "description": "Knowledge Base ID", - "name": "X-KB-ID", - "in": "header", - "required": true - }, - { - "description": "OpenAI API request", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.OpenAICompletionsRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.OpenAICompletionsResponse" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/domain.OpenAIErrorResponse" - } - } - } - } - }, - "/share/v1/chat/feedback": { - "post": { - "description": "Process user feedback for chat conversations", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_chat" - ], - "summary": "Handle chat feedback", - "parameters": [ - { - "description": "feedback request", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.FeedbackRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.Response" - } - } - } - } - }, - "/share/v1/chat/message": { - "post": { - "description": "ChatMessage", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_chat" - ], - "summary": "ChatMessage", - "parameters": [ - { - "type": "string", - "description": "app type", - "name": "app_type", - "in": "query", - "required": true - }, - { - "description": "request", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.ChatRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.Response" - } - } - } - } - }, - "/share/v1/chat/search": { - "post": { - "description": "ChatSearch", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_chat_search" - ], - "summary": "ChatSearch", - "parameters": [ - { - "description": "request", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.ChatSearchReq" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.Response" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/domain.ChatSearchResp" - } - } - } - ] - } - } - } - } - }, - "/share/v1/chat/widget": { - "post": { - "description": "ChatWidget", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_chat" - ], - "summary": "ChatWidget", - "parameters": [ - { - "type": "string", - "description": "app type", - "name": "app_type", - "in": "query", - "required": true - }, - { - "description": "request", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.ChatRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.Response" - } - } - } - } - }, - "/share/v1/comment": { - "post": { - "description": "CreateComment", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_comment" - ], - "summary": "CreateComment", - "parameters": [ - { - "description": "Comment", - "name": "comment", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/domain.CommentReq" - } - } - ], - "responses": { - "200": { - "description": "CommentID", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "type": "string" - } - } - } - ] - } - } - } - } - }, - "/share/v1/comment/list": { - "get": { - "description": "GetCommentList", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_comment" - ], - "summary": "GetCommentList", - "parameters": [ - { - "type": "string", - "description": "nodeID", - "name": "id", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "CommentList", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/share.ShareCommentLists" - } - } - } - ] - } - } - } - } - }, - "/share/v1/common/file/upload": { - "post": { - "description": "前台用户上传文件,目前只支持图片文件上传", - "consumes": [ - "multipart/form-data" - ], - "produces": [ - "application/json" - ], - "tags": [ - "ShareFile" - ], - "summary": "文件上传", - "operationId": "share-FileUpload", - "parameters": [ - { - "type": "string", - "description": "kb id", - "name": "X-KB-ID", - "in": "header", - "required": true - }, - { - "type": "file", - "description": "File", - "name": "file", - "in": "formData", - "required": true - }, - { - "type": "string", - "description": "captcha_token", - "name": "captcha_token", - "in": "formData", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.Response" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/v1.FileUploadResp" - } - } - } - ] - } - } - } - } - }, - "/share/v1/conversation/detail": { - "get": { - "description": "GetConversationDetail", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_conversation" - ], - "summary": "GetConversationDetail", - "parameters": [ - { - "type": "string", - "description": "kb id", - "name": "X-KB-ID", - "in": "header", - "required": true - }, - { - "type": "string", - "description": "conversation id", - "name": "id", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/domain.ShareConversationDetailResp" - } - } - } - ] - } - } - } - } - }, - "/share/v1/node/detail": { - "get": { - "description": "GetNodeDetail", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_node" - ], - "summary": "GetNodeDetail", - "parameters": [ - { - "type": "string", - "description": "kb id", - "name": "X-KB-ID", - "in": "header", - "required": true - }, - { - "type": "string", - "description": "node id", - "name": "id", - "in": "query", - "required": true - }, - { - "type": "string", - "description": "format", - "name": "format", - "in": "query", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.Response" - } - } - } - } - }, - "/share/v1/node/list": { - "get": { - "description": "GetNodeList", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "share_node" - ], - "summary": "GetNodeList", - "parameters": [ - { - "type": "string", - "description": "kb id", - "name": "X-KB-ID", - "in": "header", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/domain.Response" - } - } - } - } - }, - "/share/v1/openapi/github/callback": { - "get": { - "description": "GitHub回调", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "ShareOpenapi" - ], - "summary": "GitHub回调", - "operationId": "v1-GitHubCallback", - "parameters": [ - { - "type": "string", - "name": "code", - "in": "query" - }, - { - "type": "string", - "name": "state", - "in": "query" - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/domain.PWResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_api_share_v1.GitHubCallbackResp" - } - } - } - ] - } - } - } - } - }, - "/share/v1/openapi/lark/bot/{kb_id}": { - "post": { - "description": "Lark机器人请求", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "ShareOpenapi" - ], - "summary": "Lark机器人请求", - "operationId": "v1-LarkBot", + "summary": "Lark机器人请求", + "operationId": "v1-LarkBot", "parameters": [ { "type": "string", @@ -4664,6 +3764,40 @@ } }, "definitions": { + "anydoc.Child": { + "type": "object", + "properties": { + "children": { + "type": "array", + "items": { + "$ref": "#/definitions/anydoc.Child" + } + }, + "value": { + "$ref": "#/definitions/anydoc.Value" + } + } + }, + "anydoc.Value": { + "type": "object", + "properties": { + "file": { + "type": "boolean" + }, + "file_type": { + "type": "string" + }, + "id": { + "type": "string" + }, + "summary": { + "type": "string" + }, + "title": { + "type": "string" + } + } + }, "consts.AuthType": { "type": "string", "enum": [ @@ -4710,6 +3844,37 @@ "CopySettingDisabled" ] }, + "consts.CrawlerSource": { + "type": "string", + "enum": [ + "url", + "rss", + "sitemap", + "notion", + "feishu", + "file", + "epub", + "yuque", + "siyuan", + "mindoc", + "wikijs", + "confluence" + ], + "x-enum-varnames": [ + "CrawlerSourceUrl", + "CrawlerSourceRSS", + "CrawlerSourceSitemap", + "CrawlerSourceNotion", + "CrawlerSourceFeishu", + "CrawlerSourceFile", + "CrawlerSourceEpub", + "CrawlerSourceYuque", + "CrawlerSourceSiyuan", + "CrawlerSourceMindoc", + "CrawlerSourceWikijs", + "CrawlerSourceConfluence" + ] + }, "consts.CrawlerStatus": { "type": "string", "enum": [ @@ -5040,323 +4205,47 @@ "domain.AppDetailResp": { "type": "object", "properties": { - "id": { - "type": "string" - }, - "kb_id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "recommend_nodes": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.RecommendNodeListResp" - } - }, - "settings": { - "$ref": "#/definitions/domain.AppSettingsResp" - }, - "type": { - "$ref": "#/definitions/domain.AppType" - } - } - }, - "domain.AppInfoResp": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "recommend_nodes": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.RecommendNodeListResp" - } - }, - "settings": { - "$ref": "#/definitions/domain.AppSettingsResp" - } - } - }, - "domain.AppSettings": { - "type": "object", - "properties": { - "ai_feedback_settings": { - "description": "AI feedback", - "allOf": [ - { - "$ref": "#/definitions/domain.AIFeedbackSettings" - } - ] - }, - "auto_sitemap": { - "type": "boolean" - }, - "body_code": { - "type": "string" - }, - "btns": { - "type": "array", - "items": {} - }, - "catalog_settings": { - "description": "catalog settings", - "allOf": [ - { - "$ref": "#/definitions/domain.CatalogSettings" - } - ] - }, - "contribute_settings": { - "$ref": "#/definitions/domain.ContributeSettings" - }, - "copy_setting": { - "enum": [ - "", - "append", - "disabled" - ], - "allOf": [ - { - "$ref": "#/definitions/consts.CopySetting" - } - ] - }, - "desc": { - "description": "seo", - "type": "string" - }, - "dingtalk_bot_client_id": { - "type": "string" - }, - "dingtalk_bot_client_secret": { - "type": "string" - }, - "dingtalk_bot_is_enabled": { - "description": "DingTalkBot", - "type": "boolean" - }, - "dingtalk_bot_template_id": { - "type": "string" - }, - "disclaimer_settings": { - "description": "Disclaimer Settings", - "allOf": [ - { - "$ref": "#/definitions/domain.DisclaimerSettings" - } - ] - }, - "discord_bot_is_enabled": { - "description": "DisCordBot", - "type": "boolean" - }, - "discord_bot_token": { - "type": "string" - }, - "document_feedback_is_enabled": { - "description": "document feedback", - "type": "boolean" - }, - "feishu_bot_app_id": { - "type": "string" - }, - "feishu_bot_app_secret": { - "type": "string" - }, - "feishu_bot_is_enabled": { - "description": "FeishuBot", - "type": "boolean" - }, - "footer_settings": { - "description": "footer settings", - "allOf": [ - { - "$ref": "#/definitions/domain.FooterSettings" - } - ] - }, - "head_code": { - "description": "inject code", - "type": "string" - }, - "home_page_setting": { - "$ref": "#/definitions/consts.HomePageSetting" - }, - "icon": { - "type": "string" - }, - "keyword": { - "type": "string" - }, - "lark_bot_settings": { - "description": "LarkBot", - "allOf": [ - { - "$ref": "#/definitions/domain.LarkBotSettings" - } - ] - }, - "openai_api_bot_settings": { - "description": "OpenAI API Bot settings", - "allOf": [ - { - "$ref": "#/definitions/domain.OpenAIAPIBotSettings" - } - ] - }, - "recommend_node_ids": { - "type": "array", - "items": { - "type": "string" - } - }, - "recommend_questions": { - "type": "array", - "items": { - "type": "string" - } - }, - "search_placeholder": { - "type": "string" - }, - "theme_and_style": { - "$ref": "#/definitions/domain.ThemeAndStyle" - }, - "theme_mode": { - "description": "theme", - "type": "string" - }, - "title": { - "description": "nav", - "type": "string" - }, - "watermark_content": { - "type": "string" - }, - "watermark_setting": { - "enum": [ - "", - "hidden", - "visible" - ], - "allOf": [ - { - "$ref": "#/definitions/consts.WatermarkSetting" - } - ] - }, - "web_app_comment_settings": { - "description": "webapp comment settings", - "allOf": [ - { - "$ref": "#/definitions/domain.WebAppCommentSettings" - } - ] - }, - "web_app_custom_style": { - "description": "WebAppCustomStyle", - "allOf": [ - { - "$ref": "#/definitions/domain.WebAppCustomSettings" - } - ] - }, - "web_app_landing_configs": { - "description": "WebAppLandingConfigs", - "type": "array", - "items": { - "$ref": "#/definitions/domain.WebAppLandingConfig" - } - }, - "wechat_app_agent_id": { - "type": "string" - }, - "wechat_app_corpid": { - "type": "string" - }, - "wechat_app_encodingaeskey": { - "type": "string" - }, - "wechat_app_is_enabled": { - "description": "WechatAppBot 企业微信机器人", - "type": "boolean" - }, - "wechat_app_secret": { - "type": "string" - }, - "wechat_app_token": { - "type": "string" - }, - "wechat_official_account_app_id": { - "type": "string" - }, - "wechat_official_account_app_secret": { + "id": { "type": "string" }, - "wechat_official_account_encodingaeskey": { + "kb_id": { "type": "string" }, - "wechat_official_account_is_enabled": { - "description": "WechatOfficialAccount", - "type": "boolean" - }, - "wechat_official_account_token": { + "name": { "type": "string" }, - "wechat_service_contain_keywords": { + "recommend_nodes": { "type": "array", "items": { - "type": "string" + "$ref": "#/definitions/domain.RecommendNodeListResp" } }, - "wechat_service_corpid": { - "type": "string" + "settings": { + "$ref": "#/definitions/domain.AppSettingsResp" }, - "wechat_service_encodingaeskey": { + "type": { + "$ref": "#/definitions/domain.AppType" + } + } + }, + "domain.AppInfoResp": { + "type": "object", + "properties": { + "name": { "type": "string" }, - "wechat_service_equal_keywords": { + "recommend_nodes": { "type": "array", "items": { - "type": "string" + "$ref": "#/definitions/domain.RecommendNodeListResp" } }, - "wechat_service_is_enabled": { - "description": "WechatServiceBot", - "type": "boolean" - }, - "wechat_service_secret": { - "type": "string" - }, - "wechat_service_token": { - "type": "string" - }, - "wecom_ai_bot_settings": { - "description": "WecomAIBotSettings 企业微信智能机器人", - "allOf": [ - { - "$ref": "#/definitions/domain.WecomAIBotSettings" - } - ] - }, - "welcome_str": { - "description": "welcome", - "type": "string" - }, - "widget_bot_settings": { - "description": "Widget bot settings", - "allOf": [ - { - "$ref": "#/definitions/domain.WidgetBotSettings" - } - ] + "settings": { + "$ref": "#/definitions/domain.AppSettingsResp" } } }, - "domain.AppSettingsResp": { + "domain.AppSettings": { "type": "object", "properties": { "ai_feedback_settings": { @@ -5389,7 +4278,16 @@ "$ref": "#/definitions/domain.ContributeSettings" }, "copy_setting": { - "$ref": "#/definitions/consts.CopySetting" + "enum": [ + "", + "append", + "disabled" + ], + "allOf": [ + { + "$ref": "#/definitions/consts.CopySetting" + } + ] }, "desc": { "description": "seo", @@ -5467,7 +4365,7 @@ ] }, "openai_api_bot_settings": { - "description": "OpenAI API settings", + "description": "OpenAI API Bot settings", "allOf": [ { "$ref": "#/definitions/domain.OpenAIAPIBotSettings" @@ -5504,7 +4402,16 @@ "type": "string" }, "watermark_setting": { - "$ref": "#/definitions/consts.WatermarkSetting" + "enum": [ + "", + "hidden", + "visible" + ], + "allOf": [ + { + "$ref": "#/definitions/consts.WatermarkSetting" + } + ] }, "web_app_comment_settings": { "description": "webapp comment settings", @@ -5523,10 +4430,10 @@ ] }, "web_app_landing_configs": { - "description": "WebApp Landing Settings", + "description": "WebAppLandingConfigs", "type": "array", "items": { - "$ref": "#/definitions/domain.WebAppLandingConfigResp" + "$ref": "#/definitions/domain.WebAppLandingConfig" } }, "wechat_app_agent_id": { @@ -5539,7 +4446,7 @@ "type": "string" }, "wechat_app_is_enabled": { - "description": "WechatAppBot", + "description": "WechatAppBot 企业微信机器人", "type": "boolean" }, "wechat_app_secret": { @@ -5550,1827 +4457,1640 @@ }, "wechat_official_account_app_id": { "type": "string" - }, - "wechat_official_account_app_secret": { - "type": "string" - }, - "wechat_official_account_encodingaeskey": { - "type": "string" - }, - "wechat_official_account_is_enabled": { - "description": "WechatOfficialAccount", - "type": "boolean" - }, - "wechat_official_account_token": { - "type": "string" - }, - "wechat_service_contain_keywords": { - "type": "array", - "items": { - "type": "string" - } - }, - "wechat_service_corpid": { - "type": "string" - }, - "wechat_service_encodingaeskey": { - "type": "string" - }, - "wechat_service_equal_keywords": { - "type": "array", - "items": { - "type": "string" - } - }, - "wechat_service_is_enabled": { - "description": "WechatServiceBot", - "type": "boolean" - }, - "wechat_service_secret": { - "type": "string" - }, - "wechat_service_token": { - "type": "string" - }, - "wecom_ai_bot_settings": { - "$ref": "#/definitions/domain.WecomAIBotSettings" - }, - "welcome_str": { - "description": "welcome", - "type": "string" - }, - "widget_bot_settings": { - "description": "WidgetBot", - "allOf": [ - { - "$ref": "#/definitions/domain.WidgetBotSettings" - } - ] - } - } - }, - "domain.AppType": { - "type": "integer", - "format": "int32", - "enum": [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11 - ], - "x-enum-varnames": [ - "AppTypeWeb", - "AppTypeWidget", - "AppTypeDingTalkBot", - "AppTypeFeishuBot", - "AppTypeWechatBot", - "AppTypeWechatServiceBot", - "AppTypeDisCordBot", - "AppTypeWechatOfficialAccount", - "AppTypeOpenAIAPI", - "AppTypeWecomAIBot", - "AppTypeLarkBot" - ] - }, - "domain.AuthUserInfo": { - "type": "object", - "properties": { - "avatar_url": { - "type": "string" - }, - "email": { - "type": "string" - }, - "username": { - "type": "string" - } - } - }, - "domain.BannerConfig": { - "type": "object", - "properties": { - "bg_url": { - "type": "string" - }, - "btns": { - "type": "array", - "items": { - "type": "object", - "properties": { - "href": { - "type": "string" - }, - "id": { - "type": "string" - }, - "text": { - "type": "string" - }, - "type": { - "type": "string" - } - } - } - }, - "hot_search": { - "type": "array", - "items": { - "type": "string" - } - }, - "placeholder": { - "type": "string" - }, - "subtitle": { - "type": "string" - }, - "subtitle_color": { - "type": "string" - }, - "subtitle_font_size": { - "type": "integer" - }, - "title": { - "type": "string" - }, - "title_color": { - "type": "string" - }, - "title_font_size": { - "type": "integer" - } - } - }, - "domain.BasicDocConfig": { - "type": "object", - "properties": { - "bg_color": { + }, + "wechat_official_account_app_secret": { "type": "string" }, - "title": { + "wechat_official_account_encodingaeskey": { "type": "string" }, - "title_color": { + "wechat_official_account_is_enabled": { + "description": "WechatOfficialAccount", + "type": "boolean" + }, + "wechat_official_account_token": { "type": "string" - } - } - }, - "domain.BatchMoveReq": { - "type": "object", - "required": [ - "ids", - "kb_id" - ], - "properties": { - "ids": { + }, + "wechat_service_contain_keywords": { "type": "array", "items": { "type": "string" } }, - "kb_id": { + "wechat_service_corpid": { "type": "string" }, - "parent_id": { + "wechat_service_encodingaeskey": { "type": "string" - } - } - }, - "domain.BrandGroup": { - "type": "object", - "properties": { - "links": { + }, + "wechat_service_equal_keywords": { "type": "array", "items": { - "$ref": "#/definitions/domain.Link" + "type": "string" } }, - "name": { + "wechat_service_is_enabled": { + "description": "WechatServiceBot", + "type": "boolean" + }, + "wechat_service_secret": { "type": "string" - } - } - }, - "domain.BrowserCount": { - "type": "object", - "properties": { - "count": { - "type": "integer" }, - "name": { + "wechat_service_token": { + "type": "string" + }, + "wecom_ai_bot_settings": { + "description": "WecomAIBotSettings 企业微信智能机器人", + "allOf": [ + { + "$ref": "#/definitions/domain.WecomAIBotSettings" + } + ] + }, + "welcome_str": { + "description": "welcome", "type": "string" + }, + "widget_bot_settings": { + "description": "Widget bot settings", + "allOf": [ + { + "$ref": "#/definitions/domain.WidgetBotSettings" + } + ] } } }, - "domain.CarouselConfig": { + "domain.AppSettingsResp": { "type": "object", "properties": { - "bg_color": { + "ai_feedback_settings": { + "description": "AI feedback", + "allOf": [ + { + "$ref": "#/definitions/domain.AIFeedbackSettings" + } + ] + }, + "auto_sitemap": { + "type": "boolean" + }, + "body_code": { "type": "string" }, - "list": { + "btns": { "type": "array", - "items": { - "type": "object", - "properties": { - "desc": { - "type": "string" - }, - "id": { - "type": "string" - }, - "title": { - "type": "string" - }, - "url": { - "type": "string" - } + "items": {} + }, + "catalog_settings": { + "description": "catalog settings", + "allOf": [ + { + "$ref": "#/definitions/domain.CatalogSettings" } - } + ] }, - "title": { + "contribute_settings": { + "$ref": "#/definitions/domain.ContributeSettings" + }, + "copy_setting": { + "$ref": "#/definitions/consts.CopySetting" + }, + "desc": { + "description": "seo", "type": "string" - } - } - }, - "domain.CatalogSettings": { - "type": "object", - "properties": { - "catalog_folder": { - "description": "1: 展开, 2: 折叠, default: 1", - "type": "integer" }, - "catalog_visible": { - "description": "1: 显示, 2: 隐藏, default: 1", - "type": "integer" + "dingtalk_bot_client_id": { + "type": "string" }, - "catalog_width": { - "description": "200 - 300, default: 260", - "type": "integer" - } - } - }, - "domain.ChatRequest": { - "type": "object", - "required": [ - "app_type", - "message" - ], - "properties": { - "app_type": { - "enum": [ - 1, - 2 - ], + "dingtalk_bot_client_secret": { + "type": "string" + }, + "dingtalk_bot_is_enabled": { + "description": "DingTalkBot", + "type": "boolean" + }, + "dingtalk_bot_template_id": { + "type": "string" + }, + "disclaimer_settings": { + "description": "Disclaimer Settings", "allOf": [ { - "$ref": "#/definitions/domain.AppType" + "$ref": "#/definitions/domain.DisclaimerSettings" } ] }, - "captcha_token": { + "discord_bot_is_enabled": { + "description": "DisCordBot", + "type": "boolean" + }, + "discord_bot_token": { "type": "string" }, - "conversation_id": { + "document_feedback_is_enabled": { + "description": "document feedback", + "type": "boolean" + }, + "feishu_bot_app_id": { "type": "string" }, - "message": { + "feishu_bot_app_secret": { "type": "string" }, - "nonce": { + "feishu_bot_is_enabled": { + "description": "FeishuBot", + "type": "boolean" + }, + "footer_settings": { + "description": "footer settings", + "allOf": [ + { + "$ref": "#/definitions/domain.FooterSettings" + } + ] + }, + "head_code": { + "description": "inject code", "type": "string" - } - } - }, - "domain.ChatSearchReq": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "captcha_token": { + }, + "home_page_setting": { + "$ref": "#/definitions/consts.HomePageSetting" + }, + "icon": { "type": "string" }, - "message": { + "keyword": { "type": "string" - } - } - }, - "domain.ChatSearchResp": { - "type": "object", - "properties": { - "node_result": { + }, + "lark_bot_settings": { + "description": "LarkBot", + "allOf": [ + { + "$ref": "#/definitions/domain.LarkBotSettings" + } + ] + }, + "openai_api_bot_settings": { + "description": "OpenAI API settings", + "allOf": [ + { + "$ref": "#/definitions/domain.OpenAIAPIBotSettings" + } + ] + }, + "recommend_node_ids": { "type": "array", "items": { - "$ref": "#/definitions/domain.NodeContentChunkSSE" + "type": "string" } - } - } - }, - "domain.CommentInfo": { - "type": "object", - "properties": { - "auth_user_id": { - "type": "integer" }, - "avatar": { - "description": "avatar", - "type": "string" + "recommend_questions": { + "type": "array", + "items": { + "type": "string" + } }, - "email": { + "search_placeholder": { "type": "string" }, - "remote_ip": { - "type": "string" + "theme_and_style": { + "$ref": "#/definitions/domain.ThemeAndStyle" }, - "user_name": { - "type": "string" - } - } - }, - "domain.CommentListItem": { - "type": "object", - "properties": { - "content": { + "theme_mode": { + "description": "theme", "type": "string" }, - "created_at": { + "title": { + "description": "nav", "type": "string" }, - "id": { + "watermark_content": { "type": "string" }, - "info": { - "$ref": "#/definitions/domain.CommentInfo" + "watermark_setting": { + "$ref": "#/definitions/consts.WatermarkSetting" }, - "ip_address": { - "description": "ip地址", + "web_app_comment_settings": { + "description": "webapp comment settings", "allOf": [ { - "$ref": "#/definitions/domain.IPAddress" + "$ref": "#/definitions/domain.WebAppCommentSettings" } ] }, - "node_id": { - "type": "string" - }, - "node_name": { - "description": "文档标题", - "type": "string" - }, - "node_type": { - "type": "integer" - }, - "root_id": { - "type": "string" - }, - "status": { - "description": "status : -1 reject 0 pending 1 accept", + "web_app_custom_style": { + "description": "WebAppCustomStyle", "allOf": [ { - "$ref": "#/definitions/domain.CommentStatus" + "$ref": "#/definitions/domain.WebAppCustomSettings" } ] - } - } - }, - "domain.CommentReq": { - "type": "object", - "required": [ - "content", - "node_id", - "pic_urls" - ], - "properties": { - "captcha_token": { - "type": "string" }, - "content": { + "web_app_landing_configs": { + "description": "WebApp Landing Settings", + "type": "array", + "items": { + "$ref": "#/definitions/domain.WebAppLandingConfigResp" + } + }, + "wechat_app_agent_id": { "type": "string" }, - "node_id": { + "wechat_app_corpid": { "type": "string" }, - "parent_id": { + "wechat_app_encodingaeskey": { "type": "string" }, - "pic_urls": { - "type": "array", - "items": { - "type": "string" - } + "wechat_app_is_enabled": { + "description": "WechatAppBot", + "type": "boolean" }, - "root_id": { + "wechat_app_secret": { "type": "string" }, - "user_name": { - "type": "string" - } - } - }, - "domain.CommentStatus": { - "type": "integer", - "format": "int32", - "enum": [ - -1, - 0, - 1 - ], - "x-enum-varnames": [ - "CommentStatusReject", - "CommentStatusPending", - "CommentStatusAccepted" - ] - }, - "domain.CompleteReq": { - "type": "object", - "properties": { - "prefix": { - "description": "For FIM (Fill in Middle) style completion", + "wechat_app_token": { "type": "string" }, - "suffix": { - "type": "string" - } - } - }, - "domain.ContributeSettings": { - "type": "object", - "properties": { - "is_enable": { - "type": "boolean" - } - } - }, - "domain.ConversationDetailResp": { - "type": "object", - "properties": { - "app_id": { + "wechat_official_account_app_id": { "type": "string" }, - "created_at": { + "wechat_official_account_app_secret": { "type": "string" }, - "id": { + "wechat_official_account_encodingaeskey": { "type": "string" }, - "ip_address": { - "$ref": "#/definitions/domain.IPAddress" + "wechat_official_account_is_enabled": { + "description": "WechatOfficialAccount", + "type": "boolean" }, - "messages": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.ConversationMessage" - } + "wechat_official_account_token": { + "type": "string" }, - "references": { + "wechat_service_contain_keywords": { "type": "array", "items": { - "$ref": "#/definitions/domain.ConversationReference" + "type": "string" } }, - "remote_ip": { + "wechat_service_corpid": { "type": "string" }, - "subject": { - "type": "string" - } - } - }, - "domain.ConversationDistribution": { - "type": "object", - "properties": { - "app_id": { + "wechat_service_encodingaeskey": { "type": "string" }, - "app_type": { - "$ref": "#/definitions/domain.AppType" + "wechat_service_equal_keywords": { + "type": "array", + "items": { + "type": "string" + } }, - "count": { - "type": "integer" - } - } - }, - "domain.ConversationInfo": { - "type": "object", - "properties": { - "user_info": { - "$ref": "#/definitions/domain.UserInfo" - } - } - }, - "domain.ConversationListItem": { - "type": "object", - "properties": { - "app_name": { - "type": "string" + "wechat_service_is_enabled": { + "description": "WechatServiceBot", + "type": "boolean" }, - "app_type": { - "$ref": "#/definitions/domain.AppType" + "wechat_service_secret": { + "type": "string" }, - "created_at": { + "wechat_service_token": { "type": "string" }, - "feedback_info": { - "description": "用户反馈信息", - "allOf": [ - { - "$ref": "#/definitions/domain.FeedBackInfo" - } - ] + "wecom_ai_bot_settings": { + "$ref": "#/definitions/domain.WecomAIBotSettings" }, - "id": { + "welcome_str": { + "description": "welcome", "type": "string" }, - "info": { - "description": "用户信息", + "widget_bot_settings": { + "description": "WidgetBot", "allOf": [ { - "$ref": "#/definitions/domain.ConversationInfo" + "$ref": "#/definitions/domain.WidgetBotSettings" } ] + } + } + }, + "domain.AppType": { + "type": "integer", + "format": "int32", + "enum": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "x-enum-varnames": [ + "AppTypeWeb", + "AppTypeWidget", + "AppTypeDingTalkBot", + "AppTypeFeishuBot", + "AppTypeWechatBot", + "AppTypeWechatServiceBot", + "AppTypeDisCordBot", + "AppTypeWechatOfficialAccount", + "AppTypeOpenAIAPI", + "AppTypeWecomAIBot", + "AppTypeLarkBot" + ] + }, + "domain.AuthUserInfo": { + "type": "object", + "properties": { + "avatar_url": { + "type": "string" }, - "ip_address": { - "$ref": "#/definitions/domain.IPAddress" - }, - "remote_ip": { + "email": { "type": "string" }, - "subject": { + "username": { "type": "string" } } }, - "domain.ConversationMessage": { + "domain.BannerConfig": { "type": "object", "properties": { - "app_id": { - "type": "string" - }, - "completion_tokens": { - "type": "integer" - }, - "content": { - "type": "string" - }, - "conversation_id": { - "type": "string" - }, - "created_at": { - "type": "string" - }, - "id": { + "bg_url": { "type": "string" }, - "info": { - "description": "feedbackinfo", - "allOf": [ - { - "$ref": "#/definitions/domain.FeedBackInfo" + "btns": { + "type": "array", + "items": { + "type": "object", + "properties": { + "href": { + "type": "string" + }, + "id": { + "type": "string" + }, + "text": { + "type": "string" + }, + "type": { + "type": "string" + } } - ] + } }, - "kb_id": { + "hot_search": { + "type": "array", + "items": { + "type": "string" + } + }, + "placeholder": { "type": "string" }, - "model": { + "subtitle": { "type": "string" }, - "parent_id": { - "description": "parent_id", + "subtitle_color": { "type": "string" }, - "prompt_tokens": { + "subtitle_font_size": { "type": "integer" }, - "provider": { - "description": "model", - "allOf": [ - { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelProvider" - } - ] - }, - "remote_ip": { - "description": "stats", + "title": { "type": "string" }, - "role": { - "$ref": "#/definitions/schema.RoleType" + "title_color": { + "type": "string" }, - "total_tokens": { + "title_font_size": { "type": "integer" } } }, - "domain.ConversationMessageListItem": { + "domain.BasicDocConfig": { "type": "object", "properties": { - "app_id": { - "type": "string" - }, - "app_type": { - "$ref": "#/definitions/domain.AppType" - }, - "conversation_id": { + "bg_color": { "type": "string" }, - "conversation_info": { - "description": "userInfo", - "allOf": [ - { - "$ref": "#/definitions/domain.ConversationInfo" - } - ] - }, - "created_at": { + "title": { "type": "string" }, - "id": { + "title_color": { "type": "string" + } + } + }, + "domain.BatchMoveReq": { + "type": "object", + "required": [ + "ids", + "kb_id" + ], + "properties": { + "ids": { + "type": "array", + "items": { + "type": "string" + } }, - "info": { - "description": "feedbackInfo", - "allOf": [ - { - "$ref": "#/definitions/domain.FeedBackInfo" - } - ] - }, - "ip_address": { - "$ref": "#/definitions/domain.IPAddress" - }, - "question": { + "kb_id": { "type": "string" }, - "remote_ip": { - "description": "stats", + "parent_id": { "type": "string" } } }, - "domain.ConversationReference": { + "domain.BrandGroup": { "type": "object", "properties": { - "app_id": { - "type": "string" - }, - "conversation_id": { - "type": "string" + "links": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.Link" + } }, "name": { "type": "string" + } + } + }, + "domain.BrowserCount": { + "type": "object", + "properties": { + "count": { + "type": "integer" }, - "node_id": { - "type": "string" - }, - "url": { + "name": { "type": "string" } } }, - "domain.CreateKBReleaseReq": { + "domain.CarouselConfig": { "type": "object", - "required": [ - "kb_id", - "message", - "tag" - ], "properties": { - "kb_id": { - "type": "string" - }, - "message": { + "bg_color": { "type": "string" }, - "node_ids": { - "description": "create release after these nodes published", + "list": { "type": "array", "items": { - "type": "string" + "type": "object", + "properties": { + "desc": { + "type": "string" + }, + "id": { + "type": "string" + }, + "title": { + "type": "string" + }, + "url": { + "type": "string" + } + } } }, - "tag": { + "title": { "type": "string" } } }, - "domain.CreateKnowledgeBaseReq": { + "domain.CatalogSettings": { + "type": "object", + "properties": { + "catalog_folder": { + "description": "1: 展开, 2: 折叠, default: 1", + "type": "integer" + }, + "catalog_visible": { + "description": "1: 显示, 2: 隐藏, default: 1", + "type": "integer" + }, + "catalog_width": { + "description": "200 - 300, default: 260", + "type": "integer" + } + } + }, + "domain.ChatRequest": { "type": "object", "required": [ - "name" + "app_type", + "message" ], "properties": { - "hosts": { - "type": "array", - "items": { - "type": "string" - } + "app_type": { + "enum": [ + 1, + 2 + ], + "allOf": [ + { + "$ref": "#/definitions/domain.AppType" + } + ] }, - "name": { + "captcha_token": { "type": "string" }, - "ports": { - "type": "array", - "items": { - "type": "integer" - } + "conversation_id": { + "type": "string" }, - "private_key": { + "message": { "type": "string" }, - "public_key": { + "nonce": { + "type": "string" + } + } + }, + "domain.ChatSearchReq": { + "type": "object", + "required": [ + "message" + ], + "properties": { + "captcha_token": { "type": "string" }, - "ssl_ports": { + "message": { + "type": "string" + } + } + }, + "domain.ChatSearchResp": { + "type": "object", + "properties": { + "node_result": { "type": "array", "items": { - "type": "integer" + "$ref": "#/definitions/domain.NodeContentChunkSSE" } } } }, - "domain.CreateModelReq": { + "domain.CommentInfo": { "type": "object", - "required": [ - "base_url", - "model", - "provider", - "type" - ], "properties": { - "api_header": { - "type": "string" + "auth_user_id": { + "type": "integer" }, - "api_key": { + "avatar": { + "description": "avatar", "type": "string" }, - "api_version": { - "description": "for azure openai", + "email": { "type": "string" }, - "base_url": { + "remote_ip": { "type": "string" }, - "model": { + "user_name": { "type": "string" - }, - "parameters": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelParam" - }, - "provider": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelProvider" - }, - "type": { - "enum": [ - "chat", - "embedding", - "rerank", - "analysis", - "analysis-vl" - ], - "allOf": [ - { - "$ref": "#/definitions/domain.ModelType" - } - ] } } }, - "domain.CreateNodeReq": { + "domain.CommentListItem": { "type": "object", - "required": [ - "kb_id", - "name", - "type" - ], "properties": { "content": { "type": "string" }, - "emoji": { + "created_at": { "type": "string" }, - "kb_id": { + "id": { "type": "string" }, - "name": { + "info": { + "$ref": "#/definitions/domain.CommentInfo" + }, + "ip_address": { + "description": "ip地址", + "allOf": [ + { + "$ref": "#/definitions/domain.IPAddress" + } + ] + }, + "node_id": { "type": "string" }, - "parent_id": { + "node_name": { + "description": "文档标题", "type": "string" }, - "position": { - "type": "number" + "node_type": { + "type": "integer" }, - "summary": { + "root_id": { "type": "string" }, - "type": { - "enum": [ - 1, - 2 - ], + "status": { + "description": "status : -1 reject 0 pending 1 accept", "allOf": [ { - "$ref": "#/definitions/domain.NodeType" + "$ref": "#/definitions/domain.CommentStatus" } ] } } }, - "domain.DirDocConfig": { + "domain.CommentReq": { "type": "object", + "required": [ + "content", + "node_id", + "pic_urls" + ], "properties": { - "bg_color": { + "captcha_token": { "type": "string" }, - "title": { + "content": { "type": "string" }, - "title_color": { + "node_id": { + "type": "string" + }, + "parent_id": { + "type": "string" + }, + "pic_urls": { + "type": "array", + "items": { + "type": "string" + } + }, + "root_id": { + "type": "string" + }, + "user_name": { "type": "string" } } }, - "domain.DisclaimerSettings": { + "domain.CommentStatus": { + "type": "integer", + "format": "int32", + "enum": [ + -1, + 0, + 1 + ], + "x-enum-varnames": [ + "CommentStatusReject", + "CommentStatusPending", + "CommentStatusAccepted" + ] + }, + "domain.CompleteReq": { "type": "object", "properties": { - "content": { + "prefix": { + "description": "For FIM (Fill in Middle) style completion", + "type": "string" + }, + "suffix": { "type": "string" } } }, - "domain.EnterpriseAuth": { + "domain.ContributeSettings": { "type": "object", "properties": { - "enabled": { + "is_enable": { "type": "boolean" } } }, - "domain.FaqConfig": { + "domain.ConversationDetailResp": { "type": "object", "properties": { - "bg_color": { + "app_id": { "type": "string" }, - "list": { + "created_at": { + "type": "string" + }, + "id": { + "type": "string" + }, + "ip_address": { + "$ref": "#/definitions/domain.IPAddress" + }, + "messages": { "type": "array", "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "link": { - "type": "string" - }, - "question": { - "type": "string" - } - } + "$ref": "#/definitions/domain.ConversationMessage" } }, - "title": { + "references": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.ConversationReference" + } + }, + "remote_ip": { "type": "string" }, - "title_color": { + "subject": { "type": "string" } } }, - "domain.FeedBackInfo": { + "domain.ConversationDistribution": { "type": "object", "properties": { - "feedback_content": { + "app_id": { "type": "string" }, - "feedback_type": { + "app_type": { + "$ref": "#/definitions/domain.AppType" + }, + "count": { + "type": "integer" + } + } + }, + "domain.ConversationInfo": { + "type": "object", + "properties": { + "user_info": { + "$ref": "#/definitions/domain.UserInfo" + } + } + }, + "domain.ConversationListItem": { + "type": "object", + "properties": { + "app_name": { "type": "string" }, - "score": { - "$ref": "#/definitions/domain.ScoreType" + "app_type": { + "$ref": "#/definitions/domain.AppType" + }, + "created_at": { + "type": "string" + }, + "feedback_info": { + "description": "用户反馈信息", + "allOf": [ + { + "$ref": "#/definitions/domain.FeedBackInfo" + } + ] + }, + "id": { + "type": "string" + }, + "info": { + "description": "用户信息", + "allOf": [ + { + "$ref": "#/definitions/domain.ConversationInfo" + } + ] + }, + "ip_address": { + "$ref": "#/definitions/domain.IPAddress" + }, + "remote_ip": { + "type": "string" + }, + "subject": { + "type": "string" } } }, - "domain.FeedbackRequest": { + "domain.ConversationMessage": { "type": "object", - "required": [ - "message_id" - ], "properties": { + "app_id": { + "type": "string" + }, + "completion_tokens": { + "type": "integer" + }, + "content": { + "type": "string" + }, "conversation_id": { "type": "string" }, - "feedback_content": { - "description": "限制内容长度", - "type": "string", - "maxLength": 200 + "created_at": { + "type": "string" }, - "message_id": { + "id": { "type": "string" }, - "score": { - "description": "-1 踩 ,0 1 赞成", + "info": { + "description": "feedbackinfo", "allOf": [ { - "$ref": "#/definitions/domain.ScoreType" + "$ref": "#/definitions/domain.FeedBackInfo" } ] }, - "type": { - "description": "内容不准确,没有帮助,.......", - "type": "string" - } - } - }, - "domain.FooterSettings": { - "type": "object", - "properties": { - "brand_desc": { + "kb_id": { "type": "string" }, - "brand_groups": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.BrandGroup" - } - }, - "brand_logo": { + "model": { "type": "string" }, - "brand_name": { + "parent_id": { + "description": "parent_id", "type": "string" }, - "corp_name": { - "type": "string" + "prompt_tokens": { + "type": "integer" }, - "footer_style": { - "type": "string" + "provider": { + "description": "model", + "allOf": [ + { + "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelProvider" + } + ] }, - "icp": { + "remote_ip": { + "description": "stats", "type": "string" - } - } - }, - "domain.GetKBReleaseListResp": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.KBReleaseListItemResp" - } }, - "total": { + "role": { + "$ref": "#/definitions/schema.RoleType" + }, + "total_tokens": { "type": "integer" } } }, - "domain.GetProviderModelListReq": { + "domain.ConversationMessageListItem": { "type": "object", - "required": [ - "base_url", - "provider", - "type" - ], "properties": { - "api_header": { + "app_id": { "type": "string" }, - "api_key": { + "app_type": { + "$ref": "#/definitions/domain.AppType" + }, + "conversation_id": { "type": "string" }, - "base_url": { + "conversation_info": { + "description": "userInfo", + "allOf": [ + { + "$ref": "#/definitions/domain.ConversationInfo" + } + ] + }, + "created_at": { "type": "string" }, - "provider": { + "id": { "type": "string" }, - "type": { - "enum": [ - "chat", - "embedding", - "rerank", - "analysis", - "analysis-vl" - ], + "info": { + "description": "feedbackInfo", "allOf": [ { - "$ref": "#/definitions/domain.ModelType" + "$ref": "#/definitions/domain.FeedBackInfo" } ] - } - } - }, - "domain.GetProviderModelListResp": { - "type": "object", - "properties": { - "models": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.ProviderModelListItem" - } - } - } - }, - "domain.HotBrowser": { - "type": "object", - "properties": { - "browser": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.BrowserCount" - } - }, - "os": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.BrowserCount" - } - } - } - }, - "domain.HotPage": { - "type": "object", - "properties": { - "count": { - "type": "integer" }, - "node_id": { - "type": "string" + "ip_address": { + "$ref": "#/definitions/domain.IPAddress" }, - "node_name": { + "question": { "type": "string" }, - "scene": { - "$ref": "#/definitions/domain.StatPageScene" - } - } - }, - "domain.HotRefererHost": { - "type": "object", - "properties": { - "count": { - "type": "integer" - }, - "referer_host": { + "remote_ip": { + "description": "stats", "type": "string" } } }, - "domain.IPAddress": { + "domain.ConversationReference": { "type": "object", "properties": { - "city": { + "app_id": { "type": "string" }, - "country": { + "conversation_id": { "type": "string" }, - "ip": { + "name": { "type": "string" }, - "province": { + "node_id": { "type": "string" - } - } - }, - "domain.InstantCountResp": { - "type": "object", - "properties": { - "count": { - "type": "integer" }, - "time": { + "url": { "type": "string" } } }, - "domain.InstantPageResp": { + "domain.CreateKBReleaseReq": { "type": "object", + "required": [ + "kb_id", + "message", + "tag" + ], "properties": { - "created_at": { + "kb_id": { "type": "string" }, - "info": { - "$ref": "#/definitions/domain.AuthUserInfo" - }, - "ip": { + "message": { "type": "string" }, - "ip_address": { - "$ref": "#/definitions/domain.IPAddress" - }, - "node_id": { - "type": "string" + "node_ids": { + "description": "create release after these nodes published", + "type": "array", + "items": { + "type": "string" + } }, - "node_name": { + "tag": { "type": "string" - }, - "scene": { - "$ref": "#/definitions/domain.StatPageScene" - }, - "user_id": { - "type": "integer" } } }, - "domain.KBReleaseListItemResp": { + "domain.CreateKnowledgeBaseReq": { "type": "object", + "required": [ + "name" + ], "properties": { - "created_at": { - "type": "string" + "hosts": { + "type": "array", + "items": { + "type": "string" + } }, - "id": { + "name": { "type": "string" }, - "kb_id": { - "type": "string" + "ports": { + "type": "array", + "items": { + "type": "integer" + } }, - "message": { + "private_key": { "type": "string" }, - "tag": { + "public_key": { "type": "string" + }, + "ssl_ports": { + "type": "array", + "items": { + "type": "integer" + } } } }, - "domain.KnowledgeBaseDetail": { + "domain.CreateModelReq": { "type": "object", + "required": [ + "base_url", + "model", + "provider", + "type" + ], "properties": { - "access_settings": { - "$ref": "#/definitions/domain.AccessSettings" + "api_header": { + "type": "string" }, - "created_at": { + "api_key": { "type": "string" }, - "dataset_id": { + "api_version": { + "description": "for azure openai", "type": "string" }, - "id": { + "base_url": { "type": "string" }, - "name": { + "model": { "type": "string" }, - "perm": { - "description": "用户对知识库的权限", + "parameters": { + "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelParam" + }, + "provider": { + "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelProvider" + }, + "type": { + "enum": [ + "chat", + "embedding", + "rerank", + "analysis", + "analysis-vl" + ], "allOf": [ { - "$ref": "#/definitions/consts.UserKBPermission" + "$ref": "#/definitions/domain.ModelType" } ] - }, - "updated_at": { - "type": "string" } } }, - "domain.KnowledgeBaseListItem": { + "domain.CreateNodeReq": { "type": "object", + "required": [ + "kb_id", + "name", + "type" + ], "properties": { - "access_settings": { - "$ref": "#/definitions/domain.AccessSettings" - }, - "created_at": { + "content": { "type": "string" }, - "dataset_id": { + "emoji": { "type": "string" }, - "id": { + "kb_id": { "type": "string" }, "name": { "type": "string" }, - "updated_at": { + "parent_id": { + "type": "string" + }, + "position": { + "type": "number" + }, + "summary": { "type": "string" + }, + "type": { + "enum": [ + 1, + 2 + ], + "allOf": [ + { + "$ref": "#/definitions/domain.NodeType" + } + ] } } }, - "domain.LarkBotSettings": { + "domain.DirDocConfig": { "type": "object", "properties": { - "app_id": { - "type": "string" - }, - "app_secret": { + "bg_color": { "type": "string" }, - "encrypt_key": { + "title": { "type": "string" }, - "is_enabled": { - "type": "boolean" - }, - "verify_token": { + "title_color": { "type": "string" } } }, - "domain.Link": { + "domain.DisclaimerSettings": { "type": "object", "properties": { - "name": { - "type": "string" - }, - "url": { + "content": { "type": "string" } } }, - "domain.MessageFrom": { - "type": "integer", - "enum": [ - 1, - 2 - ], - "x-enum-varnames": [ - "MessageFromGroup", - "MessageFromPrivate" - ] - }, - "domain.ModelType": { - "type": "string", - "enum": [ - "chat", - "embedding", - "rerank", - "analysis", - "analysis-vl" - ], - "x-enum-varnames": [ - "ModelTypeChat", - "ModelTypeEmbedding", - "ModelTypeRerank", - "ModelTypeAnalysis", - "ModelTypeAnalysisVL" - ] - }, - "domain.MoveNodeReq": { + "domain.EnterpriseAuth": { "type": "object", - "required": [ - "id", - "kb_id" - ], "properties": { - "id": { - "type": "string" - }, - "kb_id": { - "type": "string" - }, - "next_id": { - "type": "string" - }, - "parent_id": { - "type": "string" - }, - "prev_id": { - "type": "string" + "enabled": { + "type": "boolean" } } }, - "domain.NodeActionReq": { + "domain.FaqConfig": { "type": "object", - "required": [ - "action", - "ids", - "kb_id" - ], "properties": { - "action": { - "type": "string", - "enum": [ - "delete" - ] + "bg_color": { + "type": "string" }, - "ids": { + "list": { "type": "array", "items": { - "type": "string" + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "link": { + "type": "string" + }, + "question": { + "type": "string" + } + } } }, - "kb_id": { + "title": { + "type": "string" + }, + "title_color": { "type": "string" } } }, - "domain.NodeContentChunkSSE": { + "domain.FeedBackInfo": { "type": "object", "properties": { - "emoji": { - "type": "string" - }, - "name": { + "feedback_content": { "type": "string" }, - "node_id": { + "feedback_type": { "type": "string" }, - "summary": { - "type": "string" + "score": { + "$ref": "#/definitions/domain.ScoreType" } } }, - "domain.NodeGroupDetail": { + "domain.FeedbackRequest": { "type": "object", + "required": [ + "message_id" + ], "properties": { - "auth_group_id": { - "type": "integer" + "conversation_id": { + "type": "string" }, - "auth_ids": { - "type": "array", - "items": { - "type": "integer" - } + "feedback_content": { + "description": "限制内容长度", + "type": "string", + "maxLength": 200 }, - "kb_id": { + "message_id": { "type": "string" }, - "name": { - "type": "string" + "score": { + "description": "-1 踩 ,0 1 赞成", + "allOf": [ + { + "$ref": "#/definitions/domain.ScoreType" + } + ] }, - "node_id": { + "type": { + "description": "内容不准确,没有帮助,.......", "type": "string" - }, - "perm": { - "$ref": "#/definitions/consts.NodePermName" } } }, - "domain.NodeListItemResp": { + "domain.FooterSettings": { "type": "object", "properties": { - "created_at": { - "type": "string" - }, - "creator": { - "type": "string" - }, - "creator_id": { - "type": "string" - }, - "editor": { - "type": "string" - }, - "editor_id": { - "type": "string" - }, - "emoji": { - "type": "string" - }, - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "parent_id": { + "brand_desc": { "type": "string" }, - "permissions": { - "$ref": "#/definitions/domain.NodePermissions" + "brand_groups": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.BrandGroup" + } }, - "position": { - "type": "number" + "brand_logo": { + "type": "string" }, - "status": { - "$ref": "#/definitions/domain.NodeStatus" + "brand_name": { + "type": "string" }, - "summary": { + "corp_name": { "type": "string" }, - "type": { - "$ref": "#/definitions/domain.NodeType" + "footer_style": { + "type": "string" }, - "updated_at": { + "icp": { "type": "string" } } }, - "domain.NodeMeta": { + "domain.GetKBReleaseListResp": { "type": "object", "properties": { - "emoji": { - "type": "string" + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.KBReleaseListItemResp" + } }, - "summary": { - "type": "string" + "total": { + "type": "integer" } } }, - "domain.NodePermissions": { + "domain.GetProviderModelListReq": { "type": "object", + "required": [ + "base_url", + "provider", + "type" + ], "properties": { - "answerable": { - "description": "可被问答", - "allOf": [ - { - "$ref": "#/definitions/consts.NodeAccessPerm" - } - ] + "api_header": { + "type": "string" }, - "visible": { - "description": "导航内可见", - "allOf": [ - { - "$ref": "#/definitions/consts.NodeAccessPerm" - } - ] + "api_key": { + "type": "string" }, - "visitable": { - "description": "可被访问", + "base_url": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "type": { + "enum": [ + "chat", + "embedding", + "rerank", + "analysis", + "analysis-vl" + ], "allOf": [ { - "$ref": "#/definitions/consts.NodeAccessPerm" + "$ref": "#/definitions/domain.ModelType" } ] } } }, - "domain.NodeStatus": { - "type": "integer", - "format": "int32", - "enum": [ - 1, - 2 - ], - "x-enum-varnames": [ - "NodeStatusDraft", - "NodeStatusReleased" - ] + "domain.GetProviderModelListResp": { + "type": "object", + "properties": { + "models": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.ProviderModelListItem" + } + } + } }, - "domain.NodeSummaryReq": { + "domain.HotBrowser": { "type": "object", - "required": [ - "ids", - "kb_id" - ], "properties": { - "ids": { + "browser": { "type": "array", "items": { - "type": "string" + "$ref": "#/definitions/domain.BrowserCount" } }, - "kb_id": { - "type": "string" + "os": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.BrowserCount" + } } } }, - "domain.NodeType": { - "type": "integer", - "format": "int32", - "enum": [ - 1, - 2 - ], - "x-enum-varnames": [ - "NodeTypeFolder", - "NodeTypeDocument" - ] - }, - "domain.ObjectUploadResp": { + "domain.HotPage": { "type": "object", "properties": { - "filename": { + "count": { + "type": "integer" + }, + "node_id": { "type": "string" }, - "key": { + "node_name": { "type": "string" + }, + "scene": { + "$ref": "#/definitions/domain.StatPageScene" } } }, - "domain.OpenAIAPIBotSettings": { + "domain.HotRefererHost": { "type": "object", "properties": { - "is_enabled": { - "type": "boolean" + "count": { + "type": "integer" }, - "secret_key": { + "referer_host": { "type": "string" } } }, - "domain.OpenAIChoice": { + "domain.IPAddress": { "type": "object", "properties": { - "delta": { - "description": "for streaming", - "allOf": [ - { - "$ref": "#/definitions/domain.OpenAIMessage" - } - ] + "city": { + "type": "string" }, - "finish_reason": { + "country": { "type": "string" }, - "index": { - "type": "integer" + "ip": { + "type": "string" }, - "message": { - "$ref": "#/definitions/domain.OpenAIMessage" + "province": { + "type": "string" } } }, - "domain.OpenAICompletionsRequest": { + "domain.InstantCountResp": { "type": "object", - "required": [ - "messages", - "model" - ], "properties": { - "frequency_penalty": { - "type": "number" - }, - "max_tokens": { + "count": { "type": "integer" }, - "messages": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.OpenAIMessage" - } + "time": { + "type": "string" + } + } + }, + "domain.InstantPageResp": { + "type": "object", + "properties": { + "created_at": { + "type": "string" }, - "model": { + "info": { + "$ref": "#/definitions/domain.AuthUserInfo" + }, + "ip": { "type": "string" }, - "presence_penalty": { - "type": "number" + "ip_address": { + "$ref": "#/definitions/domain.IPAddress" }, - "response_format": { - "$ref": "#/definitions/domain.OpenAIResponseFormat" + "node_id": { + "type": "string" }, - "stop": { - "type": "array", - "items": { - "type": "string" - } + "node_name": { + "type": "string" }, - "stream": { - "type": "boolean" + "scene": { + "$ref": "#/definitions/domain.StatPageScene" }, - "temperature": { - "type": "number" + "user_id": { + "type": "integer" + } + } + }, + "domain.KBReleaseListItemResp": { + "type": "object", + "properties": { + "created_at": { + "type": "string" }, - "tool_choice": { - "$ref": "#/definitions/domain.OpenAIToolChoice" + "id": { + "type": "string" }, - "tools": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.OpenAITool" - } + "kb_id": { + "type": "string" }, - "top_p": { - "type": "number" + "message": { + "type": "string" }, - "user": { + "tag": { "type": "string" } } }, - "domain.OpenAICompletionsResponse": { + "domain.KnowledgeBaseDetail": { "type": "object", "properties": { - "choices": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.OpenAIChoice" - } + "access_settings": { + "$ref": "#/definitions/domain.AccessSettings" + }, + "created_at": { + "type": "string" }, - "created": { - "type": "integer" + "dataset_id": { + "type": "string" }, "id": { "type": "string" }, - "model": { + "name": { "type": "string" }, - "object": { - "type": "string" + "perm": { + "description": "用户对知识库的权限", + "allOf": [ + { + "$ref": "#/definitions/consts.UserKBPermission" + } + ] }, - "usage": { - "$ref": "#/definitions/domain.OpenAIUsage" + "updated_at": { + "type": "string" } } }, - "domain.OpenAIError": { + "domain.KnowledgeBaseListItem": { "type": "object", "properties": { - "code": { + "access_settings": { + "$ref": "#/definitions/domain.AccessSettings" + }, + "created_at": { "type": "string" }, - "message": { + "dataset_id": { "type": "string" }, - "param": { + "id": { "type": "string" }, - "type": { + "name": { + "type": "string" + }, + "updated_at": { "type": "string" } } }, - "domain.OpenAIErrorResponse": { - "type": "object", - "properties": { - "error": { - "$ref": "#/definitions/domain.OpenAIError" - } - } - }, - "domain.OpenAIFunction": { + "domain.LarkBotSettings": { "type": "object", - "required": [ - "name" - ], "properties": { - "description": { + "app_id": { "type": "string" }, - "name": { + "app_secret": { "type": "string" }, - "parameters": { - "type": "object", - "additionalProperties": true - } - } - }, - "domain.OpenAIFunctionCall": { - "type": "object", - "required": [ - "arguments", - "name" - ], - "properties": { - "arguments": { + "encrypt_key": { "type": "string" }, - "name": { + "is_enabled": { + "type": "boolean" + }, + "verify_token": { "type": "string" } } }, - "domain.OpenAIFunctionChoice": { + "domain.Link": { "type": "object", - "required": [ - "name" - ], "properties": { "name": { "type": "string" + }, + "url": { + "type": "string" } } }, - "domain.OpenAIMessage": { + "domain.MessageFrom": { + "type": "integer", + "enum": [ + 1, + 2 + ], + "x-enum-varnames": [ + "MessageFromGroup", + "MessageFromPrivate" + ] + }, + "domain.ModelType": { + "type": "string", + "enum": [ + "chat", + "embedding", + "rerank", + "analysis", + "analysis-vl" + ], + "x-enum-varnames": [ + "ModelTypeChat", + "ModelTypeEmbedding", + "ModelTypeRerank", + "ModelTypeAnalysis", + "ModelTypeAnalysisVL" + ] + }, + "domain.MoveNodeReq": { "type": "object", "required": [ - "role" + "id", + "kb_id" ], "properties": { - "content": { + "id": { "type": "string" }, - "name": { + "kb_id": { "type": "string" }, - "role": { + "next_id": { "type": "string" }, - "tool_call_id": { + "parent_id": { "type": "string" }, - "tool_calls": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.OpenAIToolCall" - } - } - } - }, - "domain.OpenAIResponseFormat": { - "type": "object", - "required": [ - "type" - ], - "properties": { - "type": { + "prev_id": { "type": "string" } } }, - "domain.OpenAITool": { + "domain.NodeActionReq": { "type": "object", "required": [ - "type" + "action", + "ids", + "kb_id" ], "properties": { - "function": { - "$ref": "#/definitions/domain.OpenAIFunction" + "action": { + "type": "string", + "enum": [ + "delete" + ] }, - "type": { + "ids": { + "type": "array", + "items": { + "type": "string" + } + }, + "kb_id": { "type": "string" } } }, - "domain.OpenAIToolCall": { + "domain.NodeContentChunkSSE": { "type": "object", - "required": [ - "function", - "id", - "type" - ], "properties": { - "function": { - "$ref": "#/definitions/domain.OpenAIFunctionCall" + "emoji": { + "type": "string" }, - "id": { + "name": { "type": "string" }, - "type": { + "node_id": { "type": "string" - } - } - }, - "domain.OpenAIToolChoice": { - "type": "object", - "properties": { - "function": { - "$ref": "#/definitions/domain.OpenAIFunctionChoice" }, - "type": { + "summary": { "type": "string" } } }, - "domain.OpenAIUsage": { + "domain.NodeGroupDetail": { "type": "object", "properties": { - "completion_tokens": { + "auth_group_id": { "type": "integer" }, - "prompt_tokens": { - "type": "integer" + "auth_ids": { + "type": "array", + "items": { + "type": "integer" + } }, - "total_tokens": { - "type": "integer" - } - } - }, - "domain.PWResponse": { - "type": "object", - "properties": { - "code": { - "type": "integer" + "kb_id": { + "type": "string" }, - "data": {}, - "message": { + "name": { "type": "string" }, - "success": { - "type": "boolean" - } - } - }, - "domain.PaginatedResult-array_domain_ConversationMessageListItem": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.ConversationMessageListItem" - } + "node_id": { + "type": "string" }, - "total": { - "type": "integer" + "perm": { + "$ref": "#/definitions/consts.NodePermName" } } }, - "domain.ProviderModelListItem": { + "domain.NodeListItemResp": { "type": "object", "properties": { - "model": { + "created_at": { "type": "string" - } - } - }, - "domain.RecommendNodeListResp": { - "type": "object", - "properties": { + }, + "creator": { + "type": "string" + }, + "creator_id": { + "type": "string" + }, + "editor": { + "type": "string" + }, + "editor_id": { + "type": "string" + }, "emoji": { "type": "string" }, @@ -7389,1351 +6109,1338 @@ "position": { "type": "number" }, - "recommend_nodes": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.RecommendNodeListResp" - } + "status": { + "$ref": "#/definitions/domain.NodeStatus" }, "summary": { "type": "string" }, "type": { "$ref": "#/definitions/domain.NodeType" + }, + "updated_at": { + "type": "string" } } }, - "domain.Response": { + "domain.NodeMeta": { "type": "object", "properties": { - "data": {}, - "message": { + "emoji": { "type": "string" }, - "success": { - "type": "boolean" + "summary": { + "type": "string" } } }, - "domain.ScoreType": { - "type": "integer", - "enum": [ - 1, - -1 - ], - "x-enum-varnames": [ - "Like", - "DisLike" - ] - }, - "domain.ShareCommentListItem": { + "domain.NodePermissions": { "type": "object", "properties": { - "content": { - "type": "string" - }, - "created_at": { - "type": "string" - }, - "id": { - "type": "string" - }, - "info": { - "$ref": "#/definitions/domain.CommentInfo" - }, - "ip_address": { - "description": "ip地址", + "answerable": { + "description": "可被问答", "allOf": [ { - "$ref": "#/definitions/domain.IPAddress" + "$ref": "#/definitions/consts.NodeAccessPerm" } ] }, - "kb_id": { - "type": "string" - }, - "node_id": { - "type": "string" - }, - "parent_id": { - "type": "string" - }, - "pic_urls": { - "type": "array", - "items": { - "type": "string" - } + "visible": { + "description": "导航内可见", + "allOf": [ + { + "$ref": "#/definitions/consts.NodeAccessPerm" + } + ] }, - "root_id": { - "type": "string" + "visitable": { + "description": "可被访问", + "allOf": [ + { + "$ref": "#/definitions/consts.NodeAccessPerm" + } + ] } } }, - "domain.ShareConversationDetailResp": { + "domain.NodeStatus": { + "type": "integer", + "format": "int32", + "enum": [ + 1, + 2 + ], + "x-enum-varnames": [ + "NodeStatusDraft", + "NodeStatusReleased" + ] + }, + "domain.NodeSummaryReq": { "type": "object", + "required": [ + "ids", + "kb_id" + ], "properties": { - "created_at": { - "type": "string" - }, - "id": { - "type": "string" - }, - "messages": { + "ids": { "type": "array", "items": { - "$ref": "#/definitions/domain.ShareConversationMessage" + "type": "string" } }, - "subject": { + "kb_id": { "type": "string" } } }, - "domain.ShareConversationMessage": { + "domain.NodeType": { + "type": "integer", + "format": "int32", + "enum": [ + 1, + 2 + ], + "x-enum-varnames": [ + "NodeTypeFolder", + "NodeTypeDocument" + ] + }, + "domain.ObjectUploadResp": { "type": "object", "properties": { - "content": { + "filename": { "type": "string" }, - "created_at": { + "key": { "type": "string" - }, - "role": { - "$ref": "#/definitions/schema.RoleType" } } }, - "domain.SimpleAuth": { + "domain.OpenAIAPIBotSettings": { "type": "object", "properties": { - "enabled": { + "is_enabled": { "type": "boolean" }, - "password": { + "secret_key": { "type": "string" } } }, - "domain.SimpleDocConfig": { + "domain.OpenAIChoice": { "type": "object", "properties": { - "bg_color": { - "type": "string" + "delta": { + "description": "for streaming", + "allOf": [ + { + "$ref": "#/definitions/domain.OpenAIMessage" + } + ] }, - "title": { + "finish_reason": { "type": "string" }, - "title_color": { - "type": "string" + "index": { + "type": "integer" + }, + "message": { + "$ref": "#/definitions/domain.OpenAIMessage" } } }, - "domain.SocialMediaAccount": { + "domain.OpenAICompletionsRequest": { "type": "object", + "required": [ + "messages", + "model" + ], "properties": { - "channel": { - "type": "string" + "frequency_penalty": { + "type": "number" }, - "icon": { - "type": "string" + "max_tokens": { + "type": "integer" }, - "link": { - "type": "string" + "messages": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.OpenAIMessage" + } }, - "phone": { + "model": { "type": "string" }, - "text": { - "type": "string" - } - } - }, - "domain.StatPageReq": { - "type": "object", - "required": [ - "scene" - ], - "properties": { - "node_id": { - "type": "string" + "presence_penalty": { + "type": "number" }, - "scene": { - "enum": [ - 1, - 2, - 3, - 4 - ], - "allOf": [ - { - "$ref": "#/definitions/domain.StatPageScene" - } - ] + "response_format": { + "$ref": "#/definitions/domain.OpenAIResponseFormat" + }, + "stop": { + "type": "array", + "items": { + "type": "string" + } + }, + "stream": { + "type": "boolean" + }, + "temperature": { + "type": "number" + }, + "tool_choice": { + "$ref": "#/definitions/domain.OpenAIToolChoice" + }, + "tools": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.OpenAITool" + } + }, + "top_p": { + "type": "number" + }, + "user": { + "type": "string" } } }, - "domain.StatPageScene": { - "type": "integer", - "enum": [ - 1, - 2, - 3, - 4 - ], - "x-enum-varnames": [ - "StatPageSceneWelcome", - "StatPageSceneNodeDetail", - "StatPageSceneChat", - "StatPageSceneLogin" - ] - }, - "domain.TextReq": { + "domain.OpenAICompletionsResponse": { "type": "object", - "required": [ - "text" - ], "properties": { - "action": { - "description": "action: improve, summary, extend, shorten, etc.", + "choices": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.OpenAIChoice" + } + }, + "created": { + "type": "integer" + }, + "id": { "type": "string" }, - "text": { + "model": { + "type": "string" + }, + "object": { "type": "string" + }, + "usage": { + "$ref": "#/definitions/domain.OpenAIUsage" } } }, - "domain.ThemeAndStyle": { + "domain.OpenAIError": { "type": "object", "properties": { - "bg_image": { + "code": { "type": "string" }, - "doc_width": { + "message": { + "type": "string" + }, + "param": { + "type": "string" + }, + "type": { "type": "string" } } }, - "domain.UpdateAppReq": { + "domain.OpenAIErrorResponse": { "type": "object", "properties": { - "kb_id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "settings": { - "$ref": "#/definitions/domain.AppSettings" + "error": { + "$ref": "#/definitions/domain.OpenAIError" } } }, - "domain.UpdateKnowledgeBaseReq": { + "domain.OpenAIFunction": { "type": "object", "required": [ - "id" + "name" ], "properties": { - "access_settings": { - "$ref": "#/definitions/domain.AccessSettings" - }, - "id": { + "description": { "type": "string" }, "name": { "type": "string" + }, + "parameters": { + "type": "object", + "additionalProperties": true } } }, - "domain.UpdateModelReq": { + "domain.OpenAIFunctionCall": { "type": "object", "required": [ - "base_url", - "id", - "model", - "provider", - "type" + "arguments", + "name" ], "properties": { - "api_header": { - "type": "string" - }, - "api_key": { - "type": "string" - }, - "api_version": { - "description": "for azure openai", - "type": "string" - }, - "base_url": { - "type": "string" - }, - "id": { + "arguments": { "type": "string" }, - "is_active": { - "type": "boolean" - }, - "model": { + "name": { "type": "string" - }, - "parameters": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelParam" - }, - "provider": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelProvider" - }, - "type": { - "enum": [ - "chat", - "embedding", - "rerank", - "analysis", - "analysis-vl" - ], - "allOf": [ - { - "$ref": "#/definitions/domain.ModelType" - } - ] } } }, - "domain.UpdateNodeReq": { + "domain.OpenAIFunctionChoice": { "type": "object", "required": [ - "id", - "kb_id" + "name" ], "properties": { - "content": { - "type": "string" - }, - "emoji": { - "type": "string" - }, - "id": { - "type": "string" - }, - "kb_id": { - "type": "string" - }, "name": { "type": "string" - }, - "position": { - "type": "number" - }, - "summary": { - "type": "string" } } }, - "domain.UserInfo": { + "domain.OpenAIMessage": { "type": "object", + "required": [ + "role" + ], "properties": { - "auth_user_id": { - "type": "integer" - }, - "avatar": { - "description": "avatar", - "type": "string" - }, - "email": { + "content": { "type": "string" }, - "from": { - "$ref": "#/definitions/domain.MessageFrom" - }, "name": { "type": "string" }, - "real_name": { + "role": { "type": "string" }, - "user_id": { + "tool_call_id": { "type": "string" - } - } - }, - "domain.WebAppCommentSettings": { - "type": "object", - "properties": { - "is_enable": { - "type": "boolean" }, - "moderation_enable": { - "type": "boolean" + "tool_calls": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.OpenAIToolCall" + } } } }, - "domain.WebAppCustomSettings": { + "domain.OpenAIResponseFormat": { "type": "object", + "required": [ + "type" + ], "properties": { - "allow_theme_switching": { - "type": "boolean" - }, - "footer_show_intro": { - "type": "boolean" - }, - "header_search_placeholder": { + "type": { "type": "string" - }, - "show_brand_info": { - "type": "boolean" - }, - "social_media_accounts": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.SocialMediaAccount" - } } } }, - "domain.WebAppLandingConfig": { + "domain.OpenAITool": { "type": "object", + "required": [ + "type" + ], "properties": { - "banner_config": { - "$ref": "#/definitions/domain.BannerConfig" - }, - "basic_doc_config": { - "$ref": "#/definitions/domain.BasicDocConfig" - }, - "carousel_config": { - "$ref": "#/definitions/domain.CarouselConfig" - }, - "com_config_order": { - "type": "array", - "items": { - "type": "string" - } - }, - "dir_doc_config": { - "$ref": "#/definitions/domain.DirDocConfig" - }, - "faq_config": { - "$ref": "#/definitions/domain.FaqConfig" - }, - "node_ids": { - "type": "array", - "items": { - "type": "string" - } - }, - "simple_doc_config": { - "$ref": "#/definitions/domain.SimpleDocConfig" + "function": { + "$ref": "#/definitions/domain.OpenAIFunction" }, "type": { "type": "string" } } }, - "domain.WebAppLandingConfigResp": { + "domain.OpenAIToolCall": { "type": "object", - "properties": { - "banner_config": { - "$ref": "#/definitions/domain.BannerConfig" - }, - "basic_doc_config": { - "$ref": "#/definitions/domain.BasicDocConfig" - }, - "carousel_config": { - "$ref": "#/definitions/domain.CarouselConfig" - }, - "com_config_order": { - "type": "array", - "items": { - "type": "string" - } - }, - "dir_doc_config": { - "$ref": "#/definitions/domain.DirDocConfig" - }, - "faq_config": { - "$ref": "#/definitions/domain.FaqConfig" - }, - "node_ids": { - "type": "array", - "items": { - "type": "string" - } - }, - "nodes": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.RecommendNodeListResp" - } + "required": [ + "function", + "id", + "type" + ], + "properties": { + "function": { + "$ref": "#/definitions/domain.OpenAIFunctionCall" }, - "simple_doc_config": { - "$ref": "#/definitions/domain.SimpleDocConfig" + "id": { + "type": "string" }, "type": { "type": "string" } } }, - "domain.WecomAIBotSettings": { + "domain.OpenAIToolChoice": { "type": "object", "properties": { - "encodingaeskey": { + "function": { + "$ref": "#/definitions/domain.OpenAIFunctionChoice" + }, + "type": { "type": "string" + } + } + }, + "domain.OpenAIUsage": { + "type": "object", + "properties": { + "completion_tokens": { + "type": "integer" }, - "is_enabled": { - "type": "boolean" + "prompt_tokens": { + "type": "integer" }, - "token": { - "type": "string" + "total_tokens": { + "type": "integer" } } }, - "domain.WidgetBotSettings": { + "domain.PWResponse": { "type": "object", "properties": { - "btn_logo": { - "type": "string" + "code": { + "type": "integer" }, - "btn_text": { + "data": {}, + "message": { "type": "string" }, - "is_open": { + "success": { "type": "boolean" - }, - "theme_mode": { - "type": "string" } } }, - "github_com_chaitin_panda-wiki_api_auth_v1.AuthGetResp": { + "domain.PaginatedResult-array_domain_ConversationMessageListItem": { "type": "object", "properties": { - "auths": { + "data": { "type": "array", "items": { - "$ref": "#/definitions/v1.AuthItem" + "$ref": "#/definitions/domain.ConversationMessageListItem" } }, - "client_id": { - "type": "string" - }, - "client_secret": { - "type": "string" - }, - "proxy": { - "type": "string" - }, - "source_type": { - "$ref": "#/definitions/consts.SourceType" + "total": { + "type": "integer" } } }, - "github_com_chaitin_panda-wiki_api_share_v1.AuthGetResp": { + "domain.ProviderModelListItem": { "type": "object", "properties": { - "auth_type": { - "$ref": "#/definitions/consts.AuthType" - }, - "license_edition": { - "$ref": "#/definitions/consts.LicenseEdition" - }, - "source_type": { - "$ref": "#/definitions/consts.SourceType" + "model": { + "type": "string" } } }, - "github_com_chaitin_panda-wiki_api_share_v1.GitHubCallbackResp": { - "type": "object" - }, - "github_com_chaitin_panda-wiki_domain.CheckModelReq": { + "domain.RecommendNodeListResp": { "type": "object", - "required": [ - "base_url", - "model", - "provider", - "type" - ], "properties": { - "api_header": { + "emoji": { "type": "string" }, - "api_key": { + "id": { "type": "string" }, - "api_version": { - "description": "for azure openai", + "name": { "type": "string" }, - "base_url": { + "parent_id": { "type": "string" }, - "model": { - "type": "string" + "permissions": { + "$ref": "#/definitions/domain.NodePermissions" }, - "parameters": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelParam" + "position": { + "type": "number" }, - "provider": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelProvider" + "recommend_nodes": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.RecommendNodeListResp" + } + }, + "summary": { + "type": "string" }, "type": { - "enum": [ - "chat", - "embedding", - "rerank", - "analysis", - "analysis-vl" - ], - "allOf": [ - { - "$ref": "#/definitions/domain.ModelType" - } - ] + "$ref": "#/definitions/domain.NodeType" } } }, - "github_com_chaitin_panda-wiki_domain.CheckModelResp": { + "domain.Response": { "type": "object", "properties": { - "content": { + "data": {}, + "message": { "type": "string" }, - "error": { - "type": "string" + "success": { + "type": "boolean" } } }, - "github_com_chaitin_panda-wiki_domain.ModelListItem": { + "domain.ScoreType": { + "type": "integer", + "enum": [ + 1, + -1 + ], + "x-enum-varnames": [ + "Like", + "DisLike" + ] + }, + "domain.ShareCommentListItem": { "type": "object", "properties": { - "api_header": { + "content": { "type": "string" }, - "api_key": { + "created_at": { "type": "string" }, - "api_version": { - "description": "for azure openai", + "id": { "type": "string" }, - "base_url": { - "type": "string" + "info": { + "$ref": "#/definitions/domain.CommentInfo" }, - "completion_tokens": { - "type": "integer" + "ip_address": { + "description": "ip地址", + "allOf": [ + { + "$ref": "#/definitions/domain.IPAddress" + } + ] }, - "id": { + "kb_id": { "type": "string" }, - "is_active": { - "type": "boolean" - }, - "model": { + "node_id": { "type": "string" }, - "parameters": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelParam" - }, - "prompt_tokens": { - "type": "integer" - }, - "provider": { - "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelProvider" + "parent_id": { + "type": "string" }, - "total_tokens": { - "type": "integer" + "pic_urls": { + "type": "array", + "items": { + "type": "string" + } }, - "type": { - "$ref": "#/definitions/domain.ModelType" + "root_id": { + "type": "string" } } }, - "github_com_chaitin_panda-wiki_domain.ModelParam": { + "domain.ShareConversationDetailResp": { "type": "object", "properties": { - "context_window": { - "type": "integer" - }, - "max_tokens": { - "type": "integer" - }, - "r1_enabled": { - "type": "boolean" - }, - "support_computer_use": { - "type": "boolean" + "created_at": { + "type": "string" }, - "support_images": { - "type": "boolean" + "id": { + "type": "string" }, - "support_prompt_cache": { - "type": "boolean" + "messages": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.ShareConversationMessage" + } }, - "temperature": { - "type": "number" + "subject": { + "type": "string" } } }, - "github_com_chaitin_panda-wiki_domain.ModelProvider": { - "type": "string", - "enum": [ - "BaiZhiCloud" - ], - "x-enum-varnames": [ - "ModelProviderBrandBaiZhiCloud" - ] - }, - "gocap.ChallengeData": { + "domain.ShareConversationMessage": { "type": "object", "properties": { - "challenge": { - "$ref": "#/definitions/gocap.ChallengeItem" + "content": { + "type": "string" }, - "expires": { - "description": "过期时间,毫秒级时间戳", - "type": "integer" + "created_at": { + "type": "string" + }, + "role": { + "$ref": "#/definitions/schema.RoleType" + } + } + }, + "domain.SimpleAuth": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" }, - "token": { - "description": "质询令牌", + "password": { "type": "string" } } }, - "gocap.ChallengeItem": { + "domain.SimpleDocConfig": { "type": "object", "properties": { - "c": { - "description": "质询数量", - "type": "integer" + "bg_color": { + "type": "string" }, - "d": { - "description": "质询难度", - "type": "integer" + "title": { + "type": "string" }, - "s": { - "description": "质询大小", - "type": "integer" + "title_color": { + "type": "string" } } }, - "gocap.VerificationResult": { + "domain.SocialMediaAccount": { "type": "object", "properties": { - "expires": { - "description": "过期时间,毫秒级时间戳", - "type": "integer" + "channel": { + "type": "string" }, - "message": { + "icon": { "type": "string" }, - "success": { - "type": "boolean" + "link": { + "type": "string" }, - "token": { - "description": "验证令牌", + "phone": { + "type": "string" + }, + "text": { "type": "string" } } }, - "schema.RoleType": { - "type": "string", - "enum": [ - "assistant", - "user", - "system", - "tool" - ], - "x-enum-varnames": [ - "Assistant", - "User", - "System", - "Tool" - ] - }, - "share.ShareCommentLists": { + "domain.StatPageReq": { "type": "object", + "required": [ + "scene" + ], "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.ShareCommentListItem" - } + "node_id": { + "type": "string" }, - "total": { - "type": "integer" + "scene": { + "enum": [ + 1, + 2, + 3, + 4 + ], + "allOf": [ + { + "$ref": "#/definitions/domain.StatPageScene" + } + ] } } }, - "v1.AuthGitHubReq": { + "domain.StatPageScene": { + "type": "integer", + "enum": [ + 1, + 2, + 3, + 4 + ], + "x-enum-varnames": [ + "StatPageSceneWelcome", + "StatPageSceneNodeDetail", + "StatPageSceneChat", + "StatPageSceneLogin" + ] + }, + "domain.TextReq": { "type": "object", + "required": [ + "text" + ], "properties": { - "kb_id": { + "action": { + "description": "action: improve, summary, extend, shorten, etc.", "type": "string" }, - "redirect_url": { + "text": { "type": "string" } } }, - "v1.AuthGitHubResp": { + "domain.ThemeAndStyle": { "type": "object", "properties": { - "url": { + "bg_image": { + "type": "string" + }, + "doc_width": { "type": "string" } } }, - "v1.AuthItem": { + "domain.UpdateAppReq": { "type": "object", "properties": { - "avatar_url": { - "type": "string" - }, - "created_at": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "ip": { + "kb_id": { "type": "string" }, - "last_login_time": { + "name": { "type": "string" }, - "source_type": { - "$ref": "#/definitions/consts.SourceType" - }, - "username": { - "type": "string" + "settings": { + "$ref": "#/definitions/domain.AppSettings" } } }, - "v1.AuthLoginSimpleReq": { + "domain.UpdateKnowledgeBaseReq": { "type": "object", "required": [ - "password" + "id" ], "properties": { - "password": { + "access_settings": { + "$ref": "#/definitions/domain.AccessSettings" + }, + "id": { + "type": "string" + }, + "name": { "type": "string" } } }, - "v1.AuthSetReq": { + "domain.UpdateModelReq": { "type": "object", "required": [ - "source_type" + "base_url", + "id", + "model", + "provider", + "type" ], "properties": { - "client_id": { + "api_header": { "type": "string" }, - "client_secret": { + "api_key": { "type": "string" }, - "kb_id": { + "api_version": { + "description": "for azure openai", "type": "string" }, - "proxy": { + "base_url": { "type": "string" }, - "source_type": { + "id": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "model": { + "type": "string" + }, + "parameters": { + "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelParam" + }, + "provider": { + "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelProvider" + }, + "type": { "enum": [ - "github" + "chat", + "embedding", + "rerank", + "analysis", + "analysis-vl" ], "allOf": [ { - "$ref": "#/definitions/consts.SourceType" + "$ref": "#/definitions/domain.ModelType" } ] } } }, - "v1.CommentLists": { + "domain.UpdateNodeReq": { "type": "object", + "required": [ + "id", + "kb_id" + ], "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/definitions/domain.CommentListItem" - } + "content": { + "type": "string" + }, + "emoji": { + "type": "string" }, - "total": { - "type": "integer" - } - } - }, - "v1.ConfluenceParseItem": { - "type": "object", - "properties": { "id": { "type": "string" }, - "title": { + "kb_id": { "type": "string" }, - "url": { + "name": { "type": "string" - } - } - }, - "v1.ConfluenceParseResp": { - "type": "object", - "properties": { - "docs": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.ConfluenceParseItem" - } }, - "id": { + "position": { + "type": "number" + }, + "summary": { "type": "string" } } }, - "v1.ConfluenceScrapeReq": { + "domain.UserInfo": { "type": "object", - "required": [ - "doc_id", - "id", - "kb_id" - ], "properties": { - "doc_id": { + "auth_user_id": { + "type": "integer" + }, + "avatar": { + "description": "avatar", "type": "string" }, - "id": { + "email": { "type": "string" }, - "kb_id": { + "from": { + "$ref": "#/definitions/domain.MessageFrom" + }, + "name": { + "type": "string" + }, + "real_name": { + "type": "string" + }, + "user_id": { "type": "string" } } }, - "v1.ConfluenceScrapeResp": { + "domain.WebAppCommentSettings": { "type": "object", "properties": { - "content": { - "type": "string" + "is_enable": { + "type": "boolean" + }, + "moderation_enable": { + "type": "boolean" } } }, - "v1.ConversationListItems": { + "domain.WebAppCustomSettings": { "type": "object", "properties": { - "data": { + "allow_theme_switching": { + "type": "boolean" + }, + "footer_show_intro": { + "type": "boolean" + }, + "header_search_placeholder": { + "type": "string" + }, + "show_brand_info": { + "type": "boolean" + }, + "social_media_accounts": { "type": "array", "items": { - "$ref": "#/definitions/domain.ConversationListItem" + "$ref": "#/definitions/domain.SocialMediaAccount" } - }, - "total": { - "type": "integer" } } }, - "v1.CrawlerResultItem": { + "domain.WebAppLandingConfig": { "type": "object", "properties": { - "content": { - "type": "string" + "banner_config": { + "$ref": "#/definitions/domain.BannerConfig" }, - "status": { - "$ref": "#/definitions/consts.CrawlerStatus" + "basic_doc_config": { + "$ref": "#/definitions/domain.BasicDocConfig" }, - "task_id": { + "carousel_config": { + "$ref": "#/definitions/domain.CarouselConfig" + }, + "com_config_order": { + "type": "array", + "items": { + "type": "string" + } + }, + "dir_doc_config": { + "$ref": "#/definitions/domain.DirDocConfig" + }, + "faq_config": { + "$ref": "#/definitions/domain.FaqConfig" + }, + "node_ids": { + "type": "array", + "items": { + "type": "string" + } + }, + "simple_doc_config": { + "$ref": "#/definitions/domain.SimpleDocConfig" + }, + "type": { "type": "string" } } }, - "v1.CrawlerResultResp": { + "domain.WebAppLandingConfigResp": { "type": "object", - "required": [ - "status" - ], "properties": { - "content": { - "type": "string" + "banner_config": { + "$ref": "#/definitions/domain.BannerConfig" }, - "status": { - "$ref": "#/definitions/consts.CrawlerStatus" - } - } - }, - "v1.CrawlerResultsReq": { - "type": "object", - "required": [ - "task_ids" - ], - "properties": { - "task_ids": { + "basic_doc_config": { + "$ref": "#/definitions/domain.BasicDocConfig" + }, + "carousel_config": { + "$ref": "#/definitions/domain.CarouselConfig" + }, + "com_config_order": { "type": "array", "items": { "type": "string" } - } - } - }, - "v1.CrawlerResultsResp": { - "type": "object", - "properties": { - "list": { + }, + "dir_doc_config": { + "$ref": "#/definitions/domain.DirDocConfig" + }, + "faq_config": { + "$ref": "#/definitions/domain.FaqConfig" + }, + "node_ids": { "type": "array", "items": { - "$ref": "#/definitions/v1.CrawlerResultItem" + "type": "string" } }, - "status": { - "$ref": "#/definitions/consts.CrawlerStatus" + "nodes": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.RecommendNodeListResp" + } + }, + "simple_doc_config": { + "$ref": "#/definitions/domain.SimpleDocConfig" + }, + "type": { + "type": "string" } } }, - "v1.CreateUserReq": { + "domain.WecomAIBotSettings": { "type": "object", - "required": [ - "account", - "password", - "role" - ], "properties": { - "account": { + "encodingaeskey": { "type": "string" }, - "password": { - "type": "string", - "minLength": 8 + "is_enabled": { + "type": "boolean" }, - "role": { - "enum": [ - "admin", - "user" - ], - "allOf": [ - { - "$ref": "#/definitions/consts.UserRole" - } - ] + "token": { + "type": "string" } } }, - "v1.CreateUserResp": { + "domain.WidgetBotSettings": { "type": "object", "properties": { - "id": { + "btn_logo": { + "type": "string" + }, + "btn_text": { + "type": "string" + }, + "is_open": { + "type": "boolean" + }, + "theme_mode": { "type": "string" } } }, - "v1.EpubParseReq": { + "github_com_chaitin_panda-wiki_api_auth_v1.AuthGetResp": { "type": "object", - "required": [ - "filename", - "kb_id", - "key" - ], "properties": { - "filename": { + "auths": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.AuthItem" + } + }, + "client_id": { "type": "string" }, - "kb_id": { + "client_secret": { "type": "string" }, - "key": { + "proxy": { "type": "string" + }, + "source_type": { + "$ref": "#/definitions/consts.SourceType" } } }, - "v1.EpubParseResp": { + "github_com_chaitin_panda-wiki_api_share_v1.AuthGetResp": { "type": "object", "properties": { - "task_id": { - "type": "string" + "auth_type": { + "$ref": "#/definitions/consts.AuthType" + }, + "license_edition": { + "$ref": "#/definitions/consts.LicenseEdition" + }, + "source_type": { + "$ref": "#/definitions/consts.SourceType" } } }, - "v1.FeishuGetDocReq": { + "github_com_chaitin_panda-wiki_api_share_v1.GitHubCallbackResp": { + "type": "object" + }, + "github_com_chaitin_panda-wiki_domain.CheckModelReq": { "type": "object", "required": [ - "doc_id", - "id", - "kb_id" + "base_url", + "model", + "provider", + "type" ], "properties": { - "doc_id": { + "api_header": { "type": "string" }, - "file_type": { + "api_key": { "type": "string" }, - "id": { + "api_version": { + "description": "for azure openai", "type": "string" }, - "kb_id": { + "base_url": { "type": "string" }, - "space_id": { + "model": { "type": "string" + }, + "parameters": { + "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelParam" + }, + "provider": { + "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelProvider" + }, + "type": { + "enum": [ + "chat", + "embedding", + "rerank", + "analysis", + "analysis-vl" + ], + "allOf": [ + { + "$ref": "#/definitions/domain.ModelType" + } + ] } } }, - "v1.FeishuGetDocResp": { + "github_com_chaitin_panda-wiki_domain.CheckModelResp": { "type": "object", "properties": { "content": { "type": "string" - } - } - }, - "v1.FeishuListCloudDocReq": { - "type": "object", - "required": [ - "app_id", - "app_secret", - "user_access_token" - ], - "properties": { - "app_id": { - "type": "string" - }, - "app_secret": { - "type": "string" }, - "user_access_token": { + "error": { "type": "string" } } - }, - "v1.FeishuListCloudDocResp": { - "type": "object", - "required": [ - "doc_id", - "id" - ], + }, + "github_com_chaitin_panda-wiki_domain.ModelListItem": { + "type": "object", "properties": { - "doc_id": { + "api_header": { "type": "string" }, - "file_type": { + "api_key": { "type": "string" }, - "id": { + "api_version": { + "description": "for azure openai", "type": "string" }, - "space_id": { + "base_url": { "type": "string" }, - "title": { + "completion_tokens": { + "type": "integer" + }, + "id": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "model": { "type": "string" + }, + "parameters": { + "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelParam" + }, + "prompt_tokens": { + "type": "integer" + }, + "provider": { + "$ref": "#/definitions/github_com_chaitin_panda-wiki_domain.ModelProvider" + }, + "total_tokens": { + "type": "integer" + }, + "type": { + "$ref": "#/definitions/domain.ModelType" } } }, - "v1.FeishuSearchWikiReq": { + "github_com_chaitin_panda-wiki_domain.ModelParam": { "type": "object", - "required": [ - "app_id", - "app_secret", - "user_access_token" - ], "properties": { - "app_id": { - "type": "string" + "context_window": { + "type": "integer" }, - "app_secret": { - "type": "string" + "max_tokens": { + "type": "integer" }, - "space_id": { - "type": "string" + "r1_enabled": { + "type": "boolean" }, - "user_access_token": { - "type": "string" + "support_computer_use": { + "type": "boolean" + }, + "support_images": { + "type": "boolean" + }, + "support_prompt_cache": { + "type": "boolean" + }, + "temperature": { + "type": "number" } } }, - "v1.FeishuSearchWikiResp": { - "type": "object", - "required": [ - "doc_id", - "id" + "github_com_chaitin_panda-wiki_domain.ModelProvider": { + "type": "string", + "enum": [ + "BaiZhiCloud" ], + "x-enum-varnames": [ + "ModelProviderBrandBaiZhiCloud" + ] + }, + "gocap.ChallengeData": { + "type": "object", "properties": { - "doc_id": { - "type": "string" - }, - "file_type": { - "type": "string" - }, - "id": { - "type": "string" + "challenge": { + "$ref": "#/definitions/gocap.ChallengeItem" }, - "space_id": { - "type": "string" + "expires": { + "description": "过期时间,毫秒级时间戳", + "type": "integer" }, - "title": { + "token": { + "description": "质询令牌", "type": "string" } } }, - "v1.FeishuSpaceListReq": { + "gocap.ChallengeItem": { "type": "object", - "required": [ - "app_id", - "app_secret", - "user_access_token" - ], "properties": { - "app_id": { - "type": "string" + "c": { + "description": "质询数量", + "type": "integer" }, - "app_secret": { - "type": "string" + "d": { + "description": "质询难度", + "type": "integer" }, - "user_access_token": { - "type": "string" + "s": { + "description": "质询大小", + "type": "integer" } } }, - "v1.FeishuSpaceListResp": { + "gocap.VerificationResult": { "type": "object", "properties": { - "name": { + "expires": { + "description": "过期时间,毫秒级时间戳", + "type": "integer" + }, + "message": { "type": "string" }, - "space_id": { + "success": { + "type": "boolean" + }, + "token": { + "description": "验证令牌", "type": "string" } } }, - "v1.FileUploadResp": { + "schema.RoleType": { + "type": "string", + "enum": [ + "assistant", + "user", + "system", + "tool" + ], + "x-enum-varnames": [ + "Assistant", + "User", + "System", + "Tool" + ] + }, + "share.ShareCommentLists": { "type": "object", "properties": { - "key": { - "type": "string" + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.ShareCommentListItem" + } + }, + "total": { + "type": "integer" } } }, - "v1.KBUserInviteReq": { + "v1.AuthGitHubReq": { "type": "object", - "required": [ - "kb_id", - "perm", - "user_id" - ], "properties": { "kb_id": { "type": "string" }, - "perm": { - "enum": [ - "full_control", - "doc_manage", - "data_operate" - ], - "allOf": [ - { - "$ref": "#/definitions/consts.UserKBPermission" - } - ] - }, - "user_id": { + "redirect_url": { "type": "string" } } }, - "v1.KBUserListItemResp": { + "v1.AuthGitHubResp": { "type": "object", "properties": { - "account": { - "type": "string" - }, - "id": { + "url": { "type": "string" - }, - "perms": { - "$ref": "#/definitions/consts.UserKBPermission" - }, - "role": { - "$ref": "#/definitions/consts.UserRole" } } }, - "v1.KBUserUpdateReq": { + "v1.AuthItem": { "type": "object", - "required": [ - "kb_id", - "perm", - "user_id" - ], "properties": { - "kb_id": { + "avatar_url": { "type": "string" }, - "perm": { - "enum": [ - "full_control", - "doc_manage", - "data_operate" - ], - "allOf": [ - { - "$ref": "#/definitions/consts.UserKBPermission" - } - ] + "created_at": { + "type": "string" }, - "user_id": { + "id": { + "type": "integer" + }, + "ip": { + "type": "string" + }, + "last_login_time": { + "type": "string" + }, + "source_type": { + "$ref": "#/definitions/consts.SourceType" + }, + "username": { "type": "string" } } }, - "v1.LoginReq": { + "v1.AuthLoginSimpleReq": { "type": "object", "required": [ - "account", "password" ], "properties": { - "account": { - "type": "string" - }, "password": { "type": "string" } } }, - "v1.LoginResp": { + "v1.AuthSetReq": { "type": "object", + "required": [ + "source_type" + ], "properties": { - "token": { + "client_id": { + "type": "string" + }, + "client_secret": { + "type": "string" + }, + "kb_id": { + "type": "string" + }, + "proxy": { "type": "string" + }, + "source_type": { + "enum": [ + "github" + ], + "allOf": [ + { + "$ref": "#/definitions/consts.SourceType" + } + ] } } }, - "v1.MindocParseItem": { + "v1.CommentLists": { "type": "object", "properties": { - "id": { - "type": "string" - }, - "title": { - "type": "string" + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/domain.CommentListItem" + } }, - "url": { - "type": "string" + "total": { + "type": "integer" } } }, - "v1.MindocParseResp": { + "v1.ConversationListItems": { "type": "object", "properties": { - "docs": { + "data": { "type": "array", "items": { - "$ref": "#/definitions/v1.MindocParseItem" + "$ref": "#/definitions/domain.ConversationListItem" } }, - "id": { - "type": "string" + "total": { + "type": "integer" } } }, - "v1.MindocScrapeReq": { + "v1.CrawlerExportReq": { "type": "object", "required": [ "doc_id", @@ -8744,423 +7451,415 @@ "doc_id": { "type": "string" }, + "file_type": { + "type": "string" + }, "id": { "type": "string" }, "kb_id": { "type": "string" - } - } - }, - "v1.MindocScrapeResp": { - "type": "object", - "properties": { - "content": { + }, + "space_id": { "type": "string" } } }, - "v1.NodeDetailResp": { + "v1.CrawlerExportResp": { "type": "object", "properties": { - "content": { - "type": "string" - }, - "created_at": { - "type": "string" - }, - "id": { - "type": "string" - }, - "kb_id": { - "type": "string" - }, - "meta": { - "$ref": "#/definitions/domain.NodeMeta" - }, - "name": { - "type": "string" - }, - "parent_id": { - "type": "string" - }, - "permissions": { - "$ref": "#/definitions/domain.NodePermissions" - }, - "status": { - "$ref": "#/definitions/domain.NodeStatus" - }, - "type": { - "$ref": "#/definitions/domain.NodeType" - }, - "updated_at": { + "task_id": { "type": "string" } } }, - "v1.NodePermissionEditReq": { + "v1.CrawlerParseReq": { "type": "object", "required": [ - "ids", + "crawler_source", "kb_id" ], "properties": { - "answerable_groups": { - "description": "可被问答", - "type": "array", - "items": { - "type": "integer" - } + "crawler_source": { + "$ref": "#/definitions/consts.CrawlerSource" }, - "ids": { - "type": "array", - "items": { - "type": "string" - } + "feishu_setting": { + "$ref": "#/definitions/v1.FeishuSetting" }, - "kb_id": { + "filename": { "type": "string" }, - "permissions": { - "$ref": "#/definitions/domain.NodePermissions" - }, - "visible_groups": { - "description": "导航内可见", - "type": "array", - "items": { - "type": "integer" - } + "kb_id": { + "type": "string" }, - "visitable_groups": { - "description": "可被访问", - "type": "array", - "items": { - "type": "integer" - } + "key": { + "type": "string" } } }, - "v1.NodePermissionEditResp": { - "type": "object" - }, - "v1.NodePermissionResp": { + "v1.CrawlerParseResp": { "type": "object", "properties": { - "answerable_groups": { - "description": "可被问答", - "type": "array", - "items": { - "$ref": "#/definitions/domain.NodeGroupDetail" - } + "docs": { + "$ref": "#/definitions/anydoc.Child" }, "id": { "type": "string" - }, - "permissions": { - "$ref": "#/definitions/domain.NodePermissions" - }, - "visible_groups": { - "description": "导航内可见", - "type": "array", - "items": { - "$ref": "#/definitions/domain.NodeGroupDetail" - } - }, - "visitable_groups": { - "description": "可被访问", - "type": "array", - "items": { - "$ref": "#/definitions/domain.NodeGroupDetail" - } } } }, - "v1.NotionParseItem": { + "v1.CrawlerResultItem": { "type": "object", "properties": { - "id": { + "content": { "type": "string" }, - "title": { + "status": { + "$ref": "#/definitions/consts.CrawlerStatus" + }, + "task_id": { "type": "string" } } }, - "v1.NotionParseReq": { + "v1.CrawlerResultReq": { "type": "object", "required": [ - "integration" + "task_id" ], "properties": { - "integration": { + "task_id": { "type": "string" } } }, - "v1.NotionParseResp": { + "v1.CrawlerResultResp": { "type": "object", + "required": [ + "status" + ], "properties": { - "docs": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.NotionParseItem" - } - }, - "id": { + "content": { "type": "string" + }, + "status": { + "$ref": "#/definitions/consts.CrawlerStatus" } } }, - "v1.NotionScrapeReq": { + "v1.CrawlerResultsReq": { "type": "object", "required": [ - "doc_id", - "id", - "kb_id" + "task_ids" ], "properties": { - "doc_id": { - "type": "string" - }, - "id": { - "type": "string" - }, - "kb_id": { - "type": "string" + "task_ids": { + "type": "array", + "items": { + "type": "string" + } } } }, - "v1.NotionScrapeResp": { + "v1.CrawlerResultsResp": { "type": "object", "properties": { - "content": { - "type": "string" + "list": { + "type": "array", + "items": { + "$ref": "#/definitions/v1.CrawlerResultItem" + } + }, + "status": { + "$ref": "#/definitions/consts.CrawlerStatus" } } }, - "v1.ResetPasswordReq": { + "v1.CreateUserReq": { "type": "object", "required": [ - "id", - "new_password" + "account", + "password", + "role" ], "properties": { - "id": { + "account": { "type": "string" }, - "new_password": { + "password": { "type": "string", "minLength": 8 - } - } - }, - "v1.RssParseItem": { - "type": "object", - "properties": { - "desc": { - "type": "string" - }, - "title": { - "type": "string" }, - "url": { - "type": "string" + "role": { + "enum": [ + "admin", + "user" + ], + "allOf": [ + { + "$ref": "#/definitions/consts.UserRole" + } + ] } } }, - "v1.RssParseReq": { + "v1.CreateUserResp": { "type": "object", - "required": [ - "url" - ], "properties": { - "url": { + "id": { "type": "string" } } }, - "v1.RssParseResp": { + "v1.FeishuSetting": { "type": "object", "properties": { - "id": { + "app_id": { "type": "string" }, - "list": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.RssParseItem" - } - } - } - }, - "v1.RssScrapeReq": { - "type": "object", - "required": [ - "id", - "kb_id", - "url" - ], - "properties": { - "id": { + "app_secret": { "type": "string" }, - "kb_id": { + "space_id": { "type": "string" }, - "url": { + "user_access_token": { "type": "string" } } }, - "v1.RssScrapeResp": { + "v1.FileUploadResp": { "type": "object", "properties": { - "content": { + "key": { "type": "string" } } }, - "v1.ScrapeReq": { + "v1.KBUserInviteReq": { "type": "object", "required": [ "kb_id", - "url" + "perm", + "user_id" ], "properties": { "kb_id": { "type": "string" }, - "url": { + "perm": { + "enum": [ + "full_control", + "doc_manage", + "data_operate" + ], + "allOf": [ + { + "$ref": "#/definitions/consts.UserKBPermission" + } + ] + }, + "user_id": { "type": "string" } } }, - "v1.ScrapeResp": { + "v1.KBUserListItemResp": { "type": "object", "properties": { - "task_id": { + "account": { "type": "string" }, - "title": { + "id": { "type": "string" + }, + "perms": { + "$ref": "#/definitions/consts.UserKBPermission" + }, + "role": { + "$ref": "#/definitions/consts.UserRole" } } }, - "v1.SitemapParseItem": { + "v1.KBUserUpdateReq": { "type": "object", + "required": [ + "kb_id", + "perm", + "user_id" + ], "properties": { - "title": { + "kb_id": { "type": "string" }, - "url": { + "perm": { + "enum": [ + "full_control", + "doc_manage", + "data_operate" + ], + "allOf": [ + { + "$ref": "#/definitions/consts.UserKBPermission" + } + ] + }, + "user_id": { "type": "string" } } }, - "v1.SitemapParseReq": { + "v1.LoginReq": { "type": "object", "required": [ - "url" + "account", + "password" ], "properties": { - "url": { + "account": { + "type": "string" + }, + "password": { "type": "string" } } }, - "v1.SitemapParseResp": { + "v1.LoginResp": { "type": "object", "properties": { - "id": { + "token": { "type": "string" - }, - "list": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.SitemapParseItem" - } } } }, - "v1.SitemapScrapeReq": { + "v1.NodeDetailResp": { "type": "object", - "required": [ - "id", - "kb_id", - "url" - ], "properties": { + "content": { + "type": "string" + }, + "created_at": { + "type": "string" + }, "id": { "type": "string" }, "kb_id": { "type": "string" }, - "url": { + "meta": { + "$ref": "#/definitions/domain.NodeMeta" + }, + "name": { "type": "string" - } - } - }, - "v1.SitemapScrapeResp": { - "type": "object", - "properties": { - "content": { + }, + "parent_id": { + "type": "string" + }, + "permissions": { + "$ref": "#/definitions/domain.NodePermissions" + }, + "status": { + "$ref": "#/definitions/domain.NodeStatus" + }, + "type": { + "$ref": "#/definitions/domain.NodeType" + }, + "updated_at": { "type": "string" } } }, - "v1.SiyuanParseItem": { + "v1.NodePermissionEditReq": { "type": "object", + "required": [ + "ids", + "kb_id" + ], "properties": { - "id": { - "type": "string" + "answerable_groups": { + "description": "可被问答", + "type": "array", + "items": { + "type": "integer" + } }, - "title": { - "type": "string" + "ids": { + "type": "array", + "items": { + "type": "string" + } }, - "url": { + "kb_id": { "type": "string" + }, + "permissions": { + "$ref": "#/definitions/domain.NodePermissions" + }, + "visible_groups": { + "description": "导航内可见", + "type": "array", + "items": { + "type": "integer" + } + }, + "visitable_groups": { + "description": "可被访问", + "type": "array", + "items": { + "type": "integer" + } } } }, - "v1.SiyuanParseResp": { + "v1.NodePermissionEditResp": { + "type": "object" + }, + "v1.NodePermissionResp": { "type": "object", "properties": { - "docs": { + "answerable_groups": { + "description": "可被问答", "type": "array", "items": { - "$ref": "#/definitions/v1.SiyuanParseItem" + "$ref": "#/definitions/domain.NodeGroupDetail" } }, "id": { "type": "string" + }, + "permissions": { + "$ref": "#/definitions/domain.NodePermissions" + }, + "visible_groups": { + "description": "导航内可见", + "type": "array", + "items": { + "$ref": "#/definitions/domain.NodeGroupDetail" + } + }, + "visitable_groups": { + "description": "可被访问", + "type": "array", + "items": { + "$ref": "#/definitions/domain.NodeGroupDetail" + } } } }, - "v1.SiyuanScrapeReq": { + "v1.ResetPasswordReq": { "type": "object", "required": [ - "doc_id", "id", - "kb_id" + "new_password" ], "properties": { - "doc_id": { - "type": "string" - }, "id": { "type": "string" }, - "kb_id": { - "type": "string" - } - } - }, - "v1.SiyuanScrapeResp": { - "type": "object", - "properties": { - "content": { - "type": "string" + "new_password": { + "type": "string", + "minLength": 8 } } }, @@ -9234,99 +7933,6 @@ } } } - }, - "v1.WikijsParseItem": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "title": { - "type": "string" - } - } - }, - "v1.WikijsParseResp": { - "type": "object", - "properties": { - "docs": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.WikijsParseItem" - } - }, - "id": { - "type": "string" - } - } - }, - "v1.WikijsScrapeReq": { - "type": "object", - "required": [ - "doc_id", - "id", - "kb_id" - ], - "properties": { - "doc_id": { - "type": "string" - }, - "id": { - "type": "string" - }, - "kb_id": { - "type": "string" - } - } - }, - "v1.WikijsScrapeResp": { - "type": "object", - "properties": { - "content": { - "type": "string" - } - } - }, - "v1.YuqueParseItem": { - "type": "object", - "properties": { - "task_id": { - "type": "string" - }, - "title": { - "type": "string" - } - } - }, - "v1.YuqueParseReq": { - "type": "object", - "required": [ - "filename", - "kb_id", - "key" - ], - "properties": { - "filename": { - "type": "string" - }, - "kb_id": { - "type": "string" - }, - "key": { - "type": "string" - } - } - }, - "v1.YuqueParseResp": { - "type": "object", - "properties": { - "list": { - "type": "array", - "items": { - "$ref": "#/definitions/v1.YuqueParseItem" - } - } - } } }, "securityDefinitions": { diff --git a/backend/docs/swagger.yaml b/backend/docs/swagger.yaml index 4a83ccad..bbd86da8 100644 --- a/backend/docs/swagger.yaml +++ b/backend/docs/swagger.yaml @@ -1,5 +1,27 @@ basePath: / definitions: + anydoc.Child: + properties: + children: + items: + $ref: '#/definitions/anydoc.Child' + type: array + value: + $ref: '#/definitions/anydoc.Value' + type: object + anydoc.Value: + properties: + file: + type: boolean + file_type: + type: string + id: + type: string + summary: + type: string + title: + type: string + type: object consts.AuthType: enum: - "" @@ -36,6 +58,34 @@ definitions: - CopySettingNone - CopySettingAppend - CopySettingDisabled + consts.CrawlerSource: + enum: + - url + - rss + - sitemap + - notion + - feishu + - file + - epub + - yuque + - siyuan + - mindoc + - wikijs + - confluence + type: string + x-enum-varnames: + - CrawlerSourceUrl + - CrawlerSourceRSS + - CrawlerSourceSitemap + - CrawlerSourceNotion + - CrawlerSourceFeishu + - CrawlerSourceFile + - CrawlerSourceEpub + - CrawlerSourceYuque + - CrawlerSourceSiyuan + - CrawlerSourceMindoc + - CrawlerSourceWikijs + - CrawlerSourceConfluence consts.CrawlerStatus: enum: - pending @@ -2387,50 +2437,59 @@ definitions: total: type: integer type: object - v1.ConfluenceParseItem: - properties: - id: - type: string - title: - type: string - url: - type: string - type: object - v1.ConfluenceParseResp: + v1.ConversationListItems: properties: - docs: + data: items: - $ref: '#/definitions/v1.ConfluenceParseItem' + $ref: '#/definitions/domain.ConversationListItem' type: array - id: - type: string + total: + type: integer type: object - v1.ConfluenceScrapeReq: + v1.CrawlerExportReq: properties: doc_id: type: string + file_type: + type: string id: type: string kb_id: type: string + space_id: + type: string required: - doc_id - id - kb_id type: object - v1.ConfluenceScrapeResp: + v1.CrawlerExportResp: properties: - content: + task_id: type: string type: object - v1.ConversationListItems: + v1.CrawlerParseReq: properties: - data: - items: - $ref: '#/definitions/domain.ConversationListItem' - type: array - total: - type: integer + crawler_source: + $ref: '#/definitions/consts.CrawlerSource' + feishu_setting: + $ref: '#/definitions/v1.FeishuSetting' + filename: + type: string + kb_id: + type: string + key: + type: string + required: + - crawler_source + - kb_id + type: object + v1.CrawlerParseResp: + properties: + docs: + $ref: '#/definitions/anydoc.Child' + id: + type: string type: object v1.CrawlerResultItem: properties: @@ -2441,6 +2500,13 @@ definitions: task_id: type: string type: object + v1.CrawlerResultReq: + properties: + task_id: + type: string + required: + - task_id + type: object v1.CrawlerResultResp: properties: content: @@ -2491,76 +2557,7 @@ definitions: id: type: string type: object - v1.EpubParseReq: - properties: - filename: - type: string - kb_id: - type: string - key: - type: string - required: - - filename - - kb_id - - key - type: object - v1.EpubParseResp: - properties: - task_id: - type: string - type: object - v1.FeishuGetDocReq: - properties: - doc_id: - type: string - file_type: - type: string - id: - type: string - kb_id: - type: string - space_id: - type: string - required: - - doc_id - - id - - kb_id - type: object - v1.FeishuGetDocResp: - properties: - content: - type: string - type: object - v1.FeishuListCloudDocReq: - properties: - app_id: - type: string - app_secret: - type: string - user_access_token: - type: string - required: - - app_id - - app_secret - - user_access_token - type: object - v1.FeishuListCloudDocResp: - properties: - doc_id: - type: string - file_type: - type: string - id: - type: string - space_id: - type: string - title: - type: string - required: - - doc_id - - id - type: object - v1.FeishuSearchWikiReq: + v1.FeishuSetting: properties: app_id: type: string @@ -2570,46 +2567,6 @@ definitions: type: string user_access_token: type: string - required: - - app_id - - app_secret - - user_access_token - type: object - v1.FeishuSearchWikiResp: - properties: - doc_id: - type: string - file_type: - type: string - id: - type: string - space_id: - type: string - title: - type: string - required: - - doc_id - - id - type: object - v1.FeishuSpaceListReq: - properties: - app_id: - type: string - app_secret: - type: string - user_access_token: - type: string - required: - - app_id - - app_secret - - user_access_token - type: object - v1.FeishuSpaceListResp: - properties: - name: - type: string - space_id: - type: string type: object v1.FileUploadResp: properties: @@ -2678,42 +2635,6 @@ definitions: token: type: string type: object - v1.MindocParseItem: - properties: - id: - type: string - title: - type: string - url: - type: string - type: object - v1.MindocParseResp: - properties: - docs: - items: - $ref: '#/definitions/v1.MindocParseItem' - type: array - id: - type: string - type: object - v1.MindocScrapeReq: - properties: - doc_id: - type: string - id: - type: string - kb_id: - type: string - required: - - doc_id - - id - - kb_id - type: object - v1.MindocScrapeResp: - properties: - content: - type: string - type: object v1.NodeDetailResp: properties: content: @@ -2792,302 +2713,63 @@ definitions: $ref: '#/definitions/domain.NodeGroupDetail' type: array type: object - v1.NotionParseItem: + v1.ResetPasswordReq: properties: id: type: string - title: - type: string - type: object - v1.NotionParseReq: - properties: - integration: + new_password: + minLength: 8 type: string required: - - integration + - id + - new_password type: object - v1.NotionParseResp: + v1.StatCountResp: properties: - docs: - items: - $ref: '#/definitions/v1.NotionParseItem' - type: array - id: - type: string + conversation_count: + type: integer + ip_count: + type: integer + page_visit_count: + type: integer + session_count: + type: integer type: object - v1.NotionScrapeReq: + v1.UserInfoResp: properties: - doc_id: - type: string - id: - type: string - kb_id: + account: type: string - required: - - doc_id - - id - - kb_id - type: object - v1.NotionScrapeResp: - properties: - content: + created_at: type: string - type: object - v1.ResetPasswordReq: - properties: id: type: string - new_password: - minLength: 8 + is_token: + type: boolean + last_access: type: string - required: - - id - - new_password + role: + $ref: '#/definitions/consts.UserRole' type: object - v1.RssParseItem: + v1.UserListItemResp: properties: - desc: + account: type: string - title: + created_at: type: string - url: + id: type: string - type: object - v1.RssParseReq: - properties: - url: + last_access: type: string - required: - - url + role: + $ref: '#/definitions/consts.UserRole' type: object - v1.RssParseResp: - properties: - id: - type: string - list: - items: - $ref: '#/definitions/v1.RssParseItem' - type: array - type: object - v1.RssScrapeReq: - properties: - id: - type: string - kb_id: - type: string - url: - type: string - required: - - id - - kb_id - - url - type: object - v1.RssScrapeResp: - properties: - content: - type: string - type: object - v1.ScrapeReq: - properties: - kb_id: - type: string - url: - type: string - required: - - kb_id - - url - type: object - v1.ScrapeResp: - properties: - task_id: - type: string - title: - type: string - type: object - v1.SitemapParseItem: - properties: - title: - type: string - url: - type: string - type: object - v1.SitemapParseReq: - properties: - url: - type: string - required: - - url - type: object - v1.SitemapParseResp: - properties: - id: - type: string - list: - items: - $ref: '#/definitions/v1.SitemapParseItem' - type: array - type: object - v1.SitemapScrapeReq: - properties: - id: - type: string - kb_id: - type: string - url: - type: string - required: - - id - - kb_id - - url - type: object - v1.SitemapScrapeResp: - properties: - content: - type: string - type: object - v1.SiyuanParseItem: - properties: - id: - type: string - title: - type: string - url: - type: string - type: object - v1.SiyuanParseResp: - properties: - docs: - items: - $ref: '#/definitions/v1.SiyuanParseItem' - type: array - id: - type: string - type: object - v1.SiyuanScrapeReq: - properties: - doc_id: - type: string - id: - type: string - kb_id: - type: string - required: - - doc_id - - id - - kb_id - type: object - v1.SiyuanScrapeResp: - properties: - content: - type: string - type: object - v1.StatCountResp: - properties: - conversation_count: - type: integer - ip_count: - type: integer - page_visit_count: - type: integer - session_count: - type: integer - type: object - v1.UserInfoResp: - properties: - account: - type: string - created_at: - type: string - id: - type: string - is_token: - type: boolean - last_access: - type: string - role: - $ref: '#/definitions/consts.UserRole' - type: object - v1.UserListItemResp: - properties: - account: - type: string - created_at: - type: string - id: - type: string - last_access: - type: string - role: - $ref: '#/definitions/consts.UserRole' - type: object - v1.UserListResp: + v1.UserListResp: properties: users: items: $ref: '#/definitions/v1.UserListItemResp' type: array type: object - v1.WikijsParseItem: - properties: - id: - type: string - title: - type: string - type: object - v1.WikijsParseResp: - properties: - docs: - items: - $ref: '#/definitions/v1.WikijsParseItem' - type: array - id: - type: string - type: object - v1.WikijsScrapeReq: - properties: - doc_id: - type: string - id: - type: string - kb_id: - type: string - required: - - doc_id - - id - - kb_id - type: object - v1.WikijsScrapeResp: - properties: - content: - type: string - type: object - v1.YuqueParseItem: - properties: - task_id: - type: string - title: - type: string - type: object - v1.YuqueParseReq: - properties: - filename: - type: string - kb_id: - type: string - key: - type: string - required: - - filename - - kb_id - - key - type: object - v1.YuqueParseResp: - properties: - list: - items: - $ref: '#/definitions/v1.YuqueParseItem' - type: array - type: object info: contact: {} description: panda-wiki API documentation @@ -3504,49 +3186,18 @@ paths: summary: GetMessageFeedBackList tags: - Message - /api/v1/crawler/confluence/parse: - post: - consumes: - - multipart/form-data - description: Parse Confluence Export File and return document list - parameters: - - description: file - in: formData - name: file - required: true - type: file - - description: kb_id - in: formData - name: kb_id - required: true - type: string - produces: - - application/json - responses: - "200": - description: OK - schema: - allOf: - - $ref: '#/definitions/domain.PWResponse' - - properties: - data: - $ref: '#/definitions/v1.ConfluenceParseResp' - type: object - summary: ConfluenceParse - tags: - - crawler - /api/v1/crawler/confluence/scrape: + /api/v1/crawler/export: post: consumes: - application/json - description: Scrape specific Confluence documents by ID + description: CrawlerExport parameters: - - description: Scrape Request + - description: Scrape in: body name: body required: true schema: - $ref: '#/definitions/v1.ConfluenceScrapeReq' + $ref: '#/definitions/v1.CrawlerExportReq' produces: - application/json responses: @@ -3557,23 +3208,23 @@ paths: - $ref: '#/definitions/domain.PWResponse' - properties: data: - $ref: '#/definitions/v1.ConfluenceScrapeResp' + $ref: '#/definitions/v1.CrawlerExportResp' type: object - summary: ConfluenceScrape + summary: CrawlerExport tags: - crawler - /api/v1/crawler/epub/parse: + /api/v1/crawler/parse: post: consumes: - application/json - description: EpubParse + description: 解析文档树 parameters: - - description: Parse URL + - description: Scrape in: body name: body required: true schema: - $ref: '#/definitions/v1.EpubParseReq' + $ref: '#/definitions/v1.CrawlerParseReq' produces: - application/json responses: @@ -3584,23 +3235,23 @@ paths: - $ref: '#/definitions/domain.PWResponse' - properties: data: - $ref: '#/definitions/v1.EpubParseResp' + $ref: '#/definitions/v1.CrawlerParseResp' type: object - summary: EpubParse + summary: 解析文档树 tags: - crawler - /api/v1/crawler/feishu/get_doc: - post: + /api/v1/crawler/result: + get: consumes: - application/json - description: Get Docx in Feishu Spaces + description: Retrieve the result of a previously started scraping task parameters: - - description: Get Docx + - description: Crawler Result Request in: body name: body required: true schema: - $ref: '#/definitions/v1.FeishuGetDocReq' + $ref: '#/definitions/v1.CrawlerResultReq' produces: - application/json responses: @@ -3611,23 +3262,23 @@ paths: - $ref: '#/definitions/domain.PWResponse' - properties: data: - $ref: '#/definitions/v1.FeishuGetDocResp' + $ref: '#/definitions/v1.CrawlerResultResp' type: object - summary: FeishuDoc + summary: Get Crawler Result tags: - crawler - /api/v1/crawler/feishu/list_doc: + /api/v1/crawler/results: post: consumes: - application/json - description: List Docx in Feishu Spaces + description: Retrieve the results of a previously started scraping task parameters: - - description: Search Docx + - description: Crawler Results Request in: body - name: body + name: param required: true schema: - $ref: '#/definitions/v1.FeishuListCloudDocReq' + $ref: '#/definitions/v1.CrawlerResultsReq' produces: - application/json responses: @@ -3638,513 +3289,11 @@ paths: - $ref: '#/definitions/domain.PWResponse' - properties: data: - items: - $ref: '#/definitions/v1.FeishuListCloudDocResp' - type: array - type: object - summary: FeishuListCloudDoc - tags: - - crawler - /api/v1/crawler/feishu/list_spaces: - post: - consumes: - - application/json - description: List All Feishu Spaces - parameters: - - description: List Spaces - in: body - name: body - required: true - schema: - $ref: '#/definitions/v1.FeishuSpaceListReq' - produces: - - application/json - responses: - "200": - description: OK - schema: - allOf: - - $ref: '#/definitions/domain.PWResponse' - - properties: - data: - items: - $ref: '#/definitions/v1.FeishuSpaceListResp' - type: array - type: object - summary: FeishuListSpaces - tags: - - crawler - /api/v1/crawler/feishu/search_wiki: - post: - consumes: - - application/json - description: Search Wiki in Feishu Spaces - parameters: - - description: Search Wiki - in: body - name: body - required: true - schema: - $ref: '#/definitions/v1.FeishuSearchWikiReq' - produces: - - application/json - responses: - "200": - description: OK - schema: - allOf: - - $ref: '#/definitions/domain.PWResponse' - - properties: - data: - items: - $ref: '#/definitions/v1.FeishuSearchWikiResp' - type: array - type: object - summary: FeishuWikiSearch - tags: - - crawler - /api/v1/crawler/mindoc/parse: - post: - consumes: - - multipart/form-data - description: Parse Mindoc Export File and return document list - parameters: - - description: file - in: formData - name: file - required: true - type: file - - description: kb_id - in: formData - name: kb_id - required: true - type: string - produces: - - application/json - responses: - "200": - description: OK - schema: - allOf: - - $ref: '#/definitions/domain.PWResponse' - - properties: - data: - $ref: '#/definitions/v1.MindocParseResp' - type: object - summary: MindocParse - tags: - - crawler - /api/v1/crawler/mindoc/scrape: - post: - consumes: - - application/json - description: Scrape specific Mindoc documents by ID - parameters: - - description: Scrape Request - in: body - name: body - required: true - schema: - $ref: '#/definitions/v1.MindocScrapeReq' - produces: - - application/json - responses: - "200": - description: OK - schema: - allOf: - - $ref: '#/definitions/domain.PWResponse' - - properties: - data: - $ref: '#/definitions/v1.MindocScrapeResp' - type: object - summary: MindocScrape - tags: - - crawler - /api/v1/crawler/notion/parse: - post: - consumes: - - application/json - description: NotionParse - parameters: - - description: Scrape - in: body - name: body - required: true - schema: - $ref: '#/definitions/v1.NotionParseReq' - produces: - - application/json - responses: - "200": - description: OK - schema: - allOf: - - $ref: '#/definitions/domain.PWResponse' - - properties: - data: - $ref: '#/definitions/v1.NotionParseResp' - type: object - summary: NotionParse - tags: - - crawler - /api/v1/crawler/notion/scrape: - post: - consumes: - - application/json - description: NotionScrape - parameters: - - description: Get Docs - in: body - name: body - required: true - schema: - $ref: '#/definitions/v1.NotionScrapeReq' - produces: - - application/json - responses: - "200": - description: OK - schema: - allOf: - - $ref: '#/definitions/domain.PWResponse' - - properties: - data: - $ref: '#/definitions/v1.NotionScrapeResp' - type: object - summary: NotionScrape - tags: - - crawler - /api/v1/crawler/result: - get: - consumes: - - application/json - description: Retrieve the result of a previously started scraping task - parameters: - - in: query - name: task_id - required: true - type: string - produces: - - application/json - responses: - "200": - description: OK - schema: - allOf: - - $ref: '#/definitions/domain.PWResponse' - - properties: - data: - $ref: '#/definitions/v1.CrawlerResultResp' - type: object - summary: Get Crawler Result - tags: - - crawler - /api/v1/crawler/results: - post: - consumes: - - application/json - description: Retrieve the results of a previously started scraping task - parameters: - - description: Crawler Results Request - in: body - name: param - required: true - schema: - $ref: '#/definitions/v1.CrawlerResultsReq' - produces: - - application/json - responses: - "200": - description: OK - schema: - allOf: - - $ref: '#/definitions/domain.PWResponse' - - properties: - data: - $ref: '#/definitions/v1.CrawlerResultsResp' + $ref: '#/definitions/v1.CrawlerResultsResp' type: object summary: Get Crawler Results tags: - crawler - /api/v1/crawler/rss/parse: - post: - consumes: - - application/json - description: Parse RSS - parameters: - - description: Parse URL - in: body - name: body - required: true - schema: - $ref: '#/definitions/v1.RssParseReq' - produces: - - application/json - responses: - "200": - description: OK - schema: - allOf: - - $ref: '#/definitions/domain.PWResponse' - - properties: - data: - $ref: '#/definitions/v1.RssParseResp' - type: object - summary: Parse RSS - tags: - - crawler - /api/v1/crawler/rss/scrape: - post: - consumes: - - application/json - description: RSSScrape - parameters: - - description: Parse URL - in: body - name: body - required: true - schema: - $ref: '#/definitions/v1.RssScrapeReq' - produces: - - application/json - responses: - "200": - description: OK - schema: - allOf: - - $ref: '#/definitions/domain.PWResponse' - - properties: - data: - $ref: '#/definitions/v1.RssScrapeResp' - type: object - summary: RSSScrape - tags: - - crawler - /api/v1/crawler/scrape: - post: - consumes: - - application/json - description: Scrape - parameters: - - description: Scrape - in: body - name: body - required: true - schema: - $ref: '#/definitions/v1.ScrapeReq' - produces: - - application/json - responses: - "200": - description: OK - schema: - allOf: - - $ref: '#/definitions/domain.PWResponse' - - properties: - data: - $ref: '#/definitions/v1.ScrapeResp' - type: object - summary: Scrape - tags: - - crawler - /api/v1/crawler/sitemap/parse: - post: - consumes: - - application/json - description: Parse Sitemap - parameters: - - description: Parse URL - in: body - name: body - required: true - schema: - $ref: '#/definitions/v1.SitemapParseReq' - produces: - - application/json - responses: - "200": - description: OK - schema: - allOf: - - $ref: '#/definitions/domain.PWResponse' - - properties: - data: - $ref: '#/definitions/v1.SitemapParseResp' - type: object - summary: Parse Sitemap - tags: - - crawler - /api/v1/crawler/sitemap/scrape: - post: - consumes: - - application/json - description: SitemapScrape - parameters: - - description: Parse URL - in: body - name: body - required: true - schema: - $ref: '#/definitions/v1.SitemapScrapeReq' - produces: - - application/json - responses: - "200": - description: OK - schema: - allOf: - - $ref: '#/definitions/domain.PWResponse' - - properties: - data: - $ref: '#/definitions/v1.SitemapScrapeResp' - type: object - summary: SitemapScrape - tags: - - crawler - /api/v1/crawler/siyuan/parse: - post: - consumes: - - multipart/form-data - description: Parse Siyuan Export File and return document list - parameters: - - description: file - in: formData - name: file - required: true - type: file - - description: kb_id - in: formData - name: kb_id - required: true - type: string - produces: - - application/json - responses: - "200": - description: OK - schema: - allOf: - - $ref: '#/definitions/domain.PWResponse' - - properties: - data: - $ref: '#/definitions/v1.SiyuanParseResp' - type: object - summary: SiyuanParse - tags: - - crawler - /api/v1/crawler/siyuan/scrape: - post: - consumes: - - application/json - description: Scrape specific Siyuan documents by ID - parameters: - - description: Scrape Request - in: body - name: body - required: true - schema: - $ref: '#/definitions/v1.SiyuanScrapeReq' - produces: - - application/json - responses: - "200": - description: OK - schema: - allOf: - - $ref: '#/definitions/domain.PWResponse' - - properties: - data: - $ref: '#/definitions/v1.SiyuanScrapeResp' - type: object - summary: SiyuanScrape - tags: - - crawler - /api/v1/crawler/wikijs/parse: - post: - consumes: - - multipart/form-data - description: Parse Wikijs Export File and return document list - parameters: - - description: file - in: formData - name: file - required: true - type: file - - description: kb_id - in: formData - name: kb_id - required: true - type: string - produces: - - application/json - responses: - "200": - description: OK - schema: - allOf: - - $ref: '#/definitions/domain.PWResponse' - - properties: - data: - $ref: '#/definitions/v1.WikijsParseResp' - type: object - summary: WikijsParse - tags: - - crawler - /api/v1/crawler/wikijs/scrape: - post: - consumes: - - application/json - description: Scrape specific Wikijs documents by ID - parameters: - - description: Scrape Request - in: body - name: body - required: true - schema: - $ref: '#/definitions/v1.WikijsScrapeReq' - produces: - - application/json - responses: - "200": - description: OK - schema: - allOf: - - $ref: '#/definitions/domain.PWResponse' - - properties: - data: - $ref: '#/definitions/v1.WikijsScrapeResp' - type: object - summary: WikijsScrape - tags: - - crawler - /api/v1/crawler/yuque/parse: - post: - consumes: - - application/json - description: YuqueParse - parameters: - - description: Parse URL - in: body - name: body - required: true - schema: - $ref: '#/definitions/v1.YuqueParseReq' - produces: - - application/json - responses: - "200": - description: OK - schema: - allOf: - - $ref: '#/definitions/domain.PWResponse' - - properties: - data: - $ref: '#/definitions/v1.YuqueParseResp' - type: object - summary: YuqueParse - tags: - - crawler /api/v1/creation/tab-complete: post: consumes: diff --git a/backend/handler/v1/crawler.go b/backend/handler/v1/crawler.go index 3109cf20..1163e1ca 100644 --- a/backend/handler/v1/crawler.go +++ b/backend/handler/v1/crawler.go @@ -1,12 +1,11 @@ package v1 import ( - "fmt" - "github.com/labstack/echo/v4" v1 "github.com/chaitin/panda-wiki/api/crawler/v1" "github.com/chaitin/panda-wiki/config" + "github.com/chaitin/panda-wiki/consts" "github.com/chaitin/panda-wiki/handler" "github.com/chaitin/panda-wiki/log" "github.com/chaitin/panda-wiki/middleware" @@ -37,116 +36,70 @@ func NewCrawlerHandler(echo *echo.Echo, fileUsecase: fileUsecase, } group := echo.Group("/api/v1/crawler", auth.Authorize) - group.POST("/scrape", h.Scrape) + group.POST("/parse", h.CrawlerParse) + group.POST("/export", h.CrawlerExport) group.GET("/result", h.CrawlerResult) group.POST("/results", h.CrawlerResults) - // feishu - group.POST("/feishu/list_spaces", h.FeishuListSpaces) - group.POST("/feishu/list_doc", h.FeishuListCloudDoc) - group.POST("/feishu/search_wiki", h.FeishuWikiSearch) - group.POST("/feishu/get_doc", h.FeishuDoc) - - // epub - group.POST("/epub/parse", h.EpubParse) - // yuque - group.POST("/yuque/parse", h.YuqueParse) - // rss - group.POST("/rss/parse", h.RSSParse) - group.POST("/rss/scrape", h.RSSScrape) - // sitemap - group.POST("/sitemap/parse", h.SitemapParse) - group.POST("/sitemap/scrape", h.SitemapScrape) - // notion - group.POST("/notion/parse", h.NotionParse) - group.POST("/notion/scrape", h.NotionScrape) - // confluence - group.POST("/confluence/parse", h.ConfluenceParse) - group.POST("/confluence/scrape", h.ConfluenceScrape) - // siyuan - group.POST("/siyuan/parse", h.SiyuanParse) - group.POST("/siyuan/scrape", h.SiyuanScrape) - // mindoc - group.POST("/mindoc/parse", h.MindocParse) - group.POST("/mindoc/scrape", h.MindocScrape) - // wikijs - group.POST("/wikijs/parse", h.WikijsParse) - group.POST("/wikijs/scrape", h.WikijsScrape) - return h } -// NotionParse +// CrawlerParse 解析文档树 // -// @Summary NotionParse -// @Description NotionParse +// @Summary 解析文档树 +// @Description 解析文档树 // @Tags crawler // @Accept json // @Produce json -// @Param body body v1.NotionParseReq true "Scrape" -// @Success 200 {object} domain.PWResponse{data=v1.NotionParseResp} -// @Router /api/v1/crawler/notion/parse [post] -func (h *CrawlerHandler) NotionParse(c echo.Context) error { - var req v1.NotionParseReq +// @Param body body v1.CrawlerParseReq true "Scrape" +// @Success 200 {object} domain.PWResponse{data=v1.CrawlerParseResp} +// @Router /api/v1/crawler/parse [post] +func (h *CrawlerHandler) CrawlerParse(c echo.Context) error { + var req v1.CrawlerParseReq if err := c.Bind(&req); err != nil { return h.NewResponseWithError(c, "request body is invalid", err) } if err := c.Validate(req); err != nil { return h.NewResponseWithError(c, "validate request body failed", err) } + if req.CrawlerSource == consts.CrawlerSourceFeishu { + if req.FeishuSetting.AppID == "" || req.FeishuSetting.AppSecret == "" || req.FeishuSetting.UserAccessToken == "" { + return h.NewResponseWithError(c, "validate request param feishu failed", nil) + } + } else { + if req.Key == "" { + return h.NewResponseWithError(c, "validate request param key failed", nil) - resp, err := h.usecase.NotionGetDocList(c.Request().Context(), req.Integration) - if err != nil { - return h.NewResponseWithError(c, "parse notion failed", err) - } - return h.NewResponseWithData(c, resp) -} - -// NotionScrape -// -// @Summary NotionScrape -// @Description NotionScrape -// @Tags crawler -// @Accept json -// @Produce json -// @Param body body v1.NotionScrapeReq true "Get Docs" -// @Success 200 {object} domain.PWResponse{data=v1.NotionScrapeResp} -// @Router /api/v1/crawler/notion/scrape [post] -func (h *CrawlerHandler) NotionScrape(c echo.Context) error { - var req v1.NotionScrapeReq - if err := c.Bind(&req); err != nil { - return h.NewResponseWithError(c, "request body failed", err) - } - if err := c.Validate(req); err != nil { - return h.NewResponseWithError(c, "validate request body failed", err) + } } - resp, err := h.usecase.NotionGetDoc(c.Request().Context(), req) + resp, err := h.usecase.ParseUrl(c.Request().Context(), &req) if err != nil { - return h.NewResponseWithError(c, "get Docs failed", err) + h.logger.Error("scrape url failed", log.Error(err)) + return h.NewResponseWithError(c, "scrape url failed", err) } return h.NewResponseWithData(c, resp) } -// Scrape +// CrawlerExport // -// @Summary Scrape -// @Description Scrape +// @Summary CrawlerExport +// @Description CrawlerExport // @Tags crawler // @Accept json // @Produce json -// @Param body body v1.ScrapeReq true "Scrape" -// @Success 200 {object} domain.PWResponse{data=v1.ScrapeResp} -// @Router /api/v1/crawler/scrape [post] -func (h *CrawlerHandler) Scrape(c echo.Context) error { - var req v1.ScrapeReq +// @Param body body v1.CrawlerExportReq true "Scrape" +// @Success 200 {object} domain.PWResponse{data=v1.CrawlerExportResp} +// @Router /api/v1/crawler/export [post] +func (h *CrawlerHandler) CrawlerExport(c echo.Context) error { + var req v1.CrawlerExportReq if err := c.Bind(&req); err != nil { return h.NewResponseWithError(c, "request body is invalid", err) } if err := c.Validate(req); err != nil { return h.NewResponseWithError(c, "validate request body failed", err) } - resp, err := h.usecase.ScrapeURL(c.Request().Context(), req.URL, req.KbID) + resp, err := h.usecase.ExportDoc(c.Request().Context(), &req) if err != nil { return h.NewResponseWithError(c, "scrape url failed", err) } @@ -160,7 +113,7 @@ func (h *CrawlerHandler) Scrape(c echo.Context) error { // @Tags crawler // @Accept json // @Produce json -// @Param param query v1.CrawlerResultReq true "Crawler Result Request" +// @Param body body v1.CrawlerResultReq true "Crawler Result Request" // @Success 200 {object} domain.PWResponse{data=v1.CrawlerResultResp} // @Router /api/v1/crawler/result [get] func (h *CrawlerHandler) CrawlerResult(c echo.Context) error { @@ -204,520 +157,3 @@ func (h *CrawlerHandler) CrawlerResults(c echo.Context) error { } return h.NewResponseWithData(c, resp) } - -// EpubParse -// -// @Tags crawler -// @Summary EpubParse -// @Description EpubParse -// @Accept json -// @Produce json -// @Param body body v1.EpubParseReq true "Parse URL" -// @Success 200 {object} domain.PWResponse{data=v1.EpubParseResp} -// @Router /api/v1/crawler/epub/parse [post] -func (h *CrawlerHandler) EpubParse(c echo.Context) error { - var req v1.EpubParseReq - if err := c.Bind(&req); err != nil { - return h.NewResponseWithError(c, "request body is invalid", err) - } - if err := c.Validate(req); err != nil { - return h.NewResponseWithError(c, "validate request body failed", err) - } - - resp, err := h.usecase.EpubParse(c.Request().Context(), &req) - if err != nil { - return h.NewResponseWithError(c, "get Docs failed", err) - } - return h.NewResponseWithData(c, resp) -} - -// YuqueParse -// -// @Tags crawler -// @Summary YuqueParse -// @Description YuqueParse -// @Accept json -// @Produce json -// @Param body body v1.YuqueParseReq true "Parse URL" -// @Success 200 {object} domain.PWResponse{data=v1.YuqueParseResp} -// @Router /api/v1/crawler/yuque/parse [post] -func (h *CrawlerHandler) YuqueParse(c echo.Context) error { - var req v1.YuqueParseReq - if err := c.Bind(&req); err != nil { - return h.NewResponseWithError(c, "request body is invalid", err) - } - if err := c.Validate(req); err != nil { - return h.NewResponseWithError(c, "validate request body failed", err) - } - - resp, err := h.usecase.YuqueParse(c.Request().Context(), &req) - if err != nil { - return h.NewResponseWithError(c, "get Docs failed", err) - } - return h.NewResponseWithData(c, resp) -} - -// FeishuListSpaces -// -// @Summary FeishuListSpaces -// @Description List All Feishu Spaces -// @Tags crawler -// @Accept json -// @Produce json -// @Param body body v1.FeishuSpaceListReq true "List Spaces" -// @Success 200 {object} domain.PWResponse{data=[]v1.FeishuSpaceListResp} -// @Router /api/v1/crawler/feishu/list_spaces [post] -func (h *CrawlerHandler) FeishuListSpaces(c echo.Context) error { - var req *v1.FeishuSpaceListReq - if err := c.Bind(&req); err != nil { - return h.NewResponseWithError(c, "request body is invalid", err) - } - if err := c.Validate(req); err != nil { - return h.NewResponseWithError(c, "validate request body failed", err) - } - resp, err := h.usecase.FeishuListSpace(c.Request().Context(), req) - if err != nil { - return h.NewResponseWithError(c, fmt.Sprintf("list spaces failed %s", err.Error()), err) - } - return h.NewResponseWithData(c, resp) -} - -// FeishuListCloudDoc -// -// @Summary FeishuListCloudDoc -// @Description List Docx in Feishu Spaces -// @Tags crawler -// @Accept json -// @Produce json -// @Param body body v1.FeishuListCloudDocReq true "Search Docx" -// @Success 200 {object} domain.PWResponse{data=[]v1.FeishuListCloudDocResp} -// @Router /api/v1/crawler/feishu/list_doc [post] -func (h *CrawlerHandler) FeishuListCloudDoc(c echo.Context) error { - var req *v1.FeishuListCloudDocReq - if err := c.Bind(&req); err != nil { - return h.NewResponseWithError(c, "request body is invalid", err) - } - if err := c.Validate(req); err != nil { - return h.NewResponseWithError(c, "validate request body failed", err) - } - resp, err := h.usecase.FeishuListCloudDoc(c.Request().Context(), req) - if err != nil { - return h.NewResponseWithError(c, fmt.Sprintf("list spaces failed %s", err.Error()), err) - } - return h.NewResponseWithData(c, resp) -} - -// FeishuWikiSearch -// -// @Summary FeishuWikiSearch -// @Description Search Wiki in Feishu Spaces -// @Tags crawler -// @Accept json -// @Produce json -// @Param body body v1.FeishuSearchWikiReq true "Search Wiki" -// @Success 200 {object} domain.PWResponse{data=[]v1.FeishuSearchWikiResp} -// @Router /api/v1/crawler/feishu/search_wiki [post] -func (h *CrawlerHandler) FeishuWikiSearch(c echo.Context) error { - var req *v1.FeishuSearchWikiReq - if err := c.Bind(&req); err != nil { - return h.NewResponseWithError(c, "request body is invalid", err) - } - resp, err := h.usecase.FeishuSearchWiki(c.Request().Context(), req) - if err != nil { - return h.NewResponseWithError(c, fmt.Sprintf("search wiki failed %s", err.Error()), err) - } - return h.NewResponseWithData(c, resp) -} - -// FeishuDoc -// -// @Summary FeishuDoc -// @Description Get Docx in Feishu Spaces -// @Tags crawler -// @Accept json -// @Produce json -// @Param body body v1.FeishuGetDocReq true "Get Docx" -// @Success 200 {object} domain.PWResponse{data=v1.FeishuGetDocResp} -// @Router /api/v1/crawler/feishu/get_doc [post] -func (h *CrawlerHandler) FeishuDoc(c echo.Context) error { - var req *v1.FeishuGetDocReq - if err := c.Bind(&req); err != nil { - return h.NewResponseWithError(c, "request body is invalid", err) - } - if err := c.Validate(req); err != nil { - return h.NewResponseWithError(c, "validate request body failed", err) - } - resp, err := h.usecase.FeishuGetDoc(c.Request().Context(), req) - if err != nil { - return h.NewResponseWithError(c, fmt.Sprintf("get docx failed %s", err.Error()), err) - } - return h.NewResponseWithData(c, resp) -} - -// ConfluenceParse -// -// @Summary ConfluenceParse -// @Description Parse Confluence Export File and return document list -// @Tags crawler -// @Accept multipart/form-data -// @Produce json -// @Param file formData file true "file" -// @Param kb_id formData string true "kb_id" -// @Success 200 {object} domain.PWResponse{data=v1.ConfluenceParseResp} -// @Router /api/v1/crawler/confluence/parse [post] -func (h *CrawlerHandler) ConfluenceParse(c echo.Context) error { - ctx := c.Request().Context() - - file, err := c.FormFile("file") - if err != nil { - return h.NewResponseWithError(c, "get file failed", err) - } - - var req v1.ConfluenceParseReq - req.KbID = c.FormValue("kb_id") - if err := c.Validate(req); err != nil { - return h.NewResponseWithError(c, "validate failed", err) - } - - fileUrl, err := h.fileUsecase.UploadFileGetUrl(ctx, req.KbID, file) - if err != nil { - return h.NewResponseWithError(c, "upload failed", err) - } - - h.logger.Info("ConfluenceParse UploadFile successfully", "fileUrl", fileUrl) - - resp, err := h.usecase.ConfluenceParse(c.Request().Context(), fileUrl, file.Filename) - if err != nil { - return h.NewResponseWithError(c, "parse confluence export file failed", err) - } - - return h.NewResponseWithData(c, resp) -} - -// ConfluenceScrape -// -// @Tags crawler -// @Summary ConfluenceScrape -// @Description Scrape specific Confluence documents by ID -// @Accept json -// @Produce json -// @Param body body v1.ConfluenceScrapeReq true "Scrape Request" -// @Success 200 {object} domain.PWResponse{data=v1.ConfluenceScrapeResp} -// @Router /api/v1/crawler/confluence/scrape [post] -func (h *CrawlerHandler) ConfluenceScrape(c echo.Context) error { - var req v1.ConfluenceScrapeReq - if err := c.Bind(&req); err != nil { - return h.NewResponseWithError(c, "request body is invalid", err) - } - if err := c.Validate(req); err != nil { - return h.NewResponseWithError(c, "validate request body failed", err) - } - - resp, err := h.usecase.ConfluenceScrape(c.Request().Context(), &req) - if err != nil { - return h.NewResponseWithError(c, "scrape confluence docs failed", err) - } - return h.NewResponseWithData(c, resp) -} - -// RSSParse -// -// @Tags crawler -// @Summary Parse RSS -// @Description Parse RSS -// @Accept json -// @Produce json -// @Param body body v1.RssParseReq true "Parse URL" -// @Success 200 {object} domain.PWResponse{data=v1.RssParseResp} -// @Router /api/v1/crawler/rss/parse [post] -func (h *CrawlerHandler) RSSParse(c echo.Context) error { - var req v1.RssParseReq - if err := c.Bind(&req); err != nil { - return h.NewResponseWithError(c, "request body is invalid", err) - } - if err := c.Validate(req); err != nil { - return h.NewResponseWithError(c, "validate request body failed", err) - } - - resp, err := h.usecase.GetRSSParse(c.Request().Context(), &req) - if err != nil { - return h.NewResponseWithError(c, "get Docs failed", err) - } - return h.NewResponseWithData(c, resp) -} - -// RSSScrape -// -// @Tags crawler -// @Summary RSSScrape -// @Description RSSScrape -// @Accept json -// @Produce json -// @Param body body v1.RssScrapeReq true "Parse URL" -// @Success 200 {object} domain.PWResponse{data=v1.RssScrapeResp} -// @Router /api/v1/crawler/rss/scrape [post] -func (h *CrawlerHandler) RSSScrape(c echo.Context) error { - var req v1.RssScrapeReq - if err := c.Bind(&req); err != nil { - return h.NewResponseWithError(c, "request body is invalid", err) - } - if err := c.Validate(req); err != nil { - return h.NewResponseWithError(c, "validate request body failed", err) - } - - resp, err := h.usecase.GetRssDoc(c.Request().Context(), &req) - if err != nil { - return h.NewResponseWithError(c, "get Docs failed", err) - } - return h.NewResponseWithData(c, resp) -} - -// SitemapParse -// -// @Tags crawler -// @Summary Parse Sitemap -// @Description Parse Sitemap -// @Accept json -// @Produce json -// @Param body body v1.SitemapParseReq true "Parse URL" -// @Success 200 {object} domain.PWResponse{data=SitemapParseResp} -// @Router /api/v1/crawler/sitemap/parse [post] -func (h *CrawlerHandler) SitemapParse(c echo.Context) error { - var req v1.SitemapParseReq - if err := c.Bind(&req); err != nil { - return h.NewResponseWithError(c, "request body is invalid", err) - } - if err := c.Validate(req); err != nil { - return h.NewResponseWithError(c, "validate request body failed", err) - } - - resp, err := h.usecase.SitemapGetUrls(c.Request().Context(), req.URL) - if err != nil { - return h.NewResponseWithError(c, "parse sitemap url failed", err) - } - return h.NewResponseWithData(c, resp) -} - -// SitemapScrape -// -// @Tags crawler -// @Summary SitemapScrape -// @Description SitemapScrape -// @Accept json -// @Produce json -// @Param body body v1.SitemapScrapeReq true "Parse URL" -// @Success 200 {object} domain.PWResponse{data=v1.SitemapScrapeResp} -// @Router /api/v1/crawler/sitemap/scrape [post] -func (h *CrawlerHandler) SitemapScrape(c echo.Context) error { - var req v1.SitemapScrapeReq - if err := c.Bind(&req); err != nil { - return h.NewResponseWithError(c, "request body is invalid", err) - } - if err := c.Validate(req); err != nil { - return h.NewResponseWithError(c, "validate request body failed", err) - } - - resp, err := h.usecase.SitemapGetDoc(c.Request().Context(), &req) - if err != nil { - return h.NewResponseWithError(c, "parse sitemap url failed", err) - } - return h.NewResponseWithData(c, resp) -} - -// SiyuanParse -// -// @Summary SiyuanParse -// @Description Parse Siyuan Export File and return document list -// @Tags crawler -// @Accept multipart/form-data -// @Produce json -// @Param file formData file true "file" -// @Param kb_id formData string true "kb_id" -// @Success 200 {object} domain.PWResponse{data=v1.SiyuanParseResp} -// @Router /api/v1/crawler/siyuan/parse [post] -func (h *CrawlerHandler) SiyuanParse(c echo.Context) error { - ctx := c.Request().Context() - - file, err := c.FormFile("file") - if err != nil { - return h.NewResponseWithError(c, "get file failed", err) - } - - var req v1.SiyuanParseReq - req.KbID = c.FormValue("kb_id") - if err := c.Validate(req); err != nil { - return h.NewResponseWithError(c, "validate failed", err) - } - - fileUrl, err := h.fileUsecase.UploadFileGetUrl(ctx, req.KbID, file) - if err != nil { - return h.NewResponseWithError(c, "upload failed", err) - } - - h.logger.Info("SiyuanParse UploadFile successfully", "fileUrl", fileUrl) - - resp, err := h.usecase.SiyuanParse(c.Request().Context(), fileUrl, file.Filename) - if err != nil { - return h.NewResponseWithError(c, "parse Siyuan export file failed", err) - } - - return h.NewResponseWithData(c, resp) -} - -// SiyuanScrape -// -// @Tags crawler -// @Summary SiyuanScrape -// @Description Scrape specific Siyuan documents by ID -// @Accept json -// @Produce json -// @Param body body v1.SiyuanScrapeReq true "Scrape Request" -// @Success 200 {object} domain.PWResponse{data=v1.SiyuanScrapeResp} -// @Router /api/v1/crawler/siyuan/scrape [post] -func (h *CrawlerHandler) SiyuanScrape(c echo.Context) error { - var req v1.SiyuanScrapeReq - if err := c.Bind(&req); err != nil { - return h.NewResponseWithError(c, "request body is invalid", err) - } - if err := c.Validate(req); err != nil { - return h.NewResponseWithError(c, "validate request body failed", err) - } - - resp, err := h.usecase.SiyuanScrape(c.Request().Context(), &req) - if err != nil { - return h.NewResponseWithError(c, "scrape Siyuan docs failed", err) - } - return h.NewResponseWithData(c, resp) -} - -// MindocParse -// -// @Summary MindocParse -// @Description Parse Mindoc Export File and return document list -// @Tags crawler -// @Accept multipart/form-data -// @Produce json -// @Param file formData file true "file" -// @Param kb_id formData string true "kb_id" -// @Success 200 {object} domain.PWResponse{data=v1.MindocParseResp} -// @Router /api/v1/crawler/mindoc/parse [post] -func (h *CrawlerHandler) MindocParse(c echo.Context) error { - ctx := c.Request().Context() - - file, err := c.FormFile("file") - if err != nil { - return h.NewResponseWithError(c, "get file failed", err) - } - - var req v1.MindocParseReq - req.KbID = c.FormValue("kb_id") - if err := c.Validate(req); err != nil { - return h.NewResponseWithError(c, "validate failed", err) - } - - fileUrl, err := h.fileUsecase.UploadFileGetUrl(ctx, req.KbID, file) - if err != nil { - return h.NewResponseWithError(c, "upload failed", err) - } - - h.logger.Info("MindocParse UploadFile successfully", "fileUrl", fileUrl) - - resp, err := h.usecase.MindocParse(c.Request().Context(), fileUrl, file.Filename) - if err != nil { - return h.NewResponseWithError(c, "parse Mindoc export file failed", err) - } - - return h.NewResponseWithData(c, resp) -} - -// MindocScrape -// -// @Tags crawler -// @Summary MindocScrape -// @Description Scrape specific Mindoc documents by ID -// @Accept json -// @Produce json -// @Param body body v1.MindocScrapeReq true "Scrape Request" -// @Success 200 {object} domain.PWResponse{data=v1.MindocScrapeResp} -// @Router /api/v1/crawler/mindoc/scrape [post] -func (h *CrawlerHandler) MindocScrape(c echo.Context) error { - var req v1.MindocScrapeReq - if err := c.Bind(&req); err != nil { - return h.NewResponseWithError(c, "request body is invalid", err) - } - if err := c.Validate(req); err != nil { - return h.NewResponseWithError(c, "validate request body failed", err) - } - - resp, err := h.usecase.MindocScrape(c.Request().Context(), &req) - if err != nil { - return h.NewResponseWithError(c, "scrape Mindoc docs failed", err) - } - return h.NewResponseWithData(c, resp) -} - -// WikijsParse -// -// @Summary WikijsParse -// @Description Parse Wikijs Export File and return document list -// @Tags crawler -// @Accept multipart/form-data -// @Produce json -// @Param file formData file true "file" -// @Param kb_id formData string true "kb_id" -// @Success 200 {object} domain.PWResponse{data=v1.WikijsParseResp} -// @Router /api/v1/crawler/wikijs/parse [post] -func (h *CrawlerHandler) WikijsParse(c echo.Context) error { - ctx := c.Request().Context() - - file, err := c.FormFile("file") - if err != nil { - return h.NewResponseWithError(c, "get file failed", err) - } - - var req v1.WikijsParseReq - req.KbID = c.FormValue("kb_id") - if err := c.Validate(req); err != nil { - return h.NewResponseWithError(c, "validate failed", err) - } - - fileUrl, err := h.fileUsecase.UploadFileGetUrl(ctx, req.KbID, file) - if err != nil { - return h.NewResponseWithError(c, "upload failed", err) - } - - h.logger.Info("WikijsParse UploadFile successfully", "fileUrl", fileUrl) - - resp, err := h.usecase.WikijsParse(c.Request().Context(), fileUrl, file.Filename) - if err != nil { - return h.NewResponseWithError(c, "parse Wikijs export file failed", err) - } - - return h.NewResponseWithData(c, resp) -} - -// WikijsScrape -// -// @Tags crawler -// @Summary WikijsScrape -// @Description Scrape specific Wikijs documents by ID -// @Accept json -// @Produce json -// @Param body body v1.WikijsScrapeReq true "Scrape Request" -// @Success 200 {object} domain.PWResponse{data=v1.WikijsScrapeResp} -// @Router /api/v1/crawler/wikijs/scrape [post] -func (h *CrawlerHandler) WikijsScrape(c echo.Context) error { - var req v1.WikijsScrapeReq - if err := c.Bind(&req); err != nil { - return h.NewResponseWithError(c, "request body is invalid", err) - } - if err := c.Validate(req); err != nil { - return h.NewResponseWithError(c, "validate request body failed", err) - } - - resp, err := h.usecase.WikijsScrape(c.Request().Context(), &req) - if err != nil { - return h.NewResponseWithError(c, "scrape Wikijs docs failed", err) - } - return h.NewResponseWithData(c, resp) -} diff --git a/backend/pkg/anydoc/anydoc.go b/backend/pkg/anydoc/anydoc.go index ac422cfa..152121c3 100644 --- a/backend/pkg/anydoc/anydoc.go +++ b/backend/pkg/anydoc/anydoc.go @@ -72,7 +72,7 @@ func NewClient(logger *log.Logger, mqConsumer mq.MQConsumer) (*Client, error) { return client, nil } -func (c *Client) GetUrlList(ctx context.Context, targetURL, id string) (*GetUrlListData, error) { +func (c *Client) GetUrlList(ctx context.Context, targetURL, id string) (*ListDocResponse, error) { u, err := url.Parse(crawlerServiceHost) if err != nil { @@ -99,7 +99,7 @@ func (c *Client) GetUrlList(ctx context.Context, targetURL, id string) (*GetUrlL return nil, err } c.logger.Info("scrape url", "requestURL:", requestURL, "resp", string(respBody)) - var scrapeResp GetUrlListResponse + var scrapeResp ListDocResponse err = json.Unmarshal(respBody, &scrapeResp) if err != nil { return nil, err @@ -109,11 +109,7 @@ func (c *Client) GetUrlList(ctx context.Context, targetURL, id string) (*GetUrlL return nil, errors.New(scrapeResp.Msg) } - if len(scrapeResp.Data.Docs) == 0 { - return nil, errors.New("data list is empty") - } - - return &scrapeResp.Data, nil + return &scrapeResp, nil } func (c *Client) UrlExport(ctx context.Context, id, docID, kbId string) (*UrlExportRes, error) { diff --git a/backend/pkg/anydoc/confluence.go b/backend/pkg/anydoc/confluence.go index 29a1d16f..8747feb0 100644 --- a/backend/pkg/anydoc/confluence.go +++ b/backend/pkg/anydoc/confluence.go @@ -23,25 +23,6 @@ type ConfluenceListDocsRequest struct { UUID string `json:"uuid"` // 必填的唯一标识符 } -// ConfluenceListDocsResponse Confluence 获取文档列表响应 -type ConfluenceListDocsResponse struct { - Success bool `json:"success"` - Msg string `json:"msg"` - Data ConfluenceListDocsData `json:"data"` -} - -// ConfluenceListDocsData Confluence 文档列表数据 -type ConfluenceListDocsData struct { - Docs []ConfluenceDoc `json:"docs"` -} - -// ConfluenceDoc Confluence 文档信息 -type ConfluenceDoc struct { - ID string `json:"id"` - Title string `json:"title"` - URL string `json:"url"` -} - // ConfluenceExportDocRequest Confluence 导出文档请求 type ConfluenceExportDocRequest struct { UUID string `json:"uuid"` // 必须与 list 接口使用的 uuid 相同 @@ -63,7 +44,7 @@ type ConfluenceExportDocData struct { } // ConfluenceListDocs 获取 Confluence 文档列表 -func (c *Client) ConfluenceListDocs(ctx context.Context, confluenceURL, filename, uuid string) (*ConfluenceListDocsResponse, error) { +func (c *Client) ConfluenceListDocs(ctx context.Context, confluenceURL, filename, uuid string) (*ListDocResponse, error) { u, err := url.Parse(crawlerServiceHost) if err != nil { return nil, err @@ -101,7 +82,7 @@ func (c *Client) ConfluenceListDocs(ctx context.Context, confluenceURL, filename c.logger.Info("ConfluenceListDocs", "requestURL:", requestURL, "resp", string(respBody)) - var confluenceResp ConfluenceListDocsResponse + var confluenceResp ListDocResponse err = json.Unmarshal(respBody, &confluenceResp) if err != nil { return nil, err diff --git a/backend/pkg/anydoc/epub.go b/backend/pkg/anydoc/epub.go index f2ecaaa2..a8f9e0f8 100644 --- a/backend/pkg/anydoc/epub.go +++ b/backend/pkg/anydoc/epub.go @@ -63,7 +63,7 @@ type EpubpExportDocData struct { } // EpubpListDocs 获取 Epubp 文档列表 -func (c *Client) EpubpListDocs(ctx context.Context, epubpURL, filename, uuid string) (*EpubpListDocsResponse, error) { +func (c *Client) EpubpListDocs(ctx context.Context, epubpURL, filename, uuid string) (*ListDocResponse, error) { u, err := url.Parse(crawlerServiceHost) if err != nil { return nil, err @@ -101,7 +101,7 @@ func (c *Client) EpubpListDocs(ctx context.Context, epubpURL, filename, uuid str c.logger.Info("EpubpListDocs", "requestURL:", requestURL, "resp", string(respBody)) - var epubpResp EpubpListDocsResponse + var epubpResp ListDocResponse err = json.Unmarshal(respBody, &epubpResp) if err != nil { return nil, err diff --git a/backend/pkg/anydoc/feishu.go b/backend/pkg/anydoc/feishu.go index e1bf6642..ca7ecf05 100644 --- a/backend/pkg/anydoc/feishu.go +++ b/backend/pkg/anydoc/feishu.go @@ -64,7 +64,7 @@ type FeishuExportDocData struct { } // FeishuListDocs 获取 Feishu 文档列表 -func (c *Client) FeishuListDocs(ctx context.Context, uuid, appId, appSecret, accessToken, spaceId string) (*FeishuListDocsResponse, error) { +func (c *Client) FeishuListDocs(ctx context.Context, uuid, appId, appSecret, accessToken, spaceId string) (*ListDocResponse, error) { u, err := url.Parse(crawlerServiceHost) if err != nil { return nil, err @@ -101,7 +101,7 @@ func (c *Client) FeishuListDocs(ctx context.Context, uuid, appId, appSecret, acc c.logger.Info("FeishuListDocs", "requestURL:", requestURL, "resp", string(respBody)) - var feishuResp FeishuListDocsResponse + var feishuResp ListDocResponse err = json.Unmarshal(respBody, &feishuResp) if err != nil { return nil, err @@ -115,7 +115,7 @@ func (c *Client) FeishuListDocs(ctx context.Context, uuid, appId, appSecret, acc } // FeishuExportDoc 导出 Feishu 文档 -func (c *Client) FeishuExportDoc(ctx context.Context, uuid, docID, fileType, spaceId, kbId string) (*FeishuExportDocResponse, error) { +func (c *Client) FeishuExportDoc(ctx context.Context, uuid, docID, fileType, spaceId, kbId string) (*UrlExportRes, error) { u, err := url.Parse(crawlerServiceHost) if err != nil { return nil, err @@ -161,7 +161,7 @@ func (c *Client) FeishuExportDoc(ctx context.Context, uuid, docID, fileType, spa c.logger.Info("FeishuDoc", "requestURL:", requestURL, "body", string(jsonData), "resp", string(respBody)) - var exportResp FeishuExportDocResponse + var exportResp UrlExportRes err = json.Unmarshal(respBody, &exportResp) if err != nil { return nil, err diff --git a/backend/pkg/anydoc/mindoc.go b/backend/pkg/anydoc/mindoc.go index c7bb508a..643e296c 100644 --- a/backend/pkg/anydoc/mindoc.go +++ b/backend/pkg/anydoc/mindoc.go @@ -63,7 +63,7 @@ type MindocExportDocData struct { } // MindocListDocs 获取 Mindoc 文档列表 -func (c *Client) MindocListDocs(ctx context.Context, mindocURL, filename, uuid string) (*MindocListDocsResponse, error) { +func (c *Client) MindocListDocs(ctx context.Context, mindocURL, filename, uuid string) (*ListDocResponse, error) { u, err := url.Parse(crawlerServiceHost) if err != nil { return nil, err @@ -101,7 +101,7 @@ func (c *Client) MindocListDocs(ctx context.Context, mindocURL, filename, uuid s c.logger.Info("MindocListDocs", "requestURL:", requestURL, "resp", string(respBody)) - var mindocResp MindocListDocsResponse + var mindocResp ListDocResponse err = json.Unmarshal(respBody, &mindocResp) if err != nil { return nil, err diff --git a/backend/pkg/anydoc/notion.go b/backend/pkg/anydoc/notion.go index 596822e9..658de00b 100644 --- a/backend/pkg/anydoc/notion.go +++ b/backend/pkg/anydoc/notion.go @@ -43,7 +43,7 @@ type NotionExportDocResponse struct { } // NotionListDocs 获取 Notion 文档列表 -func (c *Client) NotionListDocs(ctx context.Context, secret, uuid string) (*NotionListDocsResponse, error) { +func (c *Client) NotionListDocs(ctx context.Context, secret, uuid string) (*ListDocResponse, error) { u, err := url.Parse(crawlerServiceHost) if err != nil { return nil, err @@ -76,7 +76,7 @@ func (c *Client) NotionListDocs(ctx context.Context, secret, uuid string) (*Noti c.logger.Info("NotionListDocs", "requestURL:", requestURL, "resp", string(respBody)) - var notionResp NotionListDocsResponse + var notionResp ListDocResponse err = json.Unmarshal(respBody, ¬ionResp) if err != nil { return nil, err diff --git a/backend/pkg/anydoc/res.go b/backend/pkg/anydoc/res.go index bbb1a296..e84b7eb4 100644 --- a/backend/pkg/anydoc/res.go +++ b/backend/pkg/anydoc/res.go @@ -36,3 +36,28 @@ type TaskRes struct { } `json:"data"` Msg string `json:"msg"` } + +type ListDocResponse struct { + Success bool `json:"success"` + Data ListDocsData `json:"data"` + Msg string `json:"msg"` + Err string `json:"err"` + TraceID string `json:"trace_id"` +} + +type ListDocsData struct { + Docs Child `json:"docs"` +} + +type Value struct { + ID string `json:"id"` + File bool `json:"file"` + FileType string `json:"file_type"` + Title string `json:"title"` + Summary string `json:"summary"` +} + +type Child struct { + Value Value `json:"value"` + Children []Child `json:"children"` +} diff --git a/backend/pkg/anydoc/rss.go b/backend/pkg/anydoc/rss.go index fd7c6a6a..0985eaba 100644 --- a/backend/pkg/anydoc/rss.go +++ b/backend/pkg/anydoc/rss.go @@ -57,7 +57,7 @@ type RssExportDocData struct { } // RssListDocs 获取 Rss 文档列表 -func (c *Client) RssListDocs(ctx context.Context, uuid, xmlUrl string) (*RssListDocsResponse, error) { +func (c *Client) RssListDocs(ctx context.Context, xmlUrl, uuid string) (*ListDocResponse, error) { u, err := url.Parse(crawlerServiceHost) if err != nil { return nil, err @@ -89,7 +89,7 @@ func (c *Client) RssListDocs(ctx context.Context, uuid, xmlUrl string) (*RssList c.logger.Info("RssListDocs", "requestURL:", requestURL, "resp", string(respBody)) - var rssResp RssListDocsResponse + var rssResp ListDocResponse err = json.Unmarshal(respBody, &rssResp) if err != nil { return nil, err diff --git a/backend/pkg/anydoc/sitemap.go b/backend/pkg/anydoc/sitemap.go index afba6d7d..13db9c29 100644 --- a/backend/pkg/anydoc/sitemap.go +++ b/backend/pkg/anydoc/sitemap.go @@ -57,7 +57,7 @@ type SitemapExportDocData struct { } // SitemapListDocs 获取 Sitemap 文档列表 -func (c *Client) SitemapListDocs(ctx context.Context, uuid, xmlUrl string) (*SitemapListDocsResponse, error) { +func (c *Client) SitemapListDocs(ctx context.Context, xmlUrl, uuid string) (*ListDocResponse, error) { u, err := url.Parse(crawlerServiceHost) if err != nil { return nil, err @@ -89,7 +89,7 @@ func (c *Client) SitemapListDocs(ctx context.Context, uuid, xmlUrl string) (*Sit c.logger.Info("SitemapListDocs", "requestURL:", requestURL, "resp", string(respBody)) - var sitemapResp SitemapListDocsResponse + var sitemapResp ListDocResponse err = json.Unmarshal(respBody, &sitemapResp) if err != nil { return nil, err diff --git a/backend/pkg/anydoc/siyuan.go b/backend/pkg/anydoc/siyuan.go index c4f2e423..ff11fd09 100644 --- a/backend/pkg/anydoc/siyuan.go +++ b/backend/pkg/anydoc/siyuan.go @@ -63,7 +63,7 @@ type SiyuanExportDocData struct { } // SiyuanListDocs 获取 Siyuan 文档列表 -func (c *Client) SiyuanListDocs(ctx context.Context, siyuanURL, filename, uuid string) (*SiyuanListDocsResponse, error) { +func (c *Client) SiyuanListDocs(ctx context.Context, siyuanURL, filename, uuid string) (*ListDocResponse, error) { u, err := url.Parse(crawlerServiceHost) if err != nil { return nil, err @@ -101,7 +101,7 @@ func (c *Client) SiyuanListDocs(ctx context.Context, siyuanURL, filename, uuid s c.logger.Info("SiyuanListDocs", "requestURL:", requestURL, "resp", string(respBody)) - var siyuanResp SiyuanListDocsResponse + var siyuanResp ListDocResponse err = json.Unmarshal(respBody, &siyuanResp) if err != nil { return nil, err diff --git a/backend/pkg/anydoc/wikijs.go b/backend/pkg/anydoc/wikijs.go index cc67690c..cfaef84b 100644 --- a/backend/pkg/anydoc/wikijs.go +++ b/backend/pkg/anydoc/wikijs.go @@ -23,25 +23,6 @@ type WikijsListDocsRequest struct { UUID string `json:"uuid"` // 必填的唯一标识符 } -// WikijsListDocsResponse Wikijs 获取文档列表响应 -type WikijsListDocsResponse struct { - Success bool `json:"success"` - Msg string `json:"msg"` - Data WikijsListDocsData `json:"data"` -} - -// WikijsListDocsData Wikijs 文档列表数据 -type WikijsListDocsData struct { - Docs []WikijsDoc `json:"docs"` -} - -// WikijsDoc Wikijs 文档信息 -type WikijsDoc struct { - ID string `json:"id"` - Title string `json:"title"` - URL string `json:"url"` -} - // WikijsExportDocRequest Wikijs 导出文档请求 type WikijsExportDocRequest struct { UUID string `json:"uuid"` // 必须与 list 接口使用的 uuid 相同 @@ -63,7 +44,7 @@ type WikijsExportDocData struct { } // WikijsListDocs 获取 Wikijs 文档列表 -func (c *Client) WikijsListDocs(ctx context.Context, wikijsURL, filename, uuid string) (*WikijsListDocsResponse, error) { +func (c *Client) WikijsListDocs(ctx context.Context, wikijsURL, filename, uuid string) (*ListDocResponse, error) { u, err := url.Parse(crawlerServiceHost) if err != nil { return nil, err @@ -101,7 +82,7 @@ func (c *Client) WikijsListDocs(ctx context.Context, wikijsURL, filename, uuid s c.logger.Info("WikijsListDocs", "requestURL:", requestURL, "resp", string(respBody)) - var wikijsResp WikijsListDocsResponse + var wikijsResp ListDocResponse err = json.Unmarshal(respBody, &wikijsResp) if err != nil { return nil, err diff --git a/backend/pkg/anydoc/yuque.go b/backend/pkg/anydoc/yuque.go index c8753012..f15bfc95 100644 --- a/backend/pkg/anydoc/yuque.go +++ b/backend/pkg/anydoc/yuque.go @@ -55,7 +55,7 @@ type YuqueExportDocResponse struct { } // YuqueListDocs 获取 Yuque 文档列表 -func (c *Client) YuqueListDocs(ctx context.Context, yuqueURL, filename, uuid string) (*YuqueListDocsResponse, error) { +func (c *Client) YuqueListDocs(ctx context.Context, yuqueURL, filename, uuid string) (*ListDocResponse, error) { u, err := url.Parse(crawlerServiceHost) if err != nil { return nil, err @@ -93,7 +93,7 @@ func (c *Client) YuqueListDocs(ctx context.Context, yuqueURL, filename, uuid str c.logger.Info("YuqueListDocs", "requestURL:", requestURL, "resp", string(respBody)) - var yuqueResp YuqueListDocsResponse + var yuqueResp ListDocResponse err = json.Unmarshal(respBody, &yuqueResp) if err != nil { return nil, err diff --git a/backend/usecase/crawler.go b/backend/usecase/crawler.go index 7de0ff55..f37f9c40 100644 --- a/backend/usecase/crawler.go +++ b/backend/usecase/crawler.go @@ -3,11 +3,9 @@ package usecase import ( "context" "crypto/tls" - "errors" "fmt" "net/http" "slices" - "strings" "github.com/google/uuid" @@ -46,33 +44,116 @@ func NewCrawlerUsecase(logger *log.Logger, mqConsumer mq.MQConsumer, cache *cach }, nil } -func (u *CrawlerUsecase) ScrapeURL(ctx context.Context, targetURL, kbID string) (*v1.ScrapeResp, error) { - if strings.HasPrefix(targetURL, "/static-file") { - targetURL = "https://panda-wiki-nginx:8080" + targetURL - } - - id := utils.GetFileNameWithoutExt(targetURL) +func (u *CrawlerUsecase) ParseUrl(ctx context.Context, req *v1.CrawlerParseReq) (*v1.CrawlerParseResp, error) { + id := utils.GetFileNameWithoutExt(req.Key) if !utils.IsUUID(id) { id = uuid.New().String() } - getUrlRes, err := u.anydocClient.GetUrlList(ctx, targetURL, id) - if err != nil { - return nil, err + // 文件类型的解析会先走上传接口 + if req.CrawlerSource.Type() == consts.CrawlerSourceTypeFile { + req.Key = fmt.Sprintf("http://panda-wiki-minio:9000/static-file/%s", req.Key) + } + + var ( + docs *anydoc.ListDocResponse + err error + ) + switch req.CrawlerSource { + + case consts.CrawlerSourceFeishu: + docs, err = u.anydocClient.FeishuListDocs(ctx, id, req.FeishuSetting.AppID, req.FeishuSetting.AppSecret, req.FeishuSetting.UserAccessToken, req.FeishuSetting.SpaceId) + if err != nil { + return nil, err + } + + case consts.CrawlerSourceUrl, consts.CrawlerSourceFile: + docs, err = u.anydocClient.GetUrlList(ctx, req.Key, id) + if err != nil { + return nil, err + } + + case consts.CrawlerSourceConfluence: + docs, err = u.anydocClient.ConfluenceListDocs(ctx, req.Key, req.Filename, id) + if err != nil { + return nil, err + } + case consts.CrawlerSourceEpub: + docs, err = u.anydocClient.EpubpListDocs(ctx, req.Key, req.Filename, id) + if err != nil { + return nil, err + } + case consts.CrawlerSourceMindoc: + docs, err = u.anydocClient.MindocListDocs(ctx, req.Key, req.Filename, id) + if err != nil { + return nil, err + } + case consts.CrawlerSourceWikijs: + docs, err = u.anydocClient.WikijsListDocs(ctx, req.Key, req.Filename, id) + if err != nil { + return nil, err + } + + case consts.CrawlerSourceSiyuan: + docs, err = u.anydocClient.SiyuanListDocs(ctx, req.Key, req.Filename, id) + if err != nil { + return nil, err + } + + case consts.CrawlerSourceYuque: + docs, err = u.anydocClient.YuqueListDocs(ctx, req.Key, req.Filename, id) + if err != nil { + return nil, err + } + + case consts.CrawlerSourceSitemap: + docs, err = u.anydocClient.SitemapListDocs(ctx, req.Key, id) + if err != nil { + return nil, err + } + + case consts.CrawlerSourceRSS: + docs, err = u.anydocClient.RssListDocs(ctx, req.Key, id) + if err != nil { + return nil, err + } + + case consts.CrawlerSourceNotion: + docs, err = u.anydocClient.NotionListDocs(ctx, req.Key, id) + if err != nil { + return nil, err + } + + default: + return nil, fmt.Errorf("parse type %s is not supported", req.CrawlerSource) } - if len(getUrlRes.Docs) == 0 { - return nil, errors.New("get getUrlRes Docs failed") + result := &v1.CrawlerParseResp{ + ID: id, + Docs: docs.Data.Docs, } - urlExportRes, err := u.anydocClient.UrlExport(ctx, id, getUrlRes.Docs[0].Id, kbID) - if err != nil { - return nil, err + return result, nil +} + +func (u *CrawlerUsecase) ExportDoc(ctx context.Context, req *v1.CrawlerExportReq) (*v1.CrawlerExportResp, error) { + var taskId string + if req.SpaceId != "" { + urlExportRes, err := u.anydocClient.FeishuExportDoc(ctx, req.ID, req.DocID, req.FileType, req.SpaceId, req.KbID) + if err != nil { + return nil, err + } + taskId = urlExportRes.Data + } else { + urlExportRes, err := u.anydocClient.UrlExport(ctx, req.ID, req.DocID, req.KbID) + if err != nil { + return nil, err + } + taskId = urlExportRes.Data } - return &v1.ScrapeResp{ - TaskId: urlExportRes.Data, - Title: getUrlRes.Docs[0].Title, + return &v1.CrawlerExportResp{ + TaskId: taskId, }, nil } @@ -136,407 +217,3 @@ func (u *CrawlerUsecase) ScrapeGetResults(ctx context.Context, taskIds []string) List: list, }, nil } - -func (u *CrawlerUsecase) ConfluenceParse(ctx context.Context, targetURL, filename string) (*v1.ConfluenceParseResp, error) { - id := utils.GetFileNameWithoutExt(targetURL) - if !utils.IsUUID(id) { - id = uuid.New().String() - } - - docs, err := u.anydocClient.ConfluenceListDocs(ctx, targetURL, filename, id) - if err != nil { - return nil, err - } - - items := make([]v1.ConfluenceParseItem, 0, len(docs.Data.Docs)) - for _, doc := range docs.Data.Docs { - items = append(items, v1.ConfluenceParseItem{ - ID: doc.ID, - Title: doc.Title, - URL: doc.URL, - }) - } - - result := &v1.ConfluenceParseResp{ - ID: id, - Docs: items, - } - - return result, nil -} - -// ConfluenceScrape 根据文档ID列表抓取具体内容 -func (u *CrawlerUsecase) ConfluenceScrape(ctx context.Context, req *v1.ConfluenceScrapeReq) (*v1.ConfluenceScrapeResp, error) { - - exportResp, err := u.anydocClient.ConfluenceExportDoc(ctx, req.ID, req.DocID, req.KbID) - if err != nil { - u.logger.Error("export confluence doc failed", "doc_id", req.DocID, "error", err) - return nil, err - } - - taskRes, err := u.anydocClient.TaskWaitForCompletion(ctx, exportResp.Data) - if err != nil { - u.logger.Error("wait for task completion failed", "task_id", exportResp.Data, "error", err) - return nil, err - } - - fileBytes, err := u.anydocClient.DownloadDoc(ctx, taskRes.Markdown) - if err != nil { - u.logger.Error("download doc failed", "markdown_path", taskRes.Markdown, "error", err) - return nil, err - } - - return &v1.ConfluenceScrapeResp{Content: string(fileBytes)}, nil -} - -func (u *CrawlerUsecase) NotionGetDocList(ctx context.Context, integration string) (*v1.NotionParseResp, error) { - id := uuid.New().String() - - notionListResp, err := u.anydocClient.NotionListDocs(ctx, integration, id) - if err != nil { - return nil, err - } - - var results []v1.NotionParseItem - - for _, doc := range notionListResp.Data.Docs { - results = append(results, v1.NotionParseItem{ - ID: doc.ID, - Title: doc.Title, - }) - } - return &v1.NotionParseResp{ - ID: id, - Docs: results, - }, nil -} - -func (u *CrawlerUsecase) NotionGetDoc(ctx context.Context, req v1.NotionScrapeReq) (*v1.NotionScrapeResp, error) { - - exportResp, err := u.anydocClient.NotionExportDoc(ctx, req.ID, req.DocId, req.KbID) - if err != nil { - u.logger.Error("export doc failed", "doc_id", req.DocId, "error", err) - return nil, err - } - - taskRes, err := u.anydocClient.TaskWaitForCompletion(ctx, exportResp.Data) - if err != nil { - u.logger.Error("wait for task completion failed", "task_id", exportResp.Data, "error", err) - return nil, err - } - - fileBytes, err := u.anydocClient.DownloadDoc(ctx, taskRes.Markdown) - if err != nil { - u.logger.Error("download doc failed", "markdown_path", taskRes.Markdown, "error", err) - return nil, err - } - - u.logger.Debug("taskRes:", "id", req.DocId, "file", string(fileBytes)) - - return &v1.NotionScrapeResp{ - Content: string(fileBytes), - }, nil -} - -func (u *CrawlerUsecase) SitemapGetUrls(ctx context.Context, xmlUrl string) (*v1.SitemapParseResp, error) { - - id := uuid.New().String() - - res, err := u.anydocClient.SitemapListDocs(ctx, id, xmlUrl) - if err != nil { - return nil, err - } - var items []v1.SitemapParseItem - for _, doc := range res.Data.Docs { - items = append(items, v1.SitemapParseItem{ - URL: doc.Id, - Title: doc.Title, - }) - } - - resp := &v1.SitemapParseResp{ - ID: id, - List: items, - } - - return resp, nil -} - -func (u *CrawlerUsecase) SitemapGetDoc(ctx context.Context, req *v1.SitemapScrapeReq) (*v1.SitemapScrapeResp, error) { - - urlExportRes, err := u.anydocClient.SitemapExportDoc(ctx, req.ID, req.URL, req.KbID) - if err != nil { - return nil, err - } - - taskRes, err := u.anydocClient.TaskWaitForCompletion(ctx, urlExportRes.Data) - if err != nil { - return nil, err - } - - fileBytes, err := u.anydocClient.DownloadDoc(ctx, taskRes.Markdown) - if err != nil { - return nil, err - } - - return &v1.SitemapScrapeResp{ - Content: string(fileBytes), - }, nil -} - -func (u *CrawlerUsecase) GetRSSParse(ctx context.Context, req *v1.RssParseReq) (*v1.RssParseResp, error) { - - id := uuid.New().String() - - res, err := u.anydocClient.RssListDocs(ctx, id, req.URL) - if err != nil { - return nil, err - } - var items []v1.RssParseItem - for _, doc := range res.Data.Docs { - items = append(items, v1.RssParseItem{ - URL: doc.Id, - Title: doc.Title, - Desc: doc.Summary, - }) - } - - return &v1.RssParseResp{ - ID: id, - List: items, - }, nil -} - -func (u *CrawlerUsecase) GetRssDoc(ctx context.Context, req *v1.RssScrapeReq) (*v1.RssScrapeResp, error) { - - urlExportRes, err := u.anydocClient.RssExportDoc(ctx, req.ID, req.URL, req.KbID) - if err != nil { - return nil, err - } - - taskRes, err := u.anydocClient.TaskWaitForCompletion(ctx, urlExportRes.Data) - if err != nil { - return nil, err - } - - fileBytes, err := u.anydocClient.DownloadDoc(ctx, taskRes.Markdown) - if err != nil { - return nil, err - } - - return &v1.RssScrapeResp{ - Content: string(fileBytes), - }, nil -} - -func (u *CrawlerUsecase) SiyuanParse(ctx context.Context, targetURL, filename string) (*v1.SiyuanParseResp, error) { - id := utils.GetFileNameWithoutExt(targetURL) - if !utils.IsUUID(id) { - id = uuid.New().String() - } - - docs, err := u.anydocClient.SiyuanListDocs(ctx, targetURL, filename, id) - if err != nil { - return nil, err - } - - items := make([]v1.SiyuanParseItem, 0, len(docs.Data.Docs)) - for _, doc := range docs.Data.Docs { - items = append(items, v1.SiyuanParseItem{ - ID: doc.ID, - Title: doc.Title, - URL: doc.URL, - }) - } - - result := &v1.SiyuanParseResp{ - ID: id, - Docs: items, - } - - return result, nil -} - -// SiyuanScrape 根据文档ID列表抓取具体内容 -func (u *CrawlerUsecase) SiyuanScrape(ctx context.Context, req *v1.SiyuanScrapeReq) (*v1.SiyuanScrapeResp, error) { - - exportResp, err := u.anydocClient.SiyuanExportDoc(ctx, req.ID, req.DocID, req.KbID) - if err != nil { - u.logger.Error("export Siyuan doc failed", "doc_id", req.DocID, "error", err) - return nil, err - } - - taskRes, err := u.anydocClient.TaskWaitForCompletion(ctx, exportResp.Data) - if err != nil { - u.logger.Error("wait for task completion failed", "task_id", exportResp.Data, "error", err) - return nil, err - } - - fileBytes, err := u.anydocClient.DownloadDoc(ctx, taskRes.Markdown) - if err != nil { - u.logger.Error("download doc failed", "markdown_path", taskRes.Markdown, "error", err) - return nil, err - } - - return &v1.SiyuanScrapeResp{Content: string(fileBytes)}, nil -} - -func (u *CrawlerUsecase) MindocParse(ctx context.Context, targetURL, filename string) (*v1.MindocParseResp, error) { - id := utils.GetFileNameWithoutExt(targetURL) - if !utils.IsUUID(id) { - id = uuid.New().String() - } - - docs, err := u.anydocClient.MindocListDocs(ctx, targetURL, filename, id) - if err != nil { - return nil, err - } - - items := make([]v1.MindocParseItem, 0, len(docs.Data.Docs)) - for _, doc := range docs.Data.Docs { - items = append(items, v1.MindocParseItem{ - ID: doc.ID, - Title: doc.Title, - URL: doc.URL, - }) - } - - result := &v1.MindocParseResp{ - ID: id, - Docs: items, - } - - return result, nil -} - -// MindocScrape 根据文档ID列表抓取具体内容 -func (u *CrawlerUsecase) MindocScrape(ctx context.Context, req *v1.MindocScrapeReq) (*v1.MindocScrapeResp, error) { - - exportResp, err := u.anydocClient.MindocExportDoc(ctx, req.ID, req.DocID, req.KbID) - if err != nil { - u.logger.Error("export Mindoc doc failed", "doc_id", req.DocID, "error", err) - return nil, err - } - - taskRes, err := u.anydocClient.TaskWaitForCompletion(ctx, exportResp.Data) - if err != nil { - u.logger.Error("wait for task completion failed", "task_id", exportResp.Data, "error", err) - return nil, err - } - - fileBytes, err := u.anydocClient.DownloadDoc(ctx, taskRes.Markdown) - if err != nil { - u.logger.Error("download doc failed", "markdown_path", taskRes.Markdown, "error", err) - return nil, err - } - - return &v1.MindocScrapeResp{Content: string(fileBytes)}, nil -} - -func (u *CrawlerUsecase) WikijsParse(ctx context.Context, targetURL, filename string) (*v1.WikijsParseResp, error) { - id := utils.GetFileNameWithoutExt(targetURL) - if !utils.IsUUID(id) { - id = uuid.New().String() - } - - docs, err := u.anydocClient.WikijsListDocs(ctx, targetURL, filename, id) - if err != nil { - return nil, err - } - - items := make([]v1.WikijsParseItem, 0, len(docs.Data.Docs)) - for _, doc := range docs.Data.Docs { - items = append(items, v1.WikijsParseItem{ - ID: doc.ID, - Title: doc.Title, - }) - } - - result := &v1.WikijsParseResp{ - ID: id, - Docs: items, - } - - return result, nil -} - -func (u *CrawlerUsecase) WikijsScrape(ctx context.Context, req *v1.WikijsScrapeReq) (*v1.WikijsScrapeResp, error) { - - exportResp, err := u.anydocClient.WikijsExportDoc(ctx, req.ID, req.DocID, req.KbID) - if err != nil { - u.logger.Error("export Wikijs doc failed", "doc_id", req.DocID, "error", err) - return nil, err - } - - taskRes, err := u.anydocClient.TaskWaitForCompletion(ctx, exportResp.Data) - if err != nil { - u.logger.Error("wait for task completion failed", "task_id", exportResp.Data, "error", err) - return nil, err - } - - fileBytes, err := u.anydocClient.DownloadDoc(ctx, taskRes.Markdown) - if err != nil { - u.logger.Error("download doc failed", "markdown_path", taskRes.Markdown, "error", err) - return nil, err - } - - return &v1.WikijsScrapeResp{Content: string(fileBytes)}, nil -} - -func (u *CrawlerUsecase) EpubParse(ctx context.Context, req *v1.EpubParseReq) (*v1.EpubParseResp, error) { - url := fmt.Sprintf("http://panda-wiki-minio:9000/static-file/%s", req.Key) - - id := utils.GetFileNameWithoutExt(url) - if !utils.IsUUID(id) { - id = uuid.New().String() - } - - epubListResp, err := u.anydocClient.EpubpListDocs(ctx, url, req.Filename, id) - if err != nil { - return nil, err - } - - if len(epubListResp.Data.Docs) != 1 { - return nil, fmt.Errorf("get epubListResp.Data.Docs failed") - } - - doc := epubListResp.Data.Docs[0] - exportResp, err := u.anydocClient.EpubpExportDoc(ctx, id, doc.ID, req.KbID) - if err != nil { - u.logger.Error("export doc failed", "doc_id", doc.ID, "error", err) - return nil, err - } - - return &v1.EpubParseResp{ - TaskID: exportResp.Data, - }, nil -} - -func (u *CrawlerUsecase) YuqueParse(ctx context.Context, req *v1.YuqueParseReq) (*v1.YuqueParseResp, error) { - url := fmt.Sprintf("http://panda-wiki-minio:9000/static-file/%s", req.Key) - - id := utils.GetFileNameWithoutExt(url) - if !utils.IsUUID(id) { - id = uuid.New().String() - } - - yuqueListResp, err := u.anydocClient.YuqueListDocs(ctx, url, req.Filename, id) - if err != nil { - return nil, err - } - - var results []v1.YuqueParseItem - - for _, doc := range yuqueListResp.Data.Docs { - exportResp, err := u.anydocClient.YuqueExportDoc(ctx, id, doc.ID, req.KbID) - if err != nil { - u.logger.Error("export yuque doc failed", "doc_id", doc.ID, "error", err) - continue - } - results = append(results, v1.YuqueParseItem{ - TaskID: exportResp.Data, - Title: doc.Title, - }) - } - return &v1.YuqueParseResp{List: results}, nil -} diff --git a/backend/usecase/crawler_feishu.go b/backend/usecase/crawler_feishu.go deleted file mode 100644 index 99ba722e..00000000 --- a/backend/usecase/crawler_feishu.go +++ /dev/null @@ -1,98 +0,0 @@ -package usecase - -import ( - "context" - - "github.com/google/uuid" - - v1 "github.com/chaitin/panda-wiki/api/crawler/v1" - "github.com/chaitin/panda-wiki/pkg/anydoc" -) - -func (u *CrawlerUsecase) FeishuListSpace(ctx context.Context, req *v1.FeishuSpaceListReq) ([]v1.FeishuSpaceListResp, error) { - id := uuid.New().String() - - feishuListResp, err := u.anydocClient.FeishuListDocs(ctx, id, req.AppID, req.AppSecret, req.UserAccessToken, "") - if err != nil { - return nil, err - } - - var results []v1.FeishuSpaceListResp - for _, doc := range feishuListResp.Data.Docs { - results = append(results, v1.FeishuSpaceListResp{ - SpaceId: doc.ID, - Name: doc.Title, - }) - } - - return results, nil -} - -func (u *CrawlerUsecase) FeishuListCloudDoc(ctx context.Context, req *v1.FeishuListCloudDocReq) ([]v1.FeishuListCloudDocResp, error) { - id := uuid.New().String() - - feishuListResp, err := u.anydocClient.FeishuListDocs(ctx, id, req.AppID, req.AppSecret, req.UserAccessToken, anydoc.SpaceIdCloud) - if err != nil { - return nil, err - } - - var results []v1.FeishuListCloudDocResp - for _, doc := range feishuListResp.Data.Docs { - results = append(results, v1.FeishuListCloudDocResp{ - Title: doc.Title, - ID: id, - DocId: doc.ID, - FileType: doc.FileType, - SpaceId: anydoc.SpaceIdCloud, - }) - } - - return results, nil -} - -func (u *CrawlerUsecase) FeishuSearchWiki(ctx context.Context, req *v1.FeishuSearchWikiReq) ([]v1.FeishuSearchWikiResp, error) { - id := uuid.New().String() - - feishuListResp, err := u.anydocClient.FeishuListDocs(ctx, id, req.AppID, req.AppSecret, req.UserAccessToken, req.SpaceId) - if err != nil { - return nil, err - } - - var results []v1.FeishuSearchWikiResp - for _, doc := range feishuListResp.Data.Docs { - results = append(results, v1.FeishuSearchWikiResp{ - Title: doc.Title, - ID: id, - DocId: doc.ID, - FileType: doc.FileType, - SpaceId: req.SpaceId, - }) - } - - return results, nil -} - -func (u *CrawlerUsecase) FeishuGetDoc(ctx context.Context, req *v1.FeishuGetDocReq) (*v1.FeishuGetDocResp, error) { - - exportResp, err := u.anydocClient.FeishuExportDoc(ctx, req.ID, req.DocId, req.FileType, req.SpaceId, req.KbID) - if err != nil { - u.logger.Error("export doc failed", "doc_id", req.DocId, "error", err) - return nil, err - } - - taskRes, err := u.anydocClient.TaskWaitForCompletion(ctx, exportResp.Data) - if err != nil { - u.logger.Error("wait for task completion failed", "task_id", exportResp.Data, "error", err) - return nil, err - } - - fileBytes, err := u.anydocClient.DownloadDoc(ctx, taskRes.Markdown) - if err != nil { - u.logger.Error("download doc failed", "markdown_path", taskRes.Markdown, "error", err) - return nil, err - } - - return &v1.FeishuGetDocResp{ - Content: string(fileBytes), - }, nil -} From 8416484488db0de86e8ecb0a24f6cbe5bb1fcc87 Mon Sep 17 00:00:00 2001 From: coltea Date: Tue, 28 Oct 2025 11:16:46 +0800 Subject: [PATCH 2/2] feat delete folder --- backend/handler/v1/node.go | 3 --- backend/repo/pg/node.go | 45 +++++++++++++++++++++++++++----------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/backend/handler/v1/node.go b/backend/handler/v1/node.go index 68e2735c..e9db12e3 100644 --- a/backend/handler/v1/node.go +++ b/backend/handler/v1/node.go @@ -173,9 +173,6 @@ func (h *NodeHandler) NodeAction(c echo.Context) error { } ctx := c.Request().Context() if err := h.usecase.NodeAction(ctx, req); err != nil { - if err == domain.ErrNodeParentIDInIDs { - return h.NewResponseWithError(c, "文件夹下有子文件,不能删除~", nil) - } return h.NewResponseWithError(c, "node action failed", err) } return h.NewResponseWithData(c, nil) diff --git a/backend/repo/pg/node.go b/backend/repo/pg/node.go index 0fb9c85e..1bc9c684 100644 --- a/backend/repo/pg/node.go +++ b/backend/repo/pg/node.go @@ -251,20 +251,12 @@ func (r *NodeRepository) GetByID(ctx context.Context, id, kbId string) (*v1.Node func (r *NodeRepository) Delete(ctx context.Context, kbID string, ids []string) ([]string, error) { docIDs := make([]string, 0) if err := r.db.WithContext(ctx).Transaction(func(tx *gorm.DB) error { - // check if node.parent_id in ids - var parentIDs []string - if err := tx.Model(&domain.Node{}). - Where("parent_id IN ?", ids). - Select("parent_id"). - Find(&parentIDs).Error; err != nil { - return err - } - if len(parentIDs) > 0 { - return domain.ErrNodeParentIDInIDs - } + // recursively collect all child node IDs + allIDs := r.collectAllChildNodeIDs(tx, kbID, ids) + var nodes []*domain.Node if err := tx.Model(&domain.Node{}). - Where("id IN ?", ids). + Where("id IN ?", allIDs). Where("kb_id = ?", kbID). Clauses(clause.Returning{Columns: []clause.Column{{Name: "doc_id"}}}). Delete(&nodes).Error; err != nil { @@ -273,7 +265,7 @@ func (r *NodeRepository) Delete(ctx context.Context, kbID string, ids []string) // delete node release var nodeReleases []*domain.NodeRelease if err := tx.Model(&domain.NodeRelease{}). - Where("node_id IN ?", ids). + Where("node_id IN ?", allIDs). Clauses(clause.Returning{Columns: []clause.Column{{Name: "doc_id"}}}). Delete(&nodeReleases).Error; err != nil { return err @@ -295,6 +287,33 @@ func (r *NodeRepository) Delete(ctx context.Context, kbID string, ids []string) return lo.Uniq(docIDs), nil } +// collectAllChildNodeIDs recursively collects all child node IDs for the given parent IDs +func (r *NodeRepository) collectAllChildNodeIDs(tx *gorm.DB, kbID string, parentIDs []string) []string { + allIDs := make([]string, 0) + allIDs = append(allIDs, parentIDs...) + + currentParentIDs := parentIDs + for len(currentParentIDs) > 0 { + var childIDs []string + if err := tx.Model(&domain.Node{}). + Where("parent_id IN ?", currentParentIDs). + Where("kb_id = ?", kbID). + Select("id"). + Find(&childIDs).Error; err != nil { + break + } + + if len(childIDs) == 0 { + break + } + + allIDs = append(allIDs, childIDs...) + currentParentIDs = childIDs + } + + return lo.Uniq(allIDs) +} + func (r *NodeRepository) GetNodeByID(ctx context.Context, id string) (*domain.Node, error) { var node *domain.Node if err := r.db.WithContext(ctx).