修复 画布,mcp服务,搜索,文档的接口

This commit is contained in:
2025-11-07 09:34:35 +08:00
parent c5f8fe06e7
commit 54532747d2
21 changed files with 1023 additions and 272 deletions

View File

@@ -0,0 +1,84 @@
#
# Copyright 2024 The InfiniFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from typing import Optional, List, Dict, Any
from pydantic import BaseModel, Field
class SetConversationRequest(BaseModel):
"""设置对话请求"""
conversation_id: Optional[str] = None
is_new: bool
name: Optional[str] = Field(default="New conversation", max_length=255)
dialog_id: str
class DeleteConversationsRequest(BaseModel):
"""删除对话请求"""
conversation_ids: List[str]
class CompletionRequest(BaseModel):
"""完成请求(聊天完成)"""
conversation_id: str
messages: List[Dict[str, Any]]
llm_id: Optional[str] = None
stream: Optional[bool] = True
temperature: Optional[float] = None
top_p: Optional[float] = None
frequency_penalty: Optional[float] = None
presence_penalty: Optional[float] = None
max_tokens: Optional[int] = None
class TTSRequest(BaseModel):
"""文本转语音请求"""
text: str
class DeleteMessageRequest(BaseModel):
"""删除消息请求"""
conversation_id: str
message_id: str
class ThumbupRequest(BaseModel):
"""点赞/点踩请求"""
conversation_id: str
message_id: str
thumbup: Optional[bool] = None
feedback: Optional[str] = ""
class AskRequest(BaseModel):
"""提问请求"""
question: str
kb_ids: List[str]
search_id: Optional[str] = ""
class MindmapRequest(BaseModel):
"""思维导图请求"""
question: str
kb_ids: List[str]
search_id: Optional[str] = ""
class RelatedQuestionsRequest(BaseModel):
"""相关问题请求"""
question: str
search_id: Optional[str] = ""

View File

@@ -0,0 +1,43 @@
#
# Copyright 2024 The InfiniFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from typing import Optional, List
from pydantic import BaseModel, Field
class CreateFileRequest(BaseModel):
"""创建文件/文件夹请求"""
name: str
parent_id: Optional[str] = None
type: Optional[str] = None
class DeleteFilesRequest(BaseModel):
"""删除文件请求"""
file_ids: List[str]
class RenameFileRequest(BaseModel):
"""重命名文件请求"""
file_id: str
name: str
class MoveFilesRequest(BaseModel):
"""移动文件请求"""
src_file_ids: List[str]
dest_file_id: str

View File

@@ -60,9 +60,16 @@ class CreateKnowledgeBaseRequest(BaseModel):
class UpdateKnowledgeBaseRequest(BaseModel):
"""更新知识库请求"""
kb_id: str
name: str
description: str
parser_id: str
name: Optional[str] = None
avatar: Optional[str] = None
language: Optional[str] = None
description: Optional[str] = None
permission: Optional[str] = None
doc_num: Optional[int] = None
token_num: Optional[int] = None
chunk_num: Optional[int] = None
parser_id: Optional[str] = None
embd_id: Optional[str] = None
pagerank: Optional[int] = None
# 其他可选字段,但排除 id, tenant_id, created_by, create_time, update_time, create_date, update_date

View File

@@ -0,0 +1,53 @@
#
# Copyright 2025 The InfiniFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from typing import Optional, List, Dict, Any
from pydantic import BaseModel, Field
class CreateSearchRequest(BaseModel):
"""创建搜索应用请求"""
name: str
description: Optional[str] = ""
class UpdateSearchRequest(BaseModel):
"""更新搜索应用请求"""
search_id: str
name: str
search_config: Dict[str, Any]
tenant_id: str
description: Optional[str] = None
class DeleteSearchRequest(BaseModel):
"""删除搜索应用请求"""
search_id: str
class ListSearchAppsQuery(BaseModel):
"""列出搜索应用查询参数"""
keywords: Optional[str] = ""
page: Optional[int] = 0
page_size: Optional[int] = 0
orderby: Optional[str] = "create_time"
desc: Optional[str] = "true"
class ListSearchAppsBody(BaseModel):
"""列出搜索应用请求体"""
owner_ids: Optional[List[str]] = []