summaryrefslogtreecommitdiff
path: root/data/zh_cn/wuyingai/2026-03-11/api-docs.php
blob: 055522d024f4d215e45781229161f254e115db38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
<?php return [
    'version' => '1.0',
    'info' => ['style' => 'RPC', 'product' => 'WuyingAI', 'version' => '2026-03-11'],
    'directories' => [
        [
            'children' => ['GetAccessToken', 'Chat'],
            'type' => 'directory',
            'title' => '会话交互',
            'id' => 452273,
        ],
    ],
    'components' => [
        'schemas' => [],
    ],
    'apis' => [
        'Chat' => [
            'path' => '/api/agent/chat',
            'methods' => ['post', 'get'],
            'schemes' => ['https', 'sse'],
            'security' => [
                [
                    'Anonymous' => [],
                ],
            ],
            'operationType' => 'read',
            'deprecated' => false,
            'systemTags' => ['operationType' => 'update', 'riskType' => 'none', 'chargeType' => 'free'],
            'parameters' => [
                [
                    'name' => 'Input',
                    'in' => 'formData',
                    'style' => 'json',
                    'schema' => [
                        'title' => '消息列表(JSON 字符串),按时间顺序排列',
                        'description' => '消息列表(JSON 字符串),按时间顺序排列',
                        'type' => 'array',
                        'items' => [
                            'type' => 'object',
                            'properties' => [
                                'Role' => [
                                    'title' => '消息角色',
                                    'description' => '消息角色',
                                    'type' => 'string',
                                    'required' => false,
                                    'enumValueTitles' => ['user / assistant / system / tool' => 'user / assistant / system / tool'],
                                    'example' => 'user',
                                ],
                                'Content' => [
                                    'title' => '内容块列表',
                                    'description' => '内容块列表',
                                    'type' => 'array',
                                    'items' => [
                                        'type' => 'object',
                                        'properties' => [
                                            'Type' => [
                                                'title' => '内容类型',
                                                'description' => '内容类型',
                                                'type' => 'string',
                                                'required' => false,
                                                'enumValueTitles' => ['text/file/image' => 'text/file/image'],
                                                'example' => 'text',
                                            ],
                                            'Text' => ['title' => '文本内容(Type=text)', 'description' => '文本内容(Type=text)', 'type' => 'string', 'required' => false, 'example' => '帮我分析这张图片'],
                                            'ImageUrl' => ['title' => '图片 URL 或 base64(Type=image)', 'description' => '图片 URL 或 base64(Type=image)', 'type' => 'string', 'required' => false, 'example' => 'https://example.com/img.jpg'],
                                            'FileUrl' => ['title' => '文件路径或 URL(Type=file)', 'description' => '文件路径或 URL(Type=file)', 'type' => 'string', 'required' => false, 'example' => '/workspace/report.pdf'],
                                            'FileName' => ['type' => 'string', 'example' => 'report.pdf'],
                                        ],
                                        'required' => false,
                                        'description' => '',
                                    ],
                                    'required' => false,
                                ],
                            ],
                            'required' => false,
                            'description' => '',
                        ],
                        'required' => false,
                        'example' => '[{"Role":"user","Content":[{"Type":"text","Text":"你好"}]}]',
                    ],
                ],
                [
                    'name' => 'SessionId',
                    'in' => 'formData',
                    'schema' => ['title' => '会话 ID,用于多轮对话上下文保持', 'description' => '会话 ID,用于多轮对话上下文保持', 'type' => 'string', 'required' => false, 'example' => 'test-session-001'],
                ],
                [
                    'name' => 'RoutingKey',
                    'in' => 'formData',
                    'schema' => ['title' => '路由键,用于指定处理请求的后端实例', 'description' => '路由键,用于指定处理请求的后端实例', 'type' => 'string', 'required' => false, 'example' => '""'],
                ],
                [
                    'name' => 'Authorization',
                    'in' => 'query',
                    'schema' => ['title' => 'Bearer + 由 GetAccessToken 返回的 JWT,整段 URL 编码后放入 Query', 'description' => 'Bearer + 由 GetAccessToken 返回的 JWT,整段 URL 编码后放入 Query', 'type' => 'string', 'required' => false, 'example' => 'Bearer%20eyJhb****...****k'],
                ],
                [
                    'name' => 'ExternalUserId',
                    'in' => 'formData',
                    'schema' => ['title' => '用户 ID', 'description' => '外部系统用户ID', 'type' => 'string', 'required' => false, 'example' => 'test-user'],
                ],
                [
                    'name' => 'TemplateId',
                    'in' => 'query',
                    'schema' => ['title' => 'Agent 模板 ID', 'description' => 'Agent 模板 ID', 'type' => 'string', 'required' => false, 'example' => 'template-abc123'],
                ],
                [
                    'name' => 'StreamOptions',
                    'in' => 'formData',
                    'style' => 'json',
                    'schema' => [
                        'title' => '流式输出控制选项。包含 IncludeReasoning(boolean,默认 true,是否包含模型思考过程)和 IncludeToolCalls(boolean,默认 true,是否包含工具调用详细信息)。不传或传空对象时行为与旧版一致。',
                        'description' => '流式输出控制选项。包含 IncludeReasoning(boolean,默认 true,是否包含模型思考过程)和 IncludeToolCalls(boolean,默认 true,是否包含工具调用详细信息)。不传或传空对象时行为与旧版一致。',
                        'type' => 'object',
                        'properties' => [
                            'IncludeReasoning' => ['title' => '是否包含模型思考过程。设为 false 时,SSE 流中将不包含 Type="reasoning" 的 message 和其 content 事件', 'description' => '是否包含模型思考过程。设为 false 时,SSE 流中将不包含 Type="reasoning" 的 message 和其 content 事件', 'type' => 'boolean', 'required' => false, 'example' => 'true'],
                            'IncludeToolCalls' => ['title' => '是否包含工具调用详情。设为 false 时,SSE 流中将不包含 plugin_call/plugin_call_output/mcp_call/mcp_call_output 类型的 message 和其 content 事件', 'description' => '是否包含工具调用详情。设为 false 时,SSE 流中将不包含 plugin_call/plugin_call_output/mcp_call/mcp_call_output 类型的 message 和其 content 事件', 'type' => 'boolean', 'required' => false, 'example' => 'true'],
                        ],
                        'required' => false,
                        'example' => '{"IncludeReasoning": false, "IncludeToolCalls": false}',
                    ],
                ],
                [
                    'name' => 'Settings',
                    'in' => 'formData',
                    'style' => 'json',
                    'schema' => [
                        'title' => '其他设置信息。包含输出文件模式控制参数OutputFileMode(string,可选url或base64,当前为兼容旧版默认 base64,推荐使用url)',
                        'description' => '其他设置信息。包含输出文件模式控制参数OutputFileMode(string,可选url或base64,当前为兼容旧版默认 base64,推荐使用url)',
                        'type' => 'object',
                        'properties' => [
                            'OutputFileMode' => ['title' => '控制文件输出模式的参数,可选url或base64, 当前为兼容旧版不传本参数默认使用 base64', 'description' => '控制文件输出模式的参数,可选url或base64, 当前为兼容旧版不传本参数默认使用 base64', 'type' => 'string', 'required' => false, 'example' => 'base64'],
                        ],
                        'required' => false,
                        'example' => '{"OutputFileMode": "url"}',
                    ],
                ],
                [
                    'name' => 'Model',
                    'in' => 'formData',
                    'schema' => ['type' => 'string'],
                ],
                [
                    'name' => 'Resume',
                    'in' => 'formData',
                    'schema' => ['type' => 'boolean'],
                ],
            ],
            'responses' => [
                200 => [
                    'schema' => [
                        'type' => 'object',
                        'properties' => [
                            'RequestId' => ['title' => '请求 ID', 'description' => '请求 ID', 'type' => 'string', 'example' => 'EA12****-****-****-****-****E5C'],
                            'Role' => ['title' => '角色(user / assistant / system / tool)', 'description' => '角色(user / assistant / system / tool)', 'type' => 'string', 'example' => 'user'],
                            'Status' => ['title' => '回复状态(created / in_progress / completed)', 'description' => '回复状态(created / in_progress / completed)', 'type' => 'string', 'example' => 'in_progress'],
                            'Type' => ['title' => '消息类型(reasoning(模型思考过程) / message(正式回复))', 'description' => '消息类型(reasoning(模型思考过程) / message(正式回复))', 'type' => 'string', 'example' => 'message / text'."\n"],
                            'Content' => [
                                'title' => '内容块列表(仅 completed 时携带)',
                                'description' => '内容块列表(仅 completed 时携带)',
                                'type' => 'array',
                                'items' => [
                                    'type' => 'object',
                                    'properties' => [
                                        'Object' => ['title' => '对象类型', 'description' => '对象类型', 'type' => 'string', 'example' => '""'],
                                        'Text' => ['title' => '文本内容', 'description' => '文本内容', 'type' => 'string', 'example' => '您好'],
                                        'Type' => ['title' => '内容类型("text" / "data")', 'description' => '内容类型("text" / "data")', 'type' => 'string', 'example' => 'text'],
                                        'Data' => ['title' => '结构化数据(如工具调用)。示例:{"call_id":"call_xxx","name":"get_weather", "output":"工具返回明细,文本格式"}', 'description' => '结构化数据(如工具调用)。示例:{"call_id":"call_xxx","name":"get_weather", "output":"工具返回明细,文本格式"}', 'type' => 'object', 'example' => '{"call_id":"call_xxx","name":"get_weather","arguments":"{"city":"Beijing"}"}'],
                                    ],
                                    'description' => '',
                                ],
                            ],
                            'SequenceNumber' => ['title' => '事件序号(字符串形式的递增整数,用于保证顺序)。注意:当 StreamOptions 过滤掉某类事件时,被过滤事件仍占用序号,因此客户端收到的序号可能不连续', 'description' => '事件序号(字符串形式的递增整数,用于保证顺序)。注意:当 StreamOptions 过滤掉某类事件时,被过滤事件仍占用序号,因此客户端收到的序号可能不连续', 'type' => 'string', 'example' => '1'],
                            'Object' => [
                                'title' => '事件对象类型',
                                'description' => '事件对象类型',
                                'type' => 'string',
                                'enumValueTitles' => ['response / message / content' => 'response / message / content'],
                                'example' => 'response',
                            ],
                            'Id' => ['title' => '消息唯一标识', 'description' => '消息唯一标识', 'type' => 'string', 'example' => 'msg_xxx'],
                            'Text' => ['title' => '增量文本内容(Object=content 事件携带)', 'description' => '增量文本内容(Object=content 事件携带)', 'type' => 'string', 'example' => '"hello"'],
                            'Created' => ['description' => '(已废弃)创建时间戳', 'type' => 'string', 'example' => '1773380609'],
                            'CreatedAt' => ['title' => '创建时间戳(Unix 秒)', 'description' => '创建时间戳(Unix 秒)', 'type' => 'string', 'example' => '1773380609'],
                            'SessionId' => ['title' => '会话 ID', 'description' => '会话 ID', 'type' => 'string', 'example' => '176405663****961'],
                            'Success' => ['title' => '是否成功', 'description' => '是否成功', 'type' => 'boolean', 'example' => 'true'],
                            'Code' => ['title' => '业务状态码', 'description' => '业务状态码', 'type' => 'string', 'example' => '200'],
                            'HttpStatusCode' => ['title' => 'HTTP 状态码', 'description' => 'HTTP 状态码', 'type' => 'integer', 'format' => 'int32', 'example' => '200'],
                            'Message' => ['title' => '错误详情(失败时返回)', 'description' => '错误详情(失败时返回)', 'type' => 'string', 'example' => 'null'],
                            'TraceId' => ['type' => 'string', 'example' => '0a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d'],
                        ],
                        'description' => '',
                    ],
                ],
            ],
            'staticInfo' => ['returnType' => 'synchronous'],
            'title' => '流式对话',
            'summary' => '与 JVS Crew 进行流式对话,采用 Server-Sent Events (SSE) 协议实时推送对话内容。',
            'description' => '**特性**'."\n"
                ."\n"
                .'- 实时流式响应,降低首字延迟'."\n"
                .'- 支持多模态输入(文本、图片、文件)'."\n"
                .'- 会话保持,支持多轮对话'."\n"
                .'- 事件驱动,精确控制消息状态'."\n"
                ."\n"
                .'**请求信息**'."\n"
                ."\n"
                .'- **请求方法**: `POST`'."\n"
                .'- **Content-Type**: `application/json`'."\n"
                .'-  **响应 Content-Type**: `text/event-stream`',
            'requestParamsDescription' => '##### StreamOptions 结构说明'."\n"
                ."\n"
                .'`StreamOptions` 是可选的流式输出控制参数,用于精简 SSE 流返回的事件内容。'."\n"
                ."\n"
                .'**使用建议**:面向终端用户的 C 端场景建议设置 `"IncludeReasoning": false, "IncludeToolCalls": false`,可大幅简化客户端解析逻辑。'."\n"
                ."\n"
                .'**注意**:'."\n"
                .'- 未传 `StreamOptions` 或传空对象 `{}` 时,默认行为与旧版完全一致'."\n"
                .'- 过滤仅影响 SSE 输出,不影响模型推理过程和工具调用的实际执行'."\n"
                .'- 过滤后 `SequenceNumber` 不保证连续,但顺序正确'."\n"
                ."\n"
                .'##### Settings 结构说明'."\n"
                ."\n"
                .'**使用建议**:传递`base64`时,工具输出的file类型数据结构,以base64形式返回,但base64大小过大会影响SSE传输稳定性,故不推荐使用。传递`url`时,会传递临时可下载的url。'."\n"
                ."\n"
                .'**注意**:'."\n"
                .'- 未传`Settings` 或传空对象 `{}` 时,默认行为为使用`base64`'."\n"
                .'- 后续计划会切换为默认模式为`url`,故建议接入时使用`url`模式'."\n"
                ."\n"
                .'##### Input 结构说明'."\n"
                ."\n"
                .'`Input` 参数是一个 **JSON 字符串**(非对象数组),包含 Message 数组,需要先序列化为字符串再传递。'."\n"
                ."\n\n"
                .'#### 请求示例'."\n"
                ."\n"
                .'```bash'."\n"
                .'curl -N -X POST \\'."\n"
                .'  \'https://wuyingai.cn-shanghai.aliyuncs.com/api/agent/chat?Authorization=Bearer%20<access_token>&TemplateId=<template_id>\' \\'."\n"
                .'  -H \'Content-Type: application/json\' \\'."\n"
                .'  -H \'Accept: text/event-stream\' \\'."\n"
                .'  -H \'Cache-Control: no-cache\' \\'."\n"
                .'  -H \'Connection: keep-alive\' \\'."\n"
                .'  -H \'x-acs-version: 2026-03-11\' \\'."\n"
                .'  -H \'x-acs-action: Chat\' \\'."\n"
                .'  -H \'x-acs-date: 2026-03-18T06:21:31Z\' \\'."\n"
                .'  -d \'{'."\n"
                .'    "Input": "[{\\"Role\\":\\"user\\",\\"Content\\":[{\\"Type\\":\\"text\\",\\"Text\\":\\"你好\\"}]}]",'."\n"
                .'    "ExternalUserId": "test-user",'."\n"
                .'    "SessionId": "test-session-001",'."\n"
                .'    "StreamOptions": {'."\n"
                .'      "IncludeReasoning": false,'."\n"
                .'      "IncludeToolCalls": false'."\n"
                .'    },'."\n"
                .'    "Settings": {'."\n"
                .'      "OutputFileMode": "url"'."\n"
                .'    }'."\n"
                .'  }\''."\n"
                ."\n"
                .'```'."\n"
                ."\n"
                .'**注意**:'."\n"
                ."\n"
                .'*   `-N` 参数用于禁用缓冲,实时接收 SSE 流'."\n"
                ."\n"
                .'*   `x-acs-date` 需要设置为当前 UTC 时间(ISO 8601 格式)'."\n"
                ."\n"
                .'*   `Input` 是 JSON 字符串,需要转义引号'."\n"
                ."\n"
                .'*   `<access_token>` 替换为实际的访问令牌,若令牌过期(401 错误),需重新调用 GetAccessToken 获取',
            'responseParamsDescription' => '#### Response 事件字段'."\n"
                ."\n"
                .'`Object=response` 事件是整个回复的生命周期包装,标记回复的开始与结束。'."\n"
                ."\n"
                .'#### Message 事件字段'."\n"
                ."\n"
                .'`Object=message` 事件表示一段具体的消息,通过 `Type` 字段区分消息类型。'."\n"
                ."\n"
                .'#### 事件类型说明'."\n"
                ."\n"
                .'| 事件类型 | Object | 描述 | 触发时机 |'."\n"
                .'| --- | --- | --- | --- |'."\n"
                .'| 回复创建 | `response` | Status=`created`,整个回复的生命周期开始 | SSE 流开始 |'."\n"
                .'| 回复进行中 | `response` | Status=`in_progress` | 开始生成内容 |'."\n"
                .'| 思考开始 | `message` | Type=`reasoning`, Status=`in_progress` | 模型开始推理 |'."\n"
                .'| 思考内容增量 | `content` | 思考阶段的文本片段(Status=`in_progress`) | 每生成一段思考文本 |'."\n"
                .'| 思考完成 | `message` | Type=`reasoning`, Status=`completed` | 推理结束 |'."\n"
                .'| 消息开始 | `message` | Type=`message`, Status=`in_progress` | 开始生成正式回复 |'."\n"
                .'| 消息内容增量 | `content` | 正式回复的文本片段(Status=`in_progress`) | 每生成一段回复文本 |'."\n"
                .'| 消息内容完成 | `content` | 聚合后的完整文本(Status=`completed`) | 正式回复文本生成完毕 |'."\n"
                .'| 消息完成 | `message` | Type=`message`, Status=`completed` | 正式回复结束 |'."\n"
                .'| 回复完成 | `response` | Status=`completed` | SSE 流结束 |'."\n"
                .'| 错误 | `error` | 错误信息 | 发生错误时 |'."\n"
                .'| 心跳 | `:ping`(注释行) | 保持长连接,客户端忽略即可 | 空闲时每隔数秒 |'."\n"
                ."\n"
                .'> **注意**:思考阶段(`reasoning`)的 content 是模型内部推理过程,通常不应展示给终端用户。客户端应通过判断当前 message 的 Type 来决定是否展示对应的 content。'."\n"
                ."\n"
                .'#### SSE 响应示例'."\n"
                ."\n"
                .'**完整流程**:'."\n"
                ."\n"
                .'```text'."\n"
                .'data: {"Object":"response","Status":"created","SequenceNumber":"0"}'."\n"
                ."\n"
                .'data: {"Object":"response","Status":"in_progress","SequenceNumber":"1"}'."\n"
                ."\n"
                .': ping'."\n"
                ."\n"
                .'data: {"Object":"message","Id":"msg_001","SessionId":"176405663****961","Type":"reasoning","Status":"in_progress","SequenceNumber":"2"}'."\n"
                ."\n"
                .'data: {"Object":"content","Id":"msg_001","Type":"text","Status":"in_progress","Text":"用户在打招呼","SequenceNumber":"3"}'."\n"
                ."\n"
                .'data: {"Object":"content","Id":"msg_001","Type":"text","Status":"in_progress","Text":",我简单回复即可","SequenceNumber":"4"}'."\n"
                ."\n"
                .'data: {"Object":"message","Id":"msg_001","Type":"message","Status":"in_progress","SequenceNumber":"5"}'."\n"
                ."\n"
                .'data: {"Object":"content","Id":"msg_001","Type":"text","Status":"in_progress","Text":"您好","SequenceNumber":"6"}'."\n"
                ."\n"
                .'data: {"Object":"content","Id":"msg_001","Type":"text","Status":"in_progress","Text":"!","SequenceNumber":"7"}'."\n"
                ."\n"
                .'data: {"Object":"content","Id":"msg_001","Type":"text","Status":"completed","Text":"用户在打招呼,我简单回复即可","SequenceNumber":"8"}'."\n"
                ."\n"
                .'data: {"Object":"message","Id":"msg_001","Type":"reasoning","Status":"completed","SequenceNumber":"9"}'."\n"
                ."\n"
                .'data: {"Object":"message","Id":"msg_001","Type":"message","Status":"completed","Content":[{"Type":"text","Text":"您好!"}],"SequenceNumber":"10"}'."\n"
                ."\n"
                .'data: {"Object":"response","Status":"completed","SequenceNumber":"11"}'."\n"
                .'```'."\n"
                ."\n"
                .'> **提示**:'."\n"
                .'> - `SequenceNumber=3~4` 的 content 属于 `reasoning`(思考)阶段,`SequenceNumber=6~7` 的 content 属于 `message`(正式回复)阶段。客户端应只展示 `message` 阶段的 content。'."\n"
                .'> - `SequenceNumber=8` 是 `Status=completed` 的聚合 content,包含某阶段的完整文本;它可能出现在后续阶段的增量事件之后(异步聚合),客户端应通过跟踪最近一个 `Object=message` 事件的 `Type` 来判定当前 content 归属。'."\n"
                .'> - `: ping` 是 SSE 协议注释行,浏览器 EventSource 和主流 SSE 库会自动忽略。'."\n"
                ."\n"
                .'***url类型文件数据结构示例***:'."\n"
                .'```text'."\n"
                .'{'."\n"
                .'	"Status": "completed",'."\n"
                .'	"Role": "tool",'."\n"
                .'	"Type": "plugin_call_output",'."\n"
                .'	"Content": [{'."\n"
                .'		"Object": "content",'."\n"
                .'		"Type": "data",'."\n"
                .'		"Data": {'."\n"
                .'			"name": "sandbox_send_file_to_user",'."\n"
                .'			"output": "[{\\"type\\": \\"file\\", \\"source\\": {\\"type\\": \\"url\\", \\"url\\": \\"https://jvs-crew-san****k%3D\\"}, \\"filename\\": \\"test_write.txt\\"}, {\\"type\\": \\"text\\", \\"text\\": \\"Sent file: test_write.txt\\"}]",'."\n"
                .'			"call_id": "call_f0***2a661"'."\n"
                .'		}'."\n"
                .'	}],'."\n"
                .'	"SequenceNumber": "106",'."\n"
                .'	"Object": "message",'."\n"
                .'	"Id": "msg_85a*****7de40a2eba"'."\n"
                .'}'."\n"
                .'```'."\n"
                ."\n"
                .'***base64类型文件数据结构示例***:'."\n"
                .'```text'."\n"
                .'{'."\n"
                .'	"Role": "tool",'."\n"
                .'	"Status": "completed",'."\n"
                .'	"Type": "plugin_call_output",'."\n"
                .'	"Content": [{'."\n"
                .'		"Type": "data",'."\n"
                .'		"Object": "content",'."\n"
                .'		"Data": {'."\n"
                .'      "name": "sandbox_send_file_to_user",'."\n"
                .'			"output": "[{\\"type\\": \\"file\\", \\"source\\": {\\"type\\": \\"base64\\", \\"media_type\\": \\"text/markdown\\", \\"data\\": \\"IyDmrKL*****15bm0Kgo=\\"}, \\"filename\\": \\"welcome.md\\"}, {\\"type\\": \\"text\\", \\"text\\": \\"Sent file: welcome.md\\"}]",'."\n"
                .'			"call_id": "call_7*****92b0dc"'."\n"
                .'		}'."\n"
                .'	}],'."\n"
                .'	"SequenceNumber": "121",'."\n"
                .'	"Object": "message",'."\n"
                .'	"Id": "msg_655f******b84e"'."\n"
                .'}'."\n"
                .'```',
            'changeSet' => [],
            'ramActions' => [],
            'responseDemo' => '[{"errorExample":"","example":"{\\n  \\"RequestId\\": \\"EA12****-****-****-****-****E5C\\",\\n  \\"Role\\": \\"user\\",\\n  \\"Status\\": \\"in_progress\\",\\n  \\"Type\\": \\"message / text\\\\n\\",\\n  \\"Content\\": [\\n    {\\n      \\"Object\\": \\"\\\\\\"\\\\\\"\\",\\n      \\"Text\\": \\"您好\\",\\n      \\"Type\\": \\"text\\",\\n      \\"Data\\": {\\n        \\"test\\": \\"test\\",\\n        \\"test2\\": 1\\n      }\\n    }\\n  ],\\n  \\"SequenceNumber\\": \\"1\\",\\n  \\"Object\\": \\"response\\",\\n  \\"Id\\": \\"msg_xxx\\",\\n  \\"Text\\": \\"\\\\\\"hello\\\\\\"\\",\\n  \\"Created\\": \\"1773380609\\",\\n  \\"CreatedAt\\": \\"1773380609\\",\\n  \\"SessionId\\": \\"176405663****961\\",\\n  \\"Success\\": true,\\n  \\"Code\\": \\"200\\",\\n  \\"HttpStatusCode\\": 200,\\n  \\"Message\\": \\"null\\",\\n  \\"TraceId\\": \\"0a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d\\"\\n}","type":"json"}]',
        ],
        'GetAccessToken' => [
            'methods' => ['get', 'post'],
            'schemes' => ['https'],
            'security' => [
                [
                    'AK' => [],
                ],
            ],
            'operationType' => 'readAndWrite',
            'deprecated' => false,
            'systemTags' => ['operationType' => 'get', 'riskType' => 'none', 'chargeType' => 'free'],
            'parameters' => [
                [
                    'name' => 'ExternalUserId',
                    'in' => 'query',
                    'schema' => ['title' => '外部系统用户唯一标识', 'description' => '外部系统用户唯一标识', 'type' => 'string', 'required' => false, 'example' => '"user-38764"'],
                ],
                [
                    'name' => 'TemplateId',
                    'in' => 'query',
                    'schema' => ['title' => 'Agent模板ID。', 'description' => 'Agent模板ID。', 'type' => 'string', 'required' => false, 'example' => '1600112233445566'],
                ],
            ],
            'responses' => [
                200 => [
                    'schema' => [
                        'title' => 'GetAccessToken成功响应',
                        'description' => 'PlainResult<CreateRepositoryItemResponseDTO>',
                        'type' => 'object',
                        'properties' => [
                            'Success' => ['title' => '是否成功', 'description' => '是否成功', 'type' => 'boolean', 'example' => 'true'],
                            'Code' => ['title' => '业务状态码', 'description' => '业务状态码', 'type' => 'string', 'example' => '"200"'],
                            'Message' => ['title' => '错误详情(失败时返回)', 'description' => '错误详情(失败时返回)', 'type' => 'string', 'example' => 'null'],
                            'HttpStatusCode' => ['title' => 'HTTP 状态码', 'description' => 'HTTP 状态码', 'type' => 'integer', 'format' => 'int32', 'example' => '200'],
                            'RequestId' => ['title' => '请求唯一标识(UUID 形态)', 'description' => '请求唯一标识(UUID 形态,首尾保留示意)', 'type' => 'string', 'example' => '"EA12****-****-****-****-****E5C"'],
                            'AccessToken' => ['title' => 'JWT,用于 Chat 的 Query 参数 Authorization;在一段时间内有效', 'description' => 'JWT,用于 Chat 的 Query 参数 Authorization;在一段时间内有效', 'type' => 'string', 'example' => '"eyJhbGc****.eyJ********.****TCk"'],
                            'AccessDeniedDetail' => ['title' => '鉴权失败详情', 'description' => '鉴权失败详情', 'type' => 'string', 'example' => 'null'],
                        ],
                    ],
                ],
            ],
            'staticInfo' => ['returnType' => 'synchronous'],
            'title' => '获取访问令牌',
            'summary' => '获取用户进行对话所需的访问令牌(AccessToken),用于后续调用 Chat 接口进行身份验证。',
            'description' => '**令牌格式**: AccessToken 为 **JWT**,由 **Header.Payload.Signature** 三段经 Base64URL 编码后以 `.` 连接成一行;下表示例为脱敏示意,实际 RequestId、JWT 各段均更长。'."\n"
                ."\n"
                .'**令牌有效期**: AccessToken **在一段时间内有效**,过期后须重新调用本接口获取新令牌。'."\n"
                ."\n"
                .'**认证方式**: POP V1 签名(AK/SK)'."\n"
                ."\n"
                .'**Action**: `GetAccessToken`',
            'requestParamsDescription' => '#### 请求示例'."\n"
                ."\n"
                .'```python'."\n"
                .'params = {'."\n"
                .'    "Format": "JSON",'."\n"
                .'    "Version": "2026-03-11",'."\n"
                .'    "AccessKeyId": ak,'."\n"
                .'    "SignatureMethod": "HMAC-SHA1",'."\n"
                .'    "Timestamp": _now_utc(),'."\n"
                .'    "SignatureVersion": "1.0",'."\n"
                .'    "SignatureNonce": str(uuid.uuid4()),'."\n"
                .'    "Action": "GetAccessToken",'."\n"
                .'    "RegionId": "cn-shanghai",'."\n"
                .'    "ExternalUserId": "user-38764",'."\n"
                .'}'."\n"
                .'params["Signature"] = _sign_v1(params, sk)'."\n"
                .'```',
            'responseParamsDescription' => '#### 响应示例'."\n"
                ."\n"
                .'**成功**:'."\n"
                ."\n"
                .'```json'."\n"
                .'{'."\n"
                .'  "Success": true,'."\n"
                .'  "Code": "200",'."\n"
                .'  "HttpStatusCode": 200,'."\n"
                .'  "RequestId": "EA12****-****-****-****-****E5C",'."\n"
                .'  "AccessToken": "eyJhbGc****.eyJ********.****TCk"'."\n"
                .'}'."\n"
                .'```'."\n"
                ."\n"
                .'**失败**:'."\n"
                ."\n"
                .'```json'."\n"
                .'{'."\n"
                .'  "Success": false,'."\n"
                .'  "Code": "400",'."\n"
                .'  "Message": "Invalid ExternalUserId",'."\n"
                .'  "HttpStatusCode": 400'."\n"
                .'}'."\n"
                .'```',
            'changeSet' => [],
            'ramActions' => [
                [
                    'operationType' => 'get',
                    'ramAction' => [
                        'action' => 'agentbay:GetAccessToken',
                        'authLevel' => 'operate',
                        'actionConditions' => [],
                        'resources' => [
                            ['validationType' => 'always', 'product' => 'WuyingAI', 'resourceType' => '全部资源', 'arn' => '*'],
                        ],
                    ],
                ],
            ],
            'responseDemo' => '[{"errorExample":"","example":"{\\n  \\"Success\\": true,\\n  \\"Code\\": \\"\\\\\\"200\\\\\\"\\",\\n  \\"Message\\": \\"null\\",\\n  \\"HttpStatusCode\\": 200,\\n  \\"RequestId\\": \\"\\\\\\"EA12****-****-****-****-****E5C\\\\\\"\\",\\n  \\"AccessToken\\": \\"\\\\\\"eyJhbGc****.eyJ********.****TCk\\\\\\"\\",\\n  \\"AccessDeniedDetail\\": \\"null\\"\\n}","type":"json"}]',
        ],
    ],
    'endpoints' => [],
    'errorCodes' => [
        ['code' => 'Channels.CredentialConflictError', 'message' => 'Credential is already in use.', 'http_code' => 409, 'description' => '该凭证已被其他配置使用。'],
        ['code' => 'SandboxImages.ImageBusy', 'message' => 'Image is being deployed/removed, please try again later.', 'http_code' => 409, 'description' => '镜像正在部署/删除中,请稍后重试。'],
        ['code' => 'SandboxImages.ImageInUse', 'message' => 'The image is being used by the template. Switch to another image first.', 'http_code' => 409, 'description' => '镜像正在被模板使用,请先切换到其他镜像。'],
        ['code' => 'SandboxImages.ImageNameDuplicate', 'message' => 'The image name already exists. Modify it and try again.', 'http_code' => 409, 'description' => '镜像名称已存在,请修改后重试。'],
        ['code' => 'SandboxImages.InternalError', 'message' => 'Internal service error, please try again later.', 'http_code' => 500, 'description' => '服务内部错误,请稍后重试。'],
        ['code' => 'SandboxImages.InvalidStatus', 'message' => 'The current operation cannot be performed because the mirror status does not match.', 'http_code' => 409, 'description' => '镜像状态不匹配,无法执行当前操作。'],
    ],
    'changeSet' => [],
    'ram' => [
        'productCode' => 'WuyingAI',
        'productName' => '无影云电脑',
        'ramCodes' => ['agentbay', 'ecd'],
        'ramLevel' => '操作级',
        'ramConditions' => [],
        'ramActions' => [
            [
                'apiName' => 'GetAccessToken',
                'description' => '获取访问令牌',
                'operationType' => 'get',
                'ramAction' => [
                    'action' => 'agentbay:GetAccessToken',
                    'authLevel' => 'operate',
                    'actionConditions' => [],
                    'resources' => [
                        ['validationType' => 'always', 'product' => 'WuyingAI', 'resourceType' => '全部资源', 'arn' => '*'],
                    ],
                ],
            ],
        ],
        'resourceTypes' => [],
    ],
];