Skip to content

Commit f00c9ca

Browse files
committed
fix: Complete document parameters
--bug=1052250 --user=王孝刚 【API】在swagger上调用对话API ,希望把参数给补充完整。(比如,上传文档的一些参数) https://www.tapd.cn/57709429/s/1655242
1 parent 237dd8c commit f00c9ca

File tree

4 files changed

+175
-16
lines changed

4 files changed

+175
-16
lines changed

apps/application/swagger_api/chat_api.py

+86-14
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ def get_request_body_api():
4848
'chat_id': openapi.Schema(type=openapi.TYPE_STRING, title=_("Conversation ID")),
4949
're_chat': openapi.Schema(type=openapi.TYPE_BOOLEAN, title=_("regenerate"),
5050
default=False),
51-
'stream': openapi.Schema(type=openapi.TYPE_BOOLEAN, title=_("Stream Output"), default=True)
51+
'stream': openapi.Schema(type=openapi.TYPE_BOOLEAN, title=_("Stream Output"),
52+
default=True)
5253

5354
})
5455

@@ -62,7 +63,66 @@ def get_request_body_api():
6263
properties={
6364
'message': openapi.Schema(type=openapi.TYPE_STRING, title=_("problem"), description=_("problem")),
6465
're_chat': openapi.Schema(type=openapi.TYPE_BOOLEAN, title=_("regenerate"), default=False),
65-
'stream': openapi.Schema(type=openapi.TYPE_BOOLEAN, title=_("Is it streaming output"), default=True)
66+
'stream': openapi.Schema(type=openapi.TYPE_BOOLEAN, title=_("Is it streaming output"), default=True),
67+
68+
'form_data': openapi.Schema(type=openapi.TYPE_OBJECT, title=_("Form data"),
69+
description=_("Form data"),
70+
default={}),
71+
'image_list': openapi.Schema(
72+
type=openapi.TYPE_ARRAY,
73+
title=_("Image list"),
74+
description=_("Image list"),
75+
items=openapi.Schema(
76+
type=openapi.TYPE_OBJECT,
77+
properties={
78+
'name': openapi.Schema(type=openapi.TYPE_STRING,
79+
title=_("Image name")),
80+
'url': openapi.Schema(type=openapi.TYPE_STRING,
81+
title=_("Image URL")),
82+
'file_id': openapi.Schema(type=openapi.TYPE_STRING),
83+
}
84+
),
85+
default=[]
86+
),
87+
'document_list': openapi.Schema(type=openapi.TYPE_ARRAY, title=_("Document list"),
88+
description=_("Document list"),
89+
items=openapi.Schema(
90+
type=openapi.TYPE_OBJECT,
91+
properties={
92+
# 定义对象的具体属性
93+
'name': openapi.Schema(type=openapi.TYPE_STRING,
94+
title=_("Document name")),
95+
'url': openapi.Schema(type=openapi.TYPE_STRING,
96+
title=_("Document URL")),
97+
'file_id': openapi.Schema(type=openapi.TYPE_STRING),
98+
}
99+
),
100+
default=[]),
101+
'audio_list': openapi.Schema(type=openapi.TYPE_ARRAY, title=_("Audio list"),
102+
description=_("Audio list"),
103+
items=openapi.Schema(
104+
type=openapi.TYPE_OBJECT,
105+
properties={
106+
'name': openapi.Schema(type=openapi.TYPE_STRING,
107+
title=_("Audio name")),
108+
'url': openapi.Schema(type=openapi.TYPE_STRING,
109+
title=_("Audio URL")),
110+
'file_id': openapi.Schema(type=openapi.TYPE_STRING),
111+
}
112+
),
113+
default=[]),
114+
'runtime_node_id': openapi.Schema(type=openapi.TYPE_STRING, title=_("Runtime node id"),
115+
description=_("Runtime node id"),
116+
default=""),
117+
'node_data': openapi.Schema(type=openapi.TYPE_OBJECT, title=_("Node data"),
118+
description=_("Node data"),
119+
default={}),
120+
'chat_record_id': openapi.Schema(type=openapi.TYPE_STRING, title=_("Conversation record id"),
121+
description=_("Conversation record id"),
122+
default=""),
123+
'child_node': openapi.Schema(type=openapi.TYPE_STRING, title=_("Child node"),
124+
description=_("Child node"),
125+
default={}),
66126

67127
}
68128
)
@@ -132,17 +192,23 @@ def get_request_body_api():
132192
'problem_optimization'],
133193
properties={
134194
'id': openapi.Schema(type=openapi.TYPE_STRING, title=_("Application ID"),
135-
description=_("Application ID, pass when modifying, do not pass when creating")),
136-
'model_id': openapi.Schema(type=openapi.TYPE_STRING, title=_("Model ID"), description=_("Model ID")),
195+
description=_(
196+
"Application ID, pass when modifying, do not pass when creating")),
197+
'model_id': openapi.Schema(type=openapi.TYPE_STRING, title=_("Model ID"),
198+
description=_("Model ID")),
137199
'dataset_id_list': openapi.Schema(type=openapi.TYPE_ARRAY,
138200
items=openapi.Schema(type=openapi.TYPE_STRING),
139-
title=_("List of associated knowledge base IDs"), description=_("List of associated knowledge base IDs")),
140-
'multiple_rounds_dialogue': openapi.Schema(type=openapi.TYPE_BOOLEAN, title=_("Do you want to initiate multiple sessions"),
141-
description=_("Do you want to initiate multiple sessions")),
201+
title=_("List of associated knowledge base IDs"),
202+
description=_("List of associated knowledge base IDs")),
203+
'multiple_rounds_dialogue': openapi.Schema(type=openapi.TYPE_BOOLEAN,
204+
title=_("Do you want to initiate multiple sessions"),
205+
description=_(
206+
"Do you want to initiate multiple sessions")),
142207
'dataset_setting': ApplicationApi.DatasetSetting.get_request_body_api(),
143208
'model_setting': ApplicationApi.ModelSetting.get_request_body_api(),
144209
'problem_optimization': openapi.Schema(type=openapi.TYPE_BOOLEAN, title=_("Problem optimization"),
145-
description=_("Do you want to enable problem optimization"), default=True)
210+
description=_("Do you want to enable problem optimization"),
211+
default=True)
146212
}
147213
)
148214

