fix: Complete document parameters

--bug=1052250 --user=王孝刚 【API】在swagger上调用对话API ,希望把参数给补充完整。(比如,上传文档的一些参数) https://www.tapd.cn/57709429/s/1655242
This commit is contained in:
wxg0103 2025-02-18 11:13:06 +08:00 committed by wxg
parent 237dd8c209
commit f00c9ca611
4 changed files with 175 additions and 16 deletions

View File

@ -48,7 +48,8 @@ class OpenAIChatApi(ApiMixin):
'chat_id': openapi.Schema(type=openapi.TYPE_STRING, title=_("Conversation ID")),
're_chat': openapi.Schema(type=openapi.TYPE_BOOLEAN, title=_("regenerate"),
default=False),
'stream': openapi.Schema(type=openapi.TYPE_BOOLEAN, title=_("Stream Output"), default=True)
'stream': openapi.Schema(type=openapi.TYPE_BOOLEAN, title=_("Stream Output"),
default=True)
})
@ -62,7 +63,66 @@ class ChatApi(ApiMixin):
properties={
'message': openapi.Schema(type=openapi.TYPE_STRING, title=_("problem"), description=_("problem")),
're_chat': openapi.Schema(type=openapi.TYPE_BOOLEAN, title=_("regenerate"), default=False),
'stream': openapi.Schema(type=openapi.TYPE_BOOLEAN, title=_("Is it streaming output"), default=True)
'stream': openapi.Schema(type=openapi.TYPE_BOOLEAN, title=_("Is it streaming output"), default=True),
'form_data': openapi.Schema(type=openapi.TYPE_OBJECT, title=_("Form data"),
description=_("Form data"),
default={}),
'image_list': openapi.Schema(
type=openapi.TYPE_ARRAY,
title=_("Image list"),
description=_("Image list"),
items=openapi.Schema(
type=openapi.TYPE_OBJECT,
properties={
'name': openapi.Schema(type=openapi.TYPE_STRING,
title=_("Image name")),
'url': openapi.Schema(type=openapi.TYPE_STRING,
title=_("Image URL")),
'file_id': openapi.Schema(type=openapi.TYPE_STRING),
}
),
default=[]
),
'document_list': openapi.Schema(type=openapi.TYPE_ARRAY, title=_("Document list"),
description=_("Document list"),
items=openapi.Schema(
type=openapi.TYPE_OBJECT,
properties={
# 定义对象的具体属性
'name': openapi.Schema(type=openapi.TYPE_STRING,
title=_("Document name")),
'url': openapi.Schema(type=openapi.TYPE_STRING,
title=_("Document URL")),
'file_id': openapi.Schema(type=openapi.TYPE_STRING),
}
),
default=[]),
'audio_list': openapi.Schema(type=openapi.TYPE_ARRAY, title=_("Audio list"),
description=_("Audio list"),
items=openapi.Schema(
type=openapi.TYPE_OBJECT,
properties={
'name': openapi.Schema(type=openapi.TYPE_STRING,
title=_("Audio name")),
'url': openapi.Schema(type=openapi.TYPE_STRING,
title=_("Audio URL")),
'file_id': openapi.Schema(type=openapi.TYPE_STRING),
}
),
default=[]),
'runtime_node_id': openapi.Schema(type=openapi.TYPE_STRING, title=_("Runtime node id"),
description=_("Runtime node id"),
default=""),
'node_data': openapi.Schema(type=openapi.TYPE_OBJECT, title=_("Node data"),
description=_("Node data"),
default={}),
'chat_record_id': openapi.Schema(type=openapi.TYPE_STRING, title=_("Conversation record id"),
description=_("Conversation record id"),
default=""),
'child_node': openapi.Schema(type=openapi.TYPE_STRING, title=_("Child node"),
description=_("Child node"),
default={}),
}
)
@ -132,17 +192,23 @@ class ChatApi(ApiMixin):
'problem_optimization'],
properties={
'id': openapi.Schema(type=openapi.TYPE_STRING, title=_("Application ID"),
description=_("Application ID, pass when modifying, do not pass when creating")),
'model_id': openapi.Schema(type=openapi.TYPE_STRING, title=_("Model ID"), description=_("Model ID")),
description=_(
"Application ID, pass when modifying, do not pass when creating")),
'model_id': openapi.Schema(type=openapi.TYPE_STRING, title=_("Model ID"),
description=_("Model ID")),
'dataset_id_list': openapi.Schema(type=openapi.TYPE_ARRAY,
items=openapi.Schema(type=openapi.TYPE_STRING),
title=_("List of associated knowledge base IDs"), description=_("List of associated knowledge base IDs")),
'multiple_rounds_dialogue': openapi.Schema(type=openapi.TYPE_BOOLEAN, title=_("Do you want to initiate multiple sessions"),
description=_("Do you want to initiate multiple sessions")),
title=_("List of associated knowledge base IDs"),
description=_("List of associated knowledge base IDs")),
'multiple_rounds_dialogue': openapi.Schema(type=openapi.TYPE_BOOLEAN,
title=_("Do you want to initiate multiple sessions"),
description=_(
"Do you want to initiate multiple sessions")),
'dataset_setting': ApplicationApi.DatasetSetting.get_request_body_api(),
'model_setting': ApplicationApi.ModelSetting.get_request_body_api(),
'problem_optimization': openapi.Schema(type=openapi.TYPE_BOOLEAN, title=_("Problem optimization"),
description=_("Do you want to enable problem optimization"), default=True)
description=_("Do you want to enable problem optimization"),
default=True)
}
)
@ -214,14 +280,19 @@ class ChatRecordApi(ApiMixin):
description=_("Resource ID"), default=1),
'source_type': openapi.Schema(type=openapi.TYPE_STRING, title=_("Resource Type"),
description=_("Resource Type"), default='xxx'),
'message_tokens': openapi.Schema(type=openapi.TYPE_INTEGER, title=_("Number of tokens consumed by the question"),
'message_tokens': openapi.Schema(type=openapi.TYPE_INTEGER,
title=_("Number of tokens consumed by the question"),
description=_("Number of tokens consumed by the question"), default=0),
'answer_tokens': openapi.Schema(type=openapi.TYPE_INTEGER, title=_("The number of tokens consumed by the answer"),
description=_("The number of tokens consumed by the answer"), default=0),
'improve_paragraph_id_list': openapi.Schema(type=openapi.TYPE_STRING, title=_("Improved annotation list"),
'answer_tokens': openapi.Schema(type=openapi.TYPE_INTEGER,
title=_("The number of tokens consumed by the answer"),
description=_("The number of tokens consumed by the answer"),
default=0),
'improve_paragraph_id_list': openapi.Schema(type=openapi.TYPE_STRING,
title=_("Improved annotation list"),
description=_("Improved annotation list"),
default=[]),
'index': openapi.Schema(type=openapi.TYPE_STRING, title=_("Corresponding session Corresponding subscript"),
'index': openapi.Schema(type=openapi.TYPE_STRING,
title=_("Corresponding session Corresponding subscript"),
description=_("Corresponding session id corresponding subscript"),
default=0
),
@ -380,7 +451,8 @@ class ChatRecordImproveApi(ApiMixin):
description=_("Paragraph content"), default=_('Paragraph content')),
'title': openapi.Schema(type=openapi.TYPE_STRING, title=_("title"),
description=_("title"), default=_("Description of xxx")),
'hit_num': openapi.Schema(type=openapi.TYPE_INTEGER, title=_("Number of hits"), description=_("Number of hits"),
'hit_num': openapi.Schema(type=openapi.TYPE_INTEGER, title=_("Number of hits"),
description=_("Number of hits"),
default=1),
'star_num': openapi.Schema(type=openapi.TYPE_INTEGER, title=_("Number of Likes"),
description=_("Number of Likes"), default=1),

View File

@ -6717,4 +6717,33 @@ msgid "Add personal system API_KEY"
msgstr ""
msgid "Tencent Cloud"
msgstr ""
msgstr ""
msgid "Image name"
msgstr ""
msgid "Image URL"
msgstr ""
msgid "Document name"
msgstr ""
msgid "Document URL"
msgstr ""
msgid "Audio name"
msgstr ""
msgid "Audio URL"
msgstr ""
msgid "Runtime node id"
msgstr ""
msgid "Node data"
msgstr ""
msgid "Conversation record id"
msgstr ""
msgid "Child node"
msgstr ""

View File

@ -6856,3 +6856,32 @@ msgstr "添加个人系统 API_KEY"
msgid "Tencent Cloud"
msgstr "腾讯云"
msgid "Image name"
msgstr "图片名称"
msgid "Image URL"
msgstr "图片地址"
msgid "Document name"
msgstr "文档名称"
msgid "Document URL"
msgstr "文档地址"
msgid "Audio name"
msgstr "音频名称"
msgid "Audio URL"
msgstr "音频地址"
msgid "Runtime node id"
msgstr "运行节点id"
msgid "Node data"
msgstr "节点数据"
msgid "Conversation record id"
msgstr "会话记录id"
msgid "Child node"
msgstr "子节点数据"

View File

@ -6869,4 +6869,33 @@ msgid "Add personal system API_KEY"
msgstr "添加個人系統 API_KEY"
msgid "Tencent Cloud"
msgstr "腾訊云"
msgstr "腾訊云"
msgid "Image name"
msgstr "圖片名稱"
msgid "Image URL"
msgstr "圖片網址"
msgid "Document name"
msgstr "文件名稱"
msgid "Document URL"
msgstr "文件網址"
msgid "Audio name"
msgstr "音頻名稱"
msgid "Audio URL"
msgstr "音頻網址"
msgid "Runtime node id"
msgstr "運行節點id"
msgid "Node data"
msgstr "節點數據"
msgid "Conversation record id"
msgstr "對話記錄id"
msgid "Child node"
msgstr "子節點"