You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

template_chat.zh.mdx 59KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430
  1. import { CodeGroup } from '../code.tsx'
  2. import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
  3. # 对话型应用 API
  4. 对话应用支持会话持久化,可将之前的聊天记录作为上下文进行回答,可适用于聊天/客服 AI 等。
  5. <div>
  6. ### 基础 URL
  7. <CodeGroup title="Code" targetCode={props.appDetail.api_base_url}>
  8. ```javascript
  9. ```
  10. </CodeGroup>
  11. ### 鉴权
  12. Service API 使用 `API-Key` 进行鉴权。
  13. <i>**强烈建议开发者把 `API-Key` 放在后端存储,而非分享或者放在客户端存储,以免 `API-Key` 泄露,导致财产损失。**</i>
  14. 所有 API 请求都应在 **`Authorization`** HTTP Header 中包含您的 `API-Key`,如下所示:
  15. <CodeGroup title="Code">
  16. ```javascript
  17. Authorization: Bearer {API_KEY}
  18. ```
  19. </CodeGroup>
  20. </div>
  21. ---
  22. <Heading
  23. url='/chat-messages'
  24. method='POST'
  25. title='发送对话消息'
  26. name='#Create-Chat-Message'
  27. />
  28. <Row>
  29. <Col>
  30. 创建会话消息。
  31. ### Request Body
  32. <Properties>
  33. <Property name='query' type='string' key='query'>
  34. 用户输入/提问内容。
  35. </Property>
  36. <Property name='inputs' type='object' key='inputs'>
  37. 允许传入 App 定义的各变量值。
  38. inputs 参数包含了多组键值对(Key/Value pairs),每组的键对应一个特定变量,每组的值则是该变量的具体值。
  39. 默认 `{}`
  40. </Property>
  41. <Property name='response_mode' type='string' key='response_mode'>
  42. - `streaming` 流式模式(推荐)。基于 SSE(**[Server-Sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)**)实现类似打字机输出方式的流式返回。
  43. - `blocking` 阻塞模式,等待执行完毕后返回结果。(请求若流程较长可能会被中断)。
  44. <i>由于 Cloudflare 限制,请求会在 100 秒超时无返回后中断。</i>
  45. 注:Agent模式下不允许blocking。
  46. </Property>
  47. <Property name='user' type='string' key='user'>
  48. 用户标识,用于定义终端用户的身份,方便检索、统计。
  49. 由开发者定义规则,需保证用户标识在应用内唯一。服务 API 不会共享 WebApp 创建的对话。
  50. </Property>
  51. <Property name='conversation_id' type='string' key='conversation_id'>
  52. (选填)会话 ID,需要基于之前的聊天记录继续对话,必须传之前消息的 conversation_id。
  53. </Property>
  54. <Property name='files' type='array[object]' key='files'>
  55. 上传的文件。
  56. - `type` (string) 支持类型:图片 `image`(目前仅支持图片格式) 。
  57. - `transfer_method` (string) 传递方式:
  58. - `remote_url`: 图片地址。
  59. - `local_file`: 上传文件。
  60. - `url` 图片地址。(仅当传递方式为 `remote_url` 时)。
  61. - `upload_file_id` 上传文件 ID。(仅当传递方式为 `local_file `时)。
  62. </Property>
  63. <Property name='auto_generate_name' type='bool' key='auto_generate_name'>
  64. (选填)自动生成标题,默认 `true`。 若设置为 `false`,则可通过调用会话重命名接口并设置 `auto_generate` 为 `true` 实现异步生成标题。
  65. </Property>
  66. <Property name='trace_id' type='string' key='trace_id'>
  67. (选填)链路追踪ID。适用于与业务系统已有的trace组件打通,实现端到端分布式追踪等场景。如果未指定,系统会自动生成<code>trace_id</code>。支持以下三种方式传递,具体优先级依次为:<br/>
  68. - Header:通过 HTTP Header <code>X-Trace-Id</code> 传递,优先级最高。<br/>
  69. - Query 参数:通过 URL 查询参数 <code>trace_id</code> 传递。<br/>
  70. - Request Body:通过请求体字段 <code>trace_id</code> 传递(即本字段)。<br/>
  71. </Property>
  72. </Properties>
  73. ### Response
  74. <Properties>
  75. 当 `response_mode` 为 `blocking` 时,返回 ChatCompletionResponse object。
  76. 当 `response_mode` 为 `streaming`时,返回 ChunkChatCompletionResponse object 流式序列。
  77. ### ChatCompletionResponse
  78. 返回完整的 App 结果,`Content-Type` 为 `application/json`。
  79. - `event` (string) 事件类型,固定为 `message`
  80. - `task_id` (string) 任务 ID,用于请求跟踪和下方的停止响应接口
  81. - `id` (string) 唯一ID
  82. - `message_id` (string) 消息唯一 ID
  83. - `conversation_id` (string) 会话 ID
  84. - `mode` (string) App 模式,固定为 chat
  85. - `answer` (string) 完整回复内容
  86. - `metadata` (object) 元数据
  87. - `usage` (Usage) 模型用量信息
  88. - `retriever_resources` (array[RetrieverResource]) 引用和归属分段列表
  89. - `created_at` (int) 消息创建时间戳,如:1705395332
  90. ### ChunkChatCompletionResponse
  91. 返回 App 输出的流式块,`Content-Type` 为 `text/event-stream`。
  92. 每个流式块均为 data: 开头,块之间以 \n\n 即两个换行符分隔,如下所示:
  93. <CodeGroup>
  94. ```streaming {{ title: 'Response' }}
  95. data: {"event": "message", "task_id": "900bbd43-dc0b-4383-a372-aa6e6c414227", "id": "663c5084-a254-4040-8ad3-51f2a3c1a77c", "answer": "Hi", "created_at": 1705398420}\n\n
  96. ```
  97. </CodeGroup>
  98. 流式块中根据 event 不同,结构也不同:
  99. - `event: message` LLM 返回文本块事件,即:完整的文本以分块的方式输出。
  100. - `task_id` (string) 任务 ID,用于请求跟踪和下方的停止响应接口
  101. - `message_id` (string) 消息唯一 ID
  102. - `conversation_id` (string) 会话 ID
  103. - `answer` (string) LLM 返回文本块内容
  104. - `created_at` (int) 创建时间戳,如:1705395332
  105. - `event: agent_message` Agent模式下返回文本块事件,即:在Agent模式下,文章的文本以分块的方式输出(仅Agent模式下使用)
  106. - `task_id` (string) 任务 ID,用于请求跟踪和下方的停止响应接口
  107. - `message_id` (string) 消息唯一 ID
  108. - `conversation_id` (string) 会话 ID
  109. - `answer` (string) LLM 返回文本块内容
  110. - `created_at` (int) 创建时间戳,如:1705395332
  111. - `event: agent_thought` Agent模式下有关Agent思考步骤的相关内容,涉及到工具调用(仅Agent模式下使用)
  112. - `id` (string) agent_thought ID,每一轮Agent迭代都会有一个唯一的id
  113. - `task_id` (string) 任务ID,用于请求跟踪下方的停止响应接口
  114. - `message_id` (string) 消息唯一ID
  115. - `position` (int) agent_thought在消息中的位置,如第一轮迭代position为1
  116. - `thought` (string) agent的思考内容
  117. - `observation` (string) 工具调用的返回结果
  118. - `tool` (string) 使用的工具列表,以 ; 分割多个工具
  119. - `tool_input` (string) 工具的输入,JSON格式的字符串(object)。如:`{"dalle3": {"prompt": "a cute cat"}}`
  120. - `created_at` (int) 创建时间戳,如:1705395332
  121. - `message_files` (array[string]) 当前 `agent_thought` 关联的文件ID
  122. - `file_id` (string) 文件ID
  123. - `conversation_id` (string) 会话ID
  124. - `event: message_file` 文件事件,表示有新文件需要展示
  125. - `id` (string) 文件唯一ID
  126. - `type` (string) 文件类型,目前仅为image
  127. - `belongs_to` (string) 文件归属,user或assistant,该接口返回仅为 `assistant`
  128. - `url` (string) 文件访问地址
  129. - `conversation_id` (string) 会话ID
  130. - `event: message_end` 消息结束事件,收到此事件则代表流式返回结束。
  131. - `task_id` (string) 任务 ID,用于请求跟踪和下方的停止响应接口
  132. - `message_id` (string) 消息唯一 ID
  133. - `conversation_id` (string) 会话 ID
  134. - `metadata` (object) 元数据
  135. - `usage` (Usage) 模型用量信息
  136. - `retriever_resources` (array[RetrieverResource]) 引用和归属分段列表
  137. - `event: tts_message` TTS 音频流事件,即:语音合成输出。内容是Mp3格式的音频块,使用 base64 编码后的字符串,播放的时候直接解码即可。(开启自动播放才有此消息)
  138. - `task_id` (string) 任务 ID,用于请求跟踪和下方的停止响应接口
  139. - `message_id` (string) 消息唯一 ID
  140. - `audio` (string) 语音合成之后的音频块使用 Base64 编码之后的文本内容,播放的时候直接 base64 解码送入播放器即可
  141. - `created_at` (int) 创建时间戳,如:1705395332
  142. - `event: tts_message_end` TTS 音频流结束事件,收到这个事件表示音频流返回结束。
  143. - `task_id` (string) 任务 ID,用于请求跟踪和下方的停止响应接口
  144. - `message_id` (string) 消息唯一 ID
  145. - `audio` (string) 结束事件是没有音频的,所以这里是空字符串
  146. - `created_at` (int) 创建时间戳,如:1705395332
  147. - `event: message_replace` 消息内容替换事件。
  148. 开启内容审查和审查输出内容时,若命中了审查条件,则会通过此事件替换消息内容为预设回复。
  149. - `task_id` (string) 任务 ID,用于请求跟踪和下方的停止响应接口
  150. - `message_id` (string) 消息唯一 ID
  151. - `conversation_id` (string) 会话 ID
  152. - `answer` (string) 替换内容(直接替换 LLM 所有回复文本)
  153. - `created_at` (int) 创建时间戳,如:1705395332
  154. - `event: error`
  155. 流式输出过程中出现的异常会以 stream event 形式输出,收到异常事件后即结束。
  156. - `task_id` (string) 任务 ID,用于请求跟踪和下方的停止响应接口
  157. - `message_id` (string) 消息唯一 ID
  158. - `status` (int) HTTP 状态码
  159. - `code` (string) 错误码
  160. - `message` (string) 错误消息
  161. - `event: ping` 每 10s 一次的 ping 事件,保持连接存活。
  162. ### Errors
  163. - 404,对话不存在
  164. - 400,`invalid_param`,传入参数异常
  165. - 400,`app_unavailable`,App 配置不可用
  166. - 400,`provider_not_initialize`,无可用模型凭据配置
  167. - 400,`provider_quota_exceeded`,模型调用额度不足
  168. - 400,`model_currently_not_support`,当前模型不可用
  169. - 400,`completion_request_error`,文本生成失败
  170. - 500,服务内部异常
  171. </Properties>
  172. </Col>
  173. <Col sticky>
  174. <CodeGroup title="Request" tag="POST" label="/chat-messages" targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": ${JSON.stringify(props.inputs)},\n "query": "What are the specs of the iPhone 13 Pro Max?",\n "response_mode": "streaming",\n "conversation_id": "",\n "user": "abc-123",\n "files": [\n {\n "type": "image",\n "transfer_method": "remote_url",\n "url": "https://cloud.dify.ai/logo/logo-site.png"\n }\n ]\n}'`}>
  175. ```bash {{ title: 'cURL' }}
  176. curl -X POST '${props.appDetail.api_base_url}/chat-messages' \
  177. -H 'Authorization: Bearer {api_key}' \
  178. -H 'Content-Type: application/json' \
  179. --data-raw '{
  180. "inputs": {
  181. "name": "dify"
  182. },
  183. "query": "What are the specs of the iPhone 13 Pro Max?",
  184. "conversation_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb",
  185. "response_mode": "streaming",
  186. "user": "abc-123",
  187. "files": [
  188. {
  189. "type": "image",
  190. "transfer_method": "remote_url",
  191. "url": "https://cloud.dify.ai/logo/logo-site.png"
  192. }
  193. ]
  194. }'
  195. ```
  196. </CodeGroup>
  197. ### 阻塞模式
  198. <CodeGroup title="Response">
  199. ```json {{ title: 'Response' }}
  200. {
  201. "event": "message",
  202. "task_id": "c3800678-a077-43df-a102-53f23ed20b88",
  203. "id": "9da23599-e713-473b-982c-4328d4f5c78a",
  204. "message_id": "9da23599-e713-473b-982c-4328d4f5c78a",
  205. "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2",
  206. "mode": "chat",
  207. "answer": "iPhone 13 Pro Max specs are listed here:...",
  208. "metadata": {
  209. "usage": {
  210. "prompt_tokens": 1033,
  211. "prompt_unit_price": "0.001",
  212. "prompt_price_unit": "0.001",
  213. "prompt_price": "0.0010330",
  214. "completion_tokens": 128,
  215. "completion_unit_price": "0.002",
  216. "completion_price_unit": "0.001",
  217. "completion_price": "0.0002560",
  218. "total_tokens": 1161,
  219. "total_price": "0.0012890",
  220. "currency": "USD",
  221. "latency": 0.7682376249867957
  222. },
  223. "retriever_resources": [
  224. {
  225. "position": 1,
  226. "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb",
  227. "dataset_name": "iPhone",
  228. "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00",
  229. "document_name": "iPhone List",
  230. "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a",
  231. "score": 0.98457545,
  232. "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\"\n\"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\""
  233. }
  234. ]
  235. },
  236. "created_at": 1705407629
  237. }
  238. ```
  239. </CodeGroup>
  240. ### 流式模式(基础助手)
  241. <CodeGroup title="Response">
  242. ```streaming {{ title: 'Response' }}
  243. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " I", "created_at": 1679586595}
  244. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": "'m", "created_at": 1679586595}
  245. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " glad", "created_at": 1679586595}
  246. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " to", "created_at": 1679586595}
  247. data: {"event": "message", "message_id" : "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " meet", "created_at": 1679586595}
  248. data: {"event": "message", "message_id" : "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " you", "created_at": 1679586595}
  249. data: {"event": "message_end", "id": "5e52ce04-874b-4d27-9045-b3bc80def685", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "metadata": {"usage": {"prompt_tokens": 1033, "prompt_unit_price": "0.001", "prompt_price_unit": "0.001", "prompt_price": "0.0010330", "completion_tokens": 135, "completion_unit_price": "0.002", "completion_price_unit": "0.001", "completion_price": "0.0002700", "total_tokens": 1168, "total_price": "0.0013030", "currency": "USD", "latency": 1.381760165997548}, "retriever_resources": [{"position": 1, "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb", "dataset_name": "iPhone", "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00", "document_name": "iPhone List", "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a", "score": 0.98457545, "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\"\n\"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\""}]}}
  250. data: {"event": "tts_message", "conversation_id": "23dd85f3-1a41-4ea0-b7a9-062734ccfaf9", "message_id": "a8bdc41c-13b2-4c18-bfd9-054b9803038c", "created_at": 1721205487, "task_id": "3bf8a0bb-e73b-4690-9e66-4e429bad8ee7", "audio": "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq"}
  251. data: {"event": "tts_message_end", "conversation_id": "23dd85f3-1a41-4ea0-b7a9-062734ccfaf9", "message_id": "a8bdc41c-13b2-4c18-bfd9-054b9803038c", "created_at": 1721205487, "task_id": "3bf8a0bb-e73b-4690-9e66-4e429bad8ee7", "audio": ""}
  252. ```
  253. </CodeGroup>
  254. ### 流式模式(智能助手)
  255. <CodeGroup title="Response">
  256. ```streaming {{ title: 'Response' }}
  257. data: {"event": "agent_thought", "id": "8dcf3648-fbad-407a-85dd-73a6f43aeb9f", "task_id": "9cf1ddd7-f94b-459b-b942-b77b26c59e9b", "message_id": "1fb10045-55fd-4040-99e6-d048d07cbad3", "position": 1, "thought": "", "observation": "", "tool": "", "tool_input": "", "created_at": 1705639511, "message_files": [], "conversation_id": "c216c595-2d89-438c-b33c-aae5ddddd142"}
  258. data: {"event": "agent_thought", "id": "8dcf3648-fbad-407a-85dd-73a6f43aeb9f", "task_id": "9cf1ddd7-f94b-459b-b942-b77b26c59e9b", "message_id": "1fb10045-55fd-4040-99e6-d048d07cbad3", "position": 1, "thought": "", "observation": "", "tool": "dalle3", "tool_input": "{\"dalle3\": {\"prompt\": \"cute Japanese anime girl with white hair, blue eyes, bunny girl suit\"}}", "created_at": 1705639511, "message_files": [], "conversation_id": "c216c595-2d89-438c-b33c-aae5ddddd142"}
  259. data: {"event": "message_file", "id": "d75b7a5c-ce5e-442e-ab1b-d6a5e5b557b0", "type": "image", "belongs_to": "assistant", "url": "http://127.0.0.1:5001/files/tools/d75b7a5c-ce5e-442e-ab1b-d6a5e5b557b0.png?timestamp=1705639526&nonce=70423256c60da73a9c96d1385ff78487&sign=7B5fKV9890YJuqchQvrABvW4AIupDvDvxGdu1EOJT94=", "conversation_id": "c216c595-2d89-438c-b33c-aae5ddddd142"}
  260. data: {"event": "agent_thought", "id": "8dcf3648-fbad-407a-85dd-73a6f43aeb9f", "task_id": "9cf1ddd7-f94b-459b-b942-b77b26c59e9b", "message_id": "1fb10045-55fd-4040-99e6-d048d07cbad3", "position": 1, "thought": "", "observation": "image has been created and sent to user already, you should tell user to check it now.", "tool": "dalle3", "tool_input": "{\"dalle3\": {\"prompt\": \"cute Japanese anime girl with white hair, blue eyes, bunny girl suit\"}}", "created_at": 1705639511, "message_files": ["d75b7a5c-ce5e-442e-ab1b-d6a5e5b557b0"], "conversation_id": "c216c595-2d89-438c-b33c-aae5ddddd142"}
  261. data: {"event": "agent_thought", "id": "67a99dc1-4f82-42d3-b354-18d4594840c8", "task_id": "9cf1ddd7-f94b-459b-b942-b77b26c59e9b", "message_id": "1fb10045-55fd-4040-99e6-d048d07cbad3", "position": 2, "thought": "", "observation": "", "tool": "", "tool_input": "", "created_at": 1705639511, "message_files": [], "conversation_id": "c216c595-2d89-438c-b33c-aae5ddddd142"}
  262. data: {"event": "agent_message", "id": "1fb10045-55fd-4040-99e6-d048d07cbad3", "task_id": "9cf1ddd7-f94b-459b-b942-b77b26c59e9b", "message_id": "1fb10045-55fd-4040-99e6-d048d07cbad3", "answer": "I have created an image of a cute Japanese", "created_at": 1705639511, "conversation_id": "c216c595-2d89-438c-b33c-aae5ddddd142"}
  263. data: {"event": "agent_message", "id": "1fb10045-55fd-4040-99e6-d048d07cbad3", "task_id": "9cf1ddd7-f94b-459b-b942-b77b26c59e9b", "message_id": "1fb10045-55fd-4040-99e6-d048d07cbad3", "answer": " anime girl with white hair and blue", "created_at": 1705639511, "conversation_id": "c216c595-2d89-438c-b33c-aae5ddddd142"}
  264. data: {"event": "agent_message", "id": "1fb10045-55fd-4040-99e6-d048d07cbad3", "task_id": "9cf1ddd7-f94b-459b-b942-b77b26c59e9b", "message_id": "1fb10045-55fd-4040-99e6-d048d07cbad3", "answer": " eyes wearing a bunny girl" ,"created_at": 1705639511, "conversation_id": "c216c595-2d89-438c-b33c-aae5ddddd142"}
  265. data: {"event": "agent_message", "id": "1fb10045-55fd-4040-99e6-d048d07cbad3", "task_id": "9cf1ddd7-f94b-459b-b942-b77b26c59e9b", "message_id": "1fb10045-55fd-4040-99e6-d048d07cbad3", "answer": " suit .", "created_at": 1705639511, "conversation_id": "c216c595-2d89-438c-b33c-aae5ddddd142"}
  266. data: {"event": "agent_thought", "id": "67a99dc1-4f82-42d3-b354-18d4594840c8", "task_id": "9cf1ddd7-f94b-459b-b942-b77b26c59e9b", "message_id": "1fb10045-55fd-4040-99e6-d048d07cbad3", "position": 2, "thought": "I have created an image of a cute Japanese anime girl with white hair and blue eyes wearing a bunny girl suit.", "observation": "", "tool": "", "tool_input": "", "created_at": 1705639511, "message_files": [], "conversation_id": "c216c595-2d89-438c-b33c-aae5ddddd142"}
  267. data: {"event": "message_end", "id": "5e52ce04-874b-4d27-9045-b3bc80def685", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "metadata": {"usage": {"prompt_tokens": 1033, "prompt_unit_price": "0.001", "prompt_price_unit": "0.001", "prompt_price": "0.0010330", "completion_tokens": 135, "completion_unit_price": "0.002", "completion_price_unit": "0.001", "completion_price": "0.0002700", "total_tokens": 1168, "total_price": "0.0013030", "currency": "USD", "latency": 1.381760165997548}, "retriever_resources": [{"position": 1, "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb", "dataset_name": "iPhone", "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00", "document_name": "iPhone List", "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a", "score": 0.98457545, "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\"\n\"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\""}]}}
  268. data: {"event": "tts_message", "conversation_id": "23dd85f3-1a41-4ea0-b7a9-062734ccfaf9", "message_id": "a8bdc41c-13b2-4c18-bfd9-054b9803038c", "created_at": 1721205487, "task_id": "3bf8a0bb-e73b-4690-9e66-4e429bad8ee7", "audio": "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq"}
  269. data: {"event": "tts_message_end", "conversation_id": "23dd85f3-1a41-4ea0-b7a9-062734ccfaf9", "message_id": "a8bdc41c-13b2-4c18-bfd9-054b9803038c", "created_at": 1721205487, "task_id": "3bf8a0bb-e73b-4690-9e66-4e429bad8ee7", "audio": ""}
  270. ```
  271. </CodeGroup>
  272. </Col>
  273. </Row>
  274. ---
  275. <Heading
  276. url='/files/upload'
  277. method='POST'
  278. title='上传文件'
  279. name='#files-upload'
  280. />
  281. <Row>
  282. <Col>
  283. 上传文件(目前仅支持图片)并在发送消息时使用,可实现图文多模态理解。
  284. 支持 png, jpg, jpeg, webp, gif 格式。
  285. <i>上传的文件仅供当前终端用户使用。</i>
  286. ### Request Body
  287. 该接口需使用 `multipart/form-data` 进行请求。
  288. <Properties>
  289. <Property name='file' type='file' key='file'>
  290. 要上传的文件。
  291. </Property>
  292. <Property name='user' type='string' key='user'>
  293. 用户标识,用于定义终端用户的身份,必须和发送消息接口传入 user 保持一致。服务 API 不会共享 WebApp 创建的对话。
  294. </Property>
  295. </Properties>
  296. ### Response
  297. 成功上传后,服务器会返回文件的 ID 和相关信息。
  298. - `id` (uuid) ID
  299. - `name` (string) 文件名
  300. - `size` (int) 文件大小(byte)
  301. - `extension` (string) 文件后缀
  302. - `mime_type` (string) 文件 mime-type
  303. - `created_by` (uuid) 上传人 ID
  304. - `created_at` (timestamp) 上传时间
  305. ### Errors
  306. - 400,`no_file_uploaded`,必须提供文件
  307. - 400,`too_many_files`,目前只接受一个文件
  308. - 400,`unsupported_preview`,该文件不支持预览
  309. - 400,`unsupported_estimate`,该文件不支持估算
  310. - 413,`file_too_large`,文件太大
  311. - 415,`unsupported_file_type`,不支持的扩展名,当前只接受文档类文件
  312. - 503,`s3_connection_failed`,无法连接到 S3 服务
  313. - 503,`s3_permission_denied`,无权限上传文件到 S3
  314. - 503,`s3_file_too_large`,文件超出 S3 大小限制
  315. </Col>
  316. <Col sticky>
  317. <CodeGroup title="Request" tag="POST" label="/files/upload" targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\\n--form 'user=abc-123'`}>
  318. ```bash {{ title: 'cURL' }}
  319. curl -X POST '${props.appDetail.api_base_url}/files/upload' \
  320. --header 'Authorization: Bearer {api_key}' \
  321. --form 'file=@"/path/to/file"'
  322. ```
  323. </CodeGroup>
  324. <CodeGroup title="Response">
  325. ```json {{ title: 'Response' }}
  326. {
  327. "id": "72fa9618-8f89-4a37-9b33-7e1178a24a67",
  328. "name": "example.png",
  329. "size": 1024,
  330. "extension": "png",
  331. "mime_type": "image/png",
  332. "created_by": 123,
  333. "created_at": 1577836800,
  334. }
  335. ```
  336. </CodeGroup>
  337. </Col>
  338. </Row>
  339. ---
  340. <Heading
  341. url='/chat-messages/:task_id/stop'
  342. method='POST'
  343. title='停止响应'
  344. name='#Stop'
  345. />
  346. <Row>
  347. <Col>
  348. 仅支持流式模式。
  349. ### Path
  350. - `task_id` (string) 任务 ID,可在流式返回 Chunk 中获取
  351. ### Request Body
  352. - `user` (string) Required
  353. 用户标识,用于定义终端用户的身份,必须和发送消息接口传入 user 保持一致。API 无法访问 WebApp 创建的会话。
  354. ### Response
  355. - `result` (string) 固定返回 success
  356. </Col>
  357. <Col sticky>
  358. <CodeGroup title="Request" tag="POST" label="/chat-messages/:task_id/stop" targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages/:task_id/stop' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json' \\\n--data-raw '{ "user": "abc-123"}'`}>
  359. ```bash {{ title: 'cURL' }}
  360. curl -X POST '${props.appDetail.api_base_url}/chat-messages/:task_id/stop' \
  361. -H 'Authorization: Bearer {api_key}' \
  362. -H 'Content-Type: application/json' \
  363. --data-raw '{
  364. "user": "abc-123"
  365. }'
  366. ```
  367. </CodeGroup>
  368. <CodeGroup title="Response">
  369. ```json {{ title: 'Response' }}
  370. {
  371. "result": "success"
  372. }
  373. ```
  374. </CodeGroup>
  375. </Col>
  376. </Row>
  377. ---
  378. <Heading
  379. url='/messages/:message_id/feedbacks'
  380. method='POST'
  381. title='消息反馈(点赞)'
  382. name='#feedbacks'
  383. />
  384. <Row>
  385. <Col>
  386. 消息终端用户反馈、点赞,方便应用开发者优化输出预期。
  387. ### Path Params
  388. <Properties>
  389. <Property name='message_id' type='string' key='message_id'>
  390. 消息 ID
  391. </Property>
  392. </Properties>
  393. ### Request Body
  394. <Properties>
  395. <Property name='rating' type='string' key='rating'>
  396. 点赞 like, 点踩 dislike, 撤销点赞 null
  397. </Property>
  398. <Property name='user' type='string' key='user'>
  399. 用户标识,由开发者定义规则,需保证用户标识在应用内唯一。服务 API 不会共享 WebApp 创建的对话。
  400. </Property>
  401. <Property name='content' type='string' key='content'>
  402. 消息反馈的具体信息。
  403. </Property>
  404. </Properties>
  405. ### Response
  406. - `result` (string) 固定返回 success
  407. </Col>
  408. <Col sticky>
  409. <CodeGroup title="Request" tag="POST" label="/messages/:message_id/feedbacks" targetCode={`curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "rating": "like",\n "user": "abc-123",\n "content": "message feedback information"\n}'`}>
  410. ```bash {{ title: 'cURL' }}
  411. curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks' \
  412. --header 'Authorization: Bearer {api_key}' \
  413. --header 'Content-Type: application/json' \
  414. --data-raw '{
  415. "rating": "like",
  416. "user": "abc-123",
  417. "content": "message feedback information"
  418. }'
  419. ```
  420. </CodeGroup>
  421. <CodeGroup title="Response">
  422. ```json {{ title: 'Response' }}
  423. {
  424. "result": "success"
  425. }
  426. ```
  427. </CodeGroup>
  428. </Col>
  429. </Row>
  430. ---
  431. <Heading
  432. url='/app/feedbacks'
  433. method='GET'
  434. title='获取APP的消息点赞和反馈'
  435. name='#app-feedbacks'
  436. />
  437. <Row>
  438. <Col>
  439. 获取应用的终端用户反馈、点赞。
  440. ### Query
  441. <Properties>
  442. <Property name='page' type='string' key='page'>
  443. (选填)分页,默认值:1
  444. </Property>
  445. </Properties>
  446. <Properties>
  447. <Property name='limit' type='string' key='limit'>
  448. (选填)每页数量,默认值:20
  449. </Property>
  450. </Properties>
  451. ### Response
  452. - `data` (List) 返回该APP的点赞、反馈列表。
  453. </Col>
  454. <Col sticky>
  455. <CodeGroup title="Request" tag="GET" label="/app/feedbacks" targetCode={`curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20'`}>
  456. ```bash {{ title: 'cURL' }}
  457. curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20' \
  458. --header 'Authorization: Bearer {api_key}' \
  459. --header 'Content-Type: application/json'
  460. ```
  461. </CodeGroup>
  462. <CodeGroup title="Response">
  463. ```json {{ title: 'Response' }}
  464. {
  465. "data": [
  466. {
  467. "id": "8c0fbed8-e2f9-49ff-9f0e-15a35bdd0e25",
  468. "app_id": "f252d396-fe48-450e-94ec-e184218e7346",
  469. "conversation_id": "2397604b-9deb-430e-b285-4726e51fd62d",
  470. "message_id": "709c0b0f-0a96-4a4e-91a4-ec0889937b11",
  471. "rating": "like",
  472. "content": "message feedback information-3",
  473. "from_source": "user",
  474. "from_end_user_id": "74286412-9a1a-42c1-929c-01edb1d381d5",
  475. "from_account_id": null,
  476. "created_at": "2025-04-24T09:24:38",
  477. "updated_at": "2025-04-24T09:24:38"
  478. }
  479. ]
  480. }
  481. ```
  482. </CodeGroup>
  483. </Col>
  484. </Row>
  485. ---
  486. <Heading
  487. url='/messages/{message_id}/suggested'
  488. method='GET'
  489. title='获取下一轮建议问题列表'
  490. name='#suggested'
  491. />
  492. <Row>
  493. <Col>
  494. 获取下一轮建议问题列表。
  495. ### Path Params
  496. <Properties>
  497. <Property name='message_id' type='string' key='message_id'>
  498. Message ID
  499. </Property>
  500. </Properties>
  501. ### Query
  502. <Properties>
  503. <Property name='user' type='string' key='user'>
  504. 用户标识,由开发者定义规则,需保证用户标识在应用内唯一。
  505. </Property>
  506. </Properties>
  507. </Col>
  508. <Col sticky>
  509. <CodeGroup title="Request" tag="GET" label="/messages/{message_id}/suggested" targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested?user=abc-123 \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json'`}>
  510. ```bash {{ title: 'cURL' }}
  511. curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested' \
  512. --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
  513. --header 'Content-Type: application/json' \
  514. ```
  515. </CodeGroup>
  516. <CodeGroup title="Response">
  517. ```json {{ title: 'Response' }}
  518. {
  519. "result": "success",
  520. "data": [
  521. "a",
  522. "b",
  523. "c"
  524. ]
  525. }
  526. ```
  527. </CodeGroup>
  528. </Col>
  529. </Row>
  530. ---
  531. ---
  532. <Heading
  533. url='/messages'
  534. method='GET'
  535. title='获取会话历史消息'
  536. name='#messages'
  537. />
  538. <Row>
  539. <Col>
  540. 滚动加载形式返回历史聊天记录,第一页返回最新 `limit` 条,即:倒序返回。
  541. ### Query
  542. <Properties>
  543. <Property name='conversation_id' type='string' key='conversation_id'>
  544. 会话 ID
  545. </Property>
  546. <Property name='user' type='string' key='user'>
  547. 用户标识,由开发者定义规则,需保证用户标识在应用内唯一。
  548. </Property>
  549. <Property name='first_id' type='string' key='first_id'>
  550. 当前页第一条聊天记录的 ID,默认 null
  551. </Property>
  552. <Property name='limit' type='int' key='limit'>
  553. 一次请求返回多少条聊天记录,默认 20 条。
  554. </Property>
  555. </Properties>
  556. ### Response
  557. - `data` (array[object]) 消息列表
  558. - `id` (string) 消息 ID
  559. - `conversation_id` (string) 会话 ID
  560. - `inputs` (object) 用户输入参数。
  561. - `query` (string) 用户输入 / 提问内容。
  562. - `message_files` (array[object]) 消息文件
  563. - `id` (string) ID
  564. - `type` (string) 文件类型,image 图片
  565. - `url` (string) 预览图片地址
  566. - `belongs_to` (string) 文件归属方,user 或 assistant
  567. - `agent_thoughts` (array[object]) Agent思考内容(仅Agent模式下不为空)
  568. - `id` (string) agent_thought ID,每一轮Agent迭代都会有一个唯一的id
  569. - `message_id` (string) 消息唯一ID
  570. - `position` (int) agent_thought在消息中的位置,如第一轮迭代position为1
  571. - `thought` (string) agent的思考内容
  572. - `observation` (string) 工具调用的返回结果
  573. - `tool` (string) 使用的工具列表,以 ; 分割多个工具
  574. - `tool_input` (string) 工具的输入,JSON格式的字符串(object)。如:`{"dalle3": {"prompt": "a cute cat"}}`
  575. - `created_at` (int) 创建时间戳,如:1705395332
  576. - `message_files` (array[string]) 当前agent_thought 关联的文件ID
  577. - `file_id` (string) 文件ID
  578. - `conversation_id` (string) 会话ID
  579. - `answer` (string) 回答消息内容
  580. - `created_at` (timestamp) 创建时间
  581. - `feedback` (object) 反馈信息
  582. - `rating` (string) 点赞 like / 点踩 dislike
  583. - `retriever_resources` (array[RetrieverResource]) 引用和归属分段列表
  584. - `has_more` (bool) 是否存在下一页
  585. - `limit` (int) 返回条数,若传入超过系统限制,返回系统限制数量
  586. </Col>
  587. <Col sticky>
  588. ### Request Example
  589. <CodeGroup title="Request" tag="GET" label="/messages" targetCode={`curl -X GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id=' \\\n--header 'Authorization: Bearer {api_key}'`}>
  590. ```bash {{ title: 'cURL' }}
  591. curl -X GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id='
  592. --header 'Authorization: Bearer {api_key}'
  593. ```
  594. </CodeGroup>
  595. ### Response Example(基础助手)
  596. <CodeGroup title="Response">
  597. ```json {{ title: 'Response' }}
  598. {
  599. "limit": 20,
  600. "has_more": false,
  601. "data": [
  602. {
  603. "id": "a076a87f-31e5-48dc-b452-0061adbbc922",
  604. "conversation_id": "cd78daf6-f9e4-4463-9ff2-54257230a0ce",
  605. "inputs": {
  606. "name": "dify"
  607. },
  608. "query": "iphone 13 pro",
  609. "answer": "The iPhone 13 Pro, released on September 24, 2021, features a 6.1-inch display with a resolution of 1170 x 2532. It is equipped with a Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard) processor, 6 GB of RAM, and offers storage options of 128 GB, 256 GB, 512 GB, and 1 TB. The camera is 12 MP, the battery capacity is 3095 mAh, and it runs on iOS 15.",
  610. "message_files": [],
  611. "feedback": null,
  612. "retriever_resources": [
  613. {
  614. "position": 1,
  615. "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb",
  616. "dataset_name": "iPhone",
  617. "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00",
  618. "document_name": "iPhone List",
  619. "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a",
  620. "score": 0.98457545,
  621. "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\"\n\"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\""
  622. }
  623. ],
  624. "agent_thoughts": [],
  625. "created_at": 1705569239
  626. }
  627. ]
  628. }
  629. ```
  630. </CodeGroup>
  631. ### Response Example(智能助手)
  632. <CodeGroup title="Response">
  633. ```json {{ title: 'Response' }}
  634. {
  635. "limit": 20,
  636. "has_more": false,
  637. "data": [
  638. {
  639. "id": "d35e006c-7c4d-458f-9142-be4930abdf94",
  640. "conversation_id": "957c068b-f258-4f89-ba10-6e8a0361c457",
  641. "inputs": {},
  642. "query": "draw a cat",
  643. "answer": "I have generated an image of a cat for you. Please check your messages to view the image.",
  644. "message_files": [
  645. {
  646. "id": "976990d2-5294-47e6-8f14-7356ba9d2d76",
  647. "type": "image",
  648. "url": "http://127.0.0.1:5001/files/tools/976990d2-5294-47e6-8f14-7356ba9d2d76.png?timestamp=1705988524&nonce=55df3f9f7311a9acd91bf074cd524092&sign=z43nMSO1L2HBvoqADLkRxr7Biz0fkjeDstnJiCK1zh8=",
  649. "belongs_to": "assistant"
  650. }
  651. ],
  652. "feedback": null,
  653. "retriever_resources": [],
  654. "created_at": 1705988187,
  655. "agent_thoughts": [
  656. {
  657. "id": "592c84cf-07ee-441c-9dcc-ffc66c033469",
  658. "chain_id": null,
  659. "message_id": "d35e006c-7c4d-458f-9142-be4930abdf94",
  660. "position": 1,
  661. "thought": "",
  662. "tool": "dalle2",
  663. "tool_input": "{\"dalle2\": {\"prompt\": \"cat\"}}",
  664. "created_at": 1705988186,
  665. "observation": "image has been created and sent to user already, you should tell user to check it now.",
  666. "files": [
  667. "976990d2-5294-47e6-8f14-7356ba9d2d76"
  668. ]
  669. },
  670. {
  671. "id": "73ead60d-2370-4780-b5ed-532d2762b0e5",
  672. "chain_id": null,
  673. "message_id": "d35e006c-7c4d-458f-9142-be4930abdf94",
  674. "position": 2,
  675. "thought": "I have generated an image of a cat for you. Please check your messages to view the image.",
  676. "tool": "",
  677. "tool_input": "",
  678. "created_at": 1705988199,
  679. "observation": "",
  680. "files": []
  681. }
  682. ]
  683. }
  684. ]
  685. }
  686. ```
  687. </CodeGroup>
  688. </Col>
  689. </Row>
  690. ---
  691. <Heading
  692. url='/conversations'
  693. method='GET'
  694. title='获取会话列表'
  695. name='#conversations'
  696. />
  697. <Row>
  698. <Col>
  699. 获取当前用户的会话列表,默认返回最近的 20 条。
  700. ### Query
  701. <Properties>
  702. <Property name='user' type='string' key='user'>
  703. 用户标识,由开发者定义规则,需保证用户标识在应用内唯一。
  704. </Property>
  705. <Property name='last_id' type='string' key='last_id'>
  706. (选填)当前页最后面一条记录的 ID,默认 null
  707. </Property>
  708. <Property name='limit' type='int' key='limit'>
  709. (选填)一次请求返回多少条记录,默认 20 条,最大 100 条,最小 1 条。
  710. </Property>
  711. <Property name='sort_by' type='string' key='sort_by'>
  712. (选填)排序字段,默认 -updated_at(按更新时间倒序排列)
  713. - 可选值:created_at, -created_at, updated_at, -updated_at
  714. - 字段前面的符号代表顺序或倒序,-代表倒序
  715. </Property>
  716. </Properties>
  717. ### Response
  718. - `data` (array[object]) 会话列表
  719. - `id` (string) 会话 ID
  720. - `name` (string) 会话名称,默认为会话中用户最开始问题的截取。
  721. - `inputs` (object) 用户输入参数。
  722. - `status` (string) 会话状态
  723. - `introduction` (string) 开场白
  724. - `created_at` (timestamp) 创建时间
  725. - `updated_at` (timestamp) 更新时间
  726. - `has_more` (bool)
  727. - `limit` (int) 返回条数,若传入超过系统限制,返回系统限制数量
  728. </Col>
  729. <Col sticky>
  730. <CodeGroup title="Request" tag="GET" label="/conversations" targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20'\\\n--header 'Authorization: Bearer {api_key}'`}>
  731. ```bash {{ title: 'cURL' }}
  732. curl -X GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20' \
  733. --header 'Authorization: Bearer {api_key}'
  734. ```
  735. </CodeGroup>
  736. <CodeGroup title="Response">
  737. ```json {{ title: 'Response' }}
  738. {
  739. "limit": 20,
  740. "has_more": false,
  741. "data": [
  742. {
  743. "id": "10799fb8-64f7-4296-bbf7-b42bfbe0ae54",
  744. "name": "New chat",
  745. "inputs": {
  746. "book": "book",
  747. "myName": "Lucy"
  748. },
  749. "status": "normal",
  750. "created_at": 1679667915,
  751. "updated_at": 1679667915
  752. },
  753. {
  754. "id": "hSIhXBhNe8X1d8Et"
  755. // ...
  756. }
  757. ]
  758. }
  759. ```
  760. </CodeGroup>
  761. </Col>
  762. </Row>
  763. ---
  764. <Heading
  765. url='/conversations/:conversation_id'
  766. method='DELETE'
  767. title='删除会话'
  768. name='#delete'
  769. />
  770. <Row>
  771. <Col>
  772. 删除会话。
  773. ### Path
  774. - `conversation_id` (string) 会话 ID
  775. ### Request Body
  776. <Properties>
  777. <Property name='user' type='string' key='user'>
  778. 用户标识,由开发者定义规则,需保证用户标识在应用内唯一。
  779. </Property>
  780. </Properties>
  781. ### Response
  782. - `result` (string) 固定返回 success
  783. </Col>
  784. <Col sticky>
  785. <CodeGroup title="Request" tag="DELETE" label="/conversations/:conversation_id" targetCode={`curl -X DELETE '${props.appDetail.api_base_url}/conversations/:conversation_id' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "user": "abc-123"\n}'`}>
  786. ```bash {{ title: 'cURL' }}
  787. curl -X DELETE '${props.appDetail.api_base_url}/conversations/{conversation_id}' \
  788. --header 'Content-Type: application/json' \
  789. --header 'Accept: application/json' \
  790. --header 'Authorization: Bearer {api_key}' \
  791. --data '{
  792. "user": "abc-123"
  793. }'
  794. ```
  795. </CodeGroup>
  796. <CodeGroup title="Response">
  797. ```text {{ title: 'Response' }}
  798. 204 No Content
  799. ```
  800. </CodeGroup>
  801. </Col>
  802. </Row>
  803. ---
  804. <Heading
  805. url='/conversations/:conversation_id/name'
  806. method='POST'
  807. title='会话重命名'
  808. name='#rename'
  809. />
  810. <Row>
  811. <Col>
  812. 对会话进行重命名,会话名称用于显示在支持多会话的客户端上。
  813. ### Path
  814. - `conversation_id` (string) 会话 ID
  815. ### Request Body
  816. <Properties>
  817. <Property name='name' type='string' key='name'>
  818. (选填)名称,若 `auto_generate` 为 `true` 时,该参数可不传。
  819. </Property>
  820. <Property name='auto_generate' type='bool' key='auto_generate'>
  821. (选填)自动生成标题,默认 false。
  822. </Property>
  823. <Property name='user' type='string' key='user'>
  824. 用户标识,由开发者定义规则,需保证用户标识在应用内唯一。
  825. </Property>
  826. </Properties>
  827. ### Response
  828. - `id` (string) 会话 ID
  829. - `name` (string) 会话名称
  830. - `inputs` (object) 用户输入参数
  831. - `status` (string) 会话状态
  832. - `introduction` (string) 开场白
  833. - `created_at` (timestamp) 创建时间
  834. - `updated_at` (timestamp) 更新时间
  835. </Col>
  836. <Col sticky>
  837. <CodeGroup title="Request" tag="POST" label="/conversations/:conversation_id/name" targetCode={`curl -X POST '${props.appDetail.api_base_url}/conversations/:conversation_id/name' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "name": "", \n "auto_generate": true, \n "user": "abc-123"\n}'`}>
  838. ```bash {{ title: 'cURL' }}
  839. curl -X POST '${props.appDetail.api_base_url}/conversations/{conversation_id}/name' \
  840. --header 'Authorization: Bearer {api_key}' \
  841. --header 'Content-Type: application/json' \
  842. --data-raw '{
  843. "name": "",
  844. "auto_generate": true,
  845. "user": "abc-123"
  846. }'
  847. ```
  848. </CodeGroup>
  849. <CodeGroup title="Response">
  850. ```json {{ title: 'Response' }}
  851. {
  852. "id": "34d511d5-56de-4f16-a997-57b379508443",
  853. "name": "hello",
  854. "inputs": {},
  855. "status": "normal",
  856. "introduction": "",
  857. "created_at": 1732731141,
  858. "updated_at": 1732734510
  859. }
  860. ```
  861. </CodeGroup>
  862. </Col>
  863. </Row>
  864. ---
  865. <Heading
  866. url='/conversations/:conversation_id/variables'
  867. method='GET'
  868. title='获取对话变量'
  869. name='#conversation-variables'
  870. />
  871. <Row>
  872. <Col>
  873. 从特定对话中检索变量。此端点对于提取对话过程中捕获的结构化数据非常有用。
  874. ### 路径参数
  875. <Properties>
  876. <Property name='conversation_id' type='string' key='conversation_id'>
  877. 要从中检索变量的对话ID。
  878. </Property>
  879. </Properties>
  880. ### 查询参数
  881. <Properties>
  882. <Property name='user' type='string' key='user'>
  883. 用户标识符,由开发人员定义的规则,在应用程序内必须唯一。
  884. </Property>
  885. <Property name='last_id' type='string' key='last_id'>
  886. (选填)当前页最后面一条记录的 ID,默认 null
  887. </Property>
  888. <Property name='limit' type='int' key='limit'>
  889. (选填)一次请求返回多少条记录,默认 20 条,最大 100 条,最小 1 条。
  890. </Property>
  891. </Properties>
  892. ### 响应
  893. - `limit` (int) 每页项目数
  894. - `has_more` (bool) 是否有更多项目
  895. - `data` (array[object]) 变量列表
  896. - `id` (string) 变量 ID
  897. - `name` (string) 变量名称
  898. - `value_type` (string) 变量类型(字符串、数字、布尔等)
  899. - `value` (string) 变量值
  900. - `description` (string) 变量描述
  901. - `created_at` (int) 创建时间戳
  902. - `updated_at` (int) 最后更新时间戳
  903. ### 错误
  904. - 404, `conversation_not_exists`, 对话不存在
  905. </Col>
  906. <Col sticky>
  907. <CodeGroup title="Request" tag="GET" label="/conversations/:conversation_id/variables" targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123' \\\n--header 'Authorization: Bearer {api_key}'`}>
  908. ```bash {{ title: 'cURL' }}
  909. curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123' \
  910. --header 'Authorization: Bearer {api_key}'
  911. ```
  912. </CodeGroup>
  913. <CodeGroup title="Request with variable name filter">
  914. ```bash {{ title: 'cURL' }}
  915. curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123&variable_name=customer_name' \
  916. --header 'Authorization: Bearer {api_key}'
  917. ```
  918. </CodeGroup>
  919. <CodeGroup title="Response">
  920. ```json {{ title: 'Response' }}
  921. {
  922. "limit": 100,
  923. "has_more": false,
  924. "data": [
  925. {
  926. "id": "variable-uuid-1",
  927. "name": "customer_name",
  928. "value_type": "string",
  929. "value": "John Doe",
  930. "description": "客户名称(从对话中提取)",
  931. "created_at": 1650000000000,
  932. "updated_at": 1650000000000
  933. },
  934. {
  935. "id": "variable-uuid-2",
  936. "name": "order_details",
  937. "value_type": "json",
  938. "value": "{\"product\":\"Widget\",\"quantity\":5,\"price\":19.99}",
  939. "description": "客户的订单详情",
  940. "created_at": 1650000000000,
  941. "updated_at": 1650000000000
  942. }
  943. ]
  944. }
  945. ```
  946. </CodeGroup>
  947. </Col>
  948. </Row>
  949. ---
  950. <Heading
  951. url='/audio-to-text'
  952. method='POST'
  953. title='语音转文字'
  954. name='#audio'
  955. />
  956. <Row>
  957. <Col>
  958. ### Request Body
  959. 该接口需使用 `multipart/form-data` 进行请求。
  960. <Properties>
  961. <Property name='file' type='file' key='file'>
  962. 语音文件。
  963. 支持格式:`['mp3', 'mp4', 'mpeg', 'mpga', 'm4a', 'wav', 'webm']`
  964. 文件大小限制:15MB
  965. </Property>
  966. <Property name='user' type='string' key='user'>
  967. 用户标识,由开发者定义规则,需保证用户标识在应用内唯一。
  968. </Property>
  969. </Properties>
  970. ### Response
  971. - `text` (string) 输出文字
  972. </Col>
  973. <Col sticky>
  974. <CodeGroup title="Request" tag="POST" label="/audio-to-text" targetCode={`curl -X POST '${props.appDetail.api_base_url}/audio-to-text' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'file=@localfile;type=audio/[mp3|mp4|mpeg|mpga|m4a|wav|webm]`}>
  975. ```bash {{ title: 'cURL' }}
  976. curl -X POST '${props.appDetail.api_base_url}/conversations/name' \
  977. --header 'Authorization: Bearer {api_key}' \
  978. --form 'file=@localfile;type=audio/mp3'
  979. ```
  980. </CodeGroup>
  981. <CodeGroup title="Response">
  982. ```json {{ title: 'Response' }}
  983. {
  984. "text": "hello"
  985. }
  986. ```
  987. </CodeGroup>
  988. </Col>
  989. </Row>
  990. ---
  991. <Heading
  992. url='/text-to-audio'
  993. method='POST'
  994. title='文字转语音'
  995. name='#audio'
  996. />
  997. <Row>
  998. <Col>
  999. 文字转语音。
  1000. ### Request Body
  1001. <Properties>
  1002. <Property name='message_id' type='str' key='message_id'>
  1003. Dify 生成的文本消息,那么直接传递生成的message-id 即可,后台会通过 message_id 查找相应的内容直接合成语音信息。如果同时传 message_id 和 text,优先使用 message_id。
  1004. </Property>
  1005. <Property name='text' type='str' key='text'>
  1006. 语音生成内容。如果没有传 message-id的话,则会使用这个字段的内容
  1007. </Property>
  1008. <Property name='user' type='string' key='user'>
  1009. 用户标识,由开发者定义规则,需保证用户标识在应用内唯一。
  1010. </Property>
  1011. </Properties>
  1012. </Col>
  1013. <Col sticky>
  1014. <CodeGroup title="Request" tag="POST" label="/text-to-audio" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/text-to-audio' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--form 'text=你好Dify;user=abc-123;message_id=5ad4cb98-f0c7-4085-b384-88c403be6290`}>
  1015. ```bash {{ title: 'cURL' }}
  1016. curl --location --request POST '${props.appDetail.api_base_url}/text-to-audio' \
  1017. --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
  1018. --form 'file=你好Dify;user=abc-123;message_id=5ad4cb98-f0c7-4085-b384-88c403be6290'
  1019. ```
  1020. </CodeGroup>
  1021. <CodeGroup title="headers">
  1022. ```json {{ title: 'headers' }}
  1023. {
  1024. "Content-Type": "audio/wav"
  1025. }
  1026. ```
  1027. </CodeGroup>
  1028. </Col>
  1029. </Row>
  1030. ---
  1031. <Heading
  1032. url='/info'
  1033. method='GET'
  1034. title='获取应用基本信息'
  1035. name='#info'
  1036. />
  1037. <Row>
  1038. <Col>
  1039. 用于获取应用的基本信息
  1040. ### Response
  1041. - `name` (string) 应用名称
  1042. - `description` (string) 应用描述
  1043. - `tags` (array[string]) 应用标签
  1044. - `mode` (string) 应用模式
  1045. - 'author_name' (string) 作者名称
  1046. </Col>
  1047. <Col>
  1048. <CodeGroup title="Request" tag="GET" label="/info" targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\\n-H 'Authorization: Bearer {api_key}'`}>
  1049. ```bash {{ title: 'cURL' }}
  1050. curl -X GET '${props.appDetail.api_base_url}/info' \
  1051. -H 'Authorization: Bearer {api_key}'
  1052. ```
  1053. </CodeGroup>
  1054. <CodeGroup title="Response">
  1055. ```json {{ title: 'Response' }}
  1056. {
  1057. "name": "My App",
  1058. "description": "This is my app.",
  1059. "tags": [
  1060. "tag1",
  1061. "tag2"
  1062. ],
  1063. "mode": "chat",
  1064. "author_name": "Dify"
  1065. }
  1066. ```
  1067. </CodeGroup>
  1068. </Col>
  1069. </Row>
  1070. ---
  1071. <Heading
  1072. url='/parameters'
  1073. method='GET'
  1074. title='获取应用参数'
  1075. name='#parameters'
  1076. />
  1077. <Row>
  1078. <Col>
  1079. 用于进入页面一开始,获取功能开关、输入参数名称、类型及默认值等使用。
  1080. ### Response
  1081. - `opening_statement` (string) 开场白
  1082. - `suggested_questions` (array[string]) 开场推荐问题列表
  1083. - `suggested_questions_after_answer` (object) 启用回答后给出推荐问题。
  1084. - `enabled` (bool) 是否开启
  1085. - `speech_to_text` (object) 语音转文本
  1086. - `enabled` (bool) 是否开启
  1087. - `text_to_speech` (object) 文本转语音
  1088. - `enabled` (bool) 是否开启
  1089. - `voice` (string) 语音类型
  1090. - `language` (string) 语言
  1091. - `autoPlay` (string) 自动播放
  1092. - `enabled` 开启
  1093. - `disabled` 关闭
  1094. - `retriever_resource` (object) 引用和归属
  1095. - `enabled` (bool) 是否开启
  1096. - `annotation_reply` (object) 标记回复
  1097. - `enabled` (bool) 是否开启
  1098. - `user_input_form` (array[object]) 用户输入表单配置
  1099. - `text-input` (object) 文本输入控件
  1100. - `label` (string) 控件展示标签名
  1101. - `variable` (string) 控件 ID
  1102. - `required` (bool) 是否必填
  1103. - `default` (string) 默认值
  1104. - `paragraph` (object) 段落文本输入控件
  1105. - `label` (string) 控件展示标签名
  1106. - `variable` (string) 控件 ID
  1107. - `required` (bool) 是否必填
  1108. - `default` (string) 默认值
  1109. - `select` (object) 下拉控件
  1110. - `label` (string) 控件展示标签名
  1111. - `variable` (string) 控件 ID
  1112. - `required` (bool) 是否必填
  1113. - `default` (string) 默认值
  1114. - `options` (array[string]) 选项值
  1115. - `file_upload` (object) 文件上传配置
  1116. - `document` (object) 文档设置
  1117. 当前仅支持文档类型:`txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`。
  1118. - `enabled` (bool) 是否启用
  1119. - `number_limits` (int) 文档数量限制,默认为 3
  1120. - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。
  1121. - `image` (object) 图片设置
  1122. 当前仅支持图片类型:`png`, `jpg`, `jpeg`, `webp`, `gif`。
  1123. - `enabled` (bool) 是否启用
  1124. - `number_limits` (int) 图片数量限制,默认为 3
  1125. - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。
  1126. - `audio` (object) 音频设置
  1127. 当前仅支持音频类型:`mp3`, `m4a`, `wav`, `webm`, `amr`。
  1128. - `enabled` (bool) 是否启用
  1129. - `number_limits` (int) 音频数量限制,默认为 3
  1130. - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。
  1131. - `video` (object) 视频设置
  1132. 当前仅支持视频类型:`mp4`, `mov`, `mpeg`, `mpga`。
  1133. - `enabled` (bool) 是否启用
  1134. - `number_limits` (int) 视频数量限制,默认为 3
  1135. - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。
  1136. - `custom` (object) 自定义设置
  1137. - `enabled` (bool) 是否启用
  1138. - `number_limits` (int) 自定义数量限制,默认为 3
  1139. - `transfer_methods` (array[string]) 传输方式列表:`remote_url`, `local_file`,必须选择一个。
  1140. - `system_parameters` (object) 系统参数
  1141. - `file_size_limit` (int) 文档上传大小限制 (MB)
  1142. - `image_file_size_limit` (int) 图片文件上传大小限制(MB)
  1143. - `audio_file_size_limit` (int) 音频文件上传大小限制 (MB)
  1144. - `video_file_size_limit` (int) 视频文件上传大小限制 (MB)
  1145. </Col>
  1146. <Col sticky>
  1147. <CodeGroup title="Request" tag="GET" label="/parameters" targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters'\\\n--header 'Authorization: Bearer {api_key}'`}>
  1148. ```bash {{ title: 'cURL' }}
  1149. curl -X GET '${props.appDetail.api_base_url}/parameters' \
  1150. --header 'Authorization: Bearer {api_key}'
  1151. ```
  1152. </CodeGroup>
  1153. <CodeGroup title="Response">
  1154. ```json {{ title: 'Response' }}
  1155. {
  1156. "introduction": "nice to meet you",
  1157. "user_input_form": [
  1158. {
  1159. "text-input": {
  1160. "label": "a",
  1161. "variable": "a",
  1162. "required": true,
  1163. "max_length": 48,
  1164. "default": ""
  1165. }
  1166. },
  1167. {
  1168. // ...
  1169. }
  1170. ],
  1171. "file_upload": {
  1172. "image": {
  1173. "enabled": true,
  1174. "number_limits": 3,
  1175. "transfer_methods": [
  1176. "remote_url",
  1177. "local_file"
  1178. ]
  1179. }
  1180. },
  1181. "system_parameters": {
  1182. "file_size_limit": 15,
  1183. "image_file_size_limit": 10,
  1184. "audio_file_size_limit": 50,
  1185. "video_file_size_limit": 100
  1186. }
  1187. }
  1188. ```
  1189. </CodeGroup>
  1190. </Col>
  1191. </Row>
  1192. ---
  1193. <Heading
  1194. url='/meta'
  1195. method='GET'
  1196. title='获取应用Meta信息'
  1197. name='#meta'
  1198. />
  1199. <Row>
  1200. <Col>
  1201. 用于获取工具 icon
  1202. ### Response
  1203. - `tool_icons`(object[string]) 工具图标
  1204. - `工具名称` (string)
  1205. - `icon` (object|string)
  1206. - (object) 图标
  1207. - `background` (string) hex 格式的背景色
  1208. - `content`(string) emoji
  1209. - (string) 图标 URL
  1210. </Col>
  1211. <Col>
  1212. <CodeGroup title="Request" tag="POST" label="/meta" targetCode={`curl -X GET '${props.appDetail.api_base_url}/meta' \\\n-H 'Authorization: Bearer {api_key}'`}>
  1213. ```bash {{ title: 'cURL' }}
  1214. curl -X GET '${props.appDetail.api_base_url}/meta' \
  1215. -H 'Authorization: Bearer {api_key}'
  1216. ```
  1217. </CodeGroup>
  1218. <CodeGroup title="Response">
  1219. ```json {{ title: 'Response' }}
  1220. {
  1221. "tool_icons": {
  1222. "dalle2": "https://cloud.dify.ai/console/api/workspaces/current/tool-provider/builtin/dalle/icon",
  1223. "api_tool": {
  1224. "background": "#252525",
  1225. "content": "\ud83d\ude01"
  1226. }
  1227. }
  1228. }
  1229. ```
  1230. </CodeGroup>
  1231. </Col>
  1232. </Row>
  1233. ---
  1234. <Heading
  1235. url='/site'
  1236. method='GET'
  1237. title='获取应用 WebApp 设置'
  1238. name='#site'
  1239. />
  1240. <Row>
  1241. <Col>
  1242. 用于获取应用的 WebApp 设置
  1243. ### Response
  1244. - `title` (string) WebApp 名称
  1245. - `chat_color_theme` (string) 聊天颜色主题,hex 格式
  1246. - `chat_color_theme_inverted` (bool) 聊天颜色主题是否反转
  1247. - `icon_type` (string) 图标类型,`emoji`-表情,`image`-图片
  1248. - `icon` (string) 图标,如果是 `emoji` 类型,则是 emoji 表情符号,如果是 `image` 类型,则是图片 URL
  1249. - `icon_background` (string) hex 格式的背景色
  1250. - `icon_url` (string) 图标 URL
  1251. - `description` (string) 描述
  1252. - `copyright` (string) 版权信息
  1253. - `privacy_policy` (string) 隐私政策链接
  1254. - `custom_disclaimer` (string) 自定义免责声明
  1255. - `default_language` (string) 默认语言
  1256. - `show_workflow_steps` (bool) 是否显示工作流详情
  1257. - `use_icon_as_answer_icon` (bool) 是否使用 WebApp 图标替换聊天中的 🤖
  1258. </Col>
  1259. <Col>
  1260. <CodeGroup title="Request" tag="POST" label="/meta" targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\\n-H 'Authorization: Bearer {api_key}'`}>
  1261. ```bash {{ title: 'cURL' }}
  1262. curl -X GET '${props.appDetail.api_base_url}/site' \
  1263. -H 'Authorization: Bearer {api_key}'
  1264. ```
  1265. </CodeGroup>
  1266. <CodeGroup title="Response">
  1267. ```json {{ title: 'Response' }}
  1268. {
  1269. "title": "My App",
  1270. "chat_color_theme": "#ff4a4a",
  1271. "chat_color_theme_inverted": false,
  1272. "icon_type": "emoji",
  1273. "icon": "😄",
  1274. "icon_background": "#FFEAD5",
  1275. "icon_url": null,
  1276. "description": "This is my app.",
  1277. "copyright": "all rights reserved",
  1278. "privacy_policy": "",
  1279. "custom_disclaimer": "All generated by AI",
  1280. "default_language": "en-US",
  1281. "show_workflow_steps": false,
  1282. "use_icon_as_answer_icon": false,
  1283. }
  1284. ```
  1285. </CodeGroup>
  1286. </Col>
  1287. </Row>
  1288. ___