@@ -214,14 +280,19 @@ def get_response_body_api():
214280
description=_("Resource ID"), default=1),
215281
'source_type': openapi.Schema(type=openapi.TYPE_STRING, title=_("Resource Type"),
216282
description=_("Resource Type"), default='xxx'),
217-
'message_tokens': openapi.Schema(type=openapi.TYPE_INTEGER, title=_("Number of tokens consumed by the question"),
283+
'message_tokens': openapi.Schema(type=openapi.TYPE_INTEGER,
284+
title=_("Number of tokens consumed by the question"),
218285
description=_("Number of tokens consumed by the question"), default=0),
219-
'answer_tokens': openapi.Schema(type=openapi.TYPE_INTEGER, title=_("The number of tokens consumed by the answer"),
220-
description=_("The number of tokens consumed by the answer"), default=0),
221-
'improve_paragraph_id_list': openapi.Schema(type=openapi.TYPE_STRING, title=_("Improved annotation list"),
286+
'answer_tokens': openapi.Schema(type=openapi.TYPE_INTEGER,
287+
title=_("The number of tokens consumed by the answer"),
288+
description=_("The number of tokens consumed by the answer"),
289+
default=0),
290+
'improve_paragraph_id_list': openapi.Schema(type=openapi.TYPE_STRING,
291+
title=_("Improved annotation list"),
222292
description=_("Improved annotation list"),
223293
default=[]),
224-
'index': openapi.Schema(type=openapi.TYPE_STRING, title=_("Corresponding session Corresponding subscript"),
294+
'index': openapi.Schema(type=openapi.TYPE_STRING,
295+
title=_("Corresponding session Corresponding subscript"),
225296
description=_("Corresponding session id corresponding subscript"),
226297
default=0
227298
),
@@ -380,7 +451,8 @@ def get_response_body_api():
380451
description=_("Paragraph content"), default=_('Paragraph content')),
381452
'title': openapi.Schema(type=openapi.TYPE_STRING, title=_("title"),
382453
description=_("title"), default=_("Description of xxx")),
383-
'hit_num': openapi.Schema(type=openapi.TYPE_INTEGER, title=_("Number of hits"), description=_("Number of hits"),
454+
'hit_num': openapi.Schema(type=openapi.TYPE_INTEGER, title=_("Number of hits"),
455+
description=_("Number of hits"),
384456
default=1),
385457
'star_num': openapi.Schema(type=openapi.TYPE_INTEGER, title=_("Number of Likes"),
386458
description=_("Number of Likes"), default=1),

apps/locales/en_US/LC_MESSAGES/django.po

+30-1
Original file line numberDiff line numberDiff line change
@@ -6717,4 +6717,33 @@ msgid "Add personal system API_KEY"
67176717
msgstr ""
67186718

67196719
msgid "Tencent Cloud"
6720-
msgstr ""
6720+
msgstr ""
6721+
6722+
msgid "Image name"
6723+
msgstr ""
6724+
6725+
msgid "Image URL"
6726+
msgstr ""
6727+
6728+
msgid "Document name"
6729+
msgstr ""
6730+
6731+
msgid "Document URL"
6732+
msgstr ""
6733+
6734+
msgid "Audio name"
6735+
msgstr ""
6736+
6737+
msgid "Audio URL"
6738+
msgstr ""
6739+
6740+
msgid "Runtime node id"
6741+
msgstr ""
6742+
6743+
msgid "Node data"
6744+
msgstr ""
6745+
6746+
msgid "Conversation record id"
6747+
msgstr ""
6748+
msgid "Child node"
6749+
msgstr ""

apps/locales/zh_CN/LC_MESSAGES/django.po

+29
Original file line numberDiff line numberDiff line change
@@ -6856,3 +6856,32 @@ msgstr "添加个人系统 API_KEY"
68566856

68576857
msgid "Tencent Cloud"
68586858
msgstr "腾讯云"
6859+
6860+
msgid "Image name"
6861+
msgstr "图片名称"
6862+
6863+
msgid "Image URL"
6864+
msgstr "图片地址"
6865+
6866+
msgid "Document name"
6867+
msgstr "文档名称"
6868+
6869+
msgid "Document URL"
6870+
msgstr "文档地址"
6871+
6872+
msgid "Audio name"
6873+
msgstr "音频名称"
6874+
6875+
msgid "Audio URL"
6876+
msgstr "音频地址"
6877+
msgid "Runtime node id"
6878+
msgstr "运行节点id"
6879+
6880+
msgid "Node data"
6881+
msgstr "节点数据"
6882+
6883+
msgid "Conversation record id"
6884+
msgstr "会话记录id"
6885+
msgid "Child node"
6886+
msgstr "子节点数据"
6887+

apps/locales/zh_Hant/LC_MESSAGES/django.po

+30-1
Original file line numberDiff line numberDiff line change
@@ -6869,4 +6869,33 @@ msgid "Add personal system API_KEY"
68696869
msgstr "添加個人系統 API_KEY"
68706870

68716871
msgid "Tencent Cloud"
6872-
msgstr "腾訊云"
6872+
msgstr "腾訊云"
6873+
6874+
msgid "Image name"
6875+
msgstr "圖片名稱"
6876+
6877+
msgid "Image URL"
6878+
msgstr "圖片網址"
6879+
6880+
msgid "Document name"
6881+
msgstr "文件名稱"
6882+
6883+
msgid "Document URL"
6884+
msgstr "文件網址"
6885+
6886+
msgid "Audio name"
6887+
msgstr "音頻名稱"
6888+
6889+
msgid "Audio URL"
6890+
msgstr "音頻網址"
6891+
6892+
msgid "Runtime node id"
6893+
msgstr "運行節點id"
6894+
6895+
msgid "Node data"
6896+
msgstr "節點數據"
6897+
6898+
msgid "Conversation record id"
6899+
msgstr "對話記錄id"
6900+
msgid "Child node"
6901+
msgstr "子節點"

0 commit comments

Comments
 (0)