summaryrefslogtreecommitdiff
path: root/data/en_us/wuyingai/2026-03-11/api-docs.php
blob: f193a49900be76868c4d034fbb1db72fe72b7438 (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
521
522
523
524
525
<?php return [
    'version' => '1.0',
    'info' => ['style' => 'RPC', 'product' => 'WuyingAI', 'version' => '2026-03-11'],
    'directories' => ['Chat', 'GetAccessToken'],
    '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' => '',
                        'description' => 'The message list (JSON string), sorted in chronological order.',
                        'type' => 'array',
                        'items' => [
                            'type' => 'object',
                            'properties' => [
                                'Role' => [
                                    'title' => '',
                                    'description' => 'The message role.',
                                    'enumValueTitles' => ['user / assistant / system / tool' => 'user / assistant / system / tool'],
                                    'type' => 'string',
                                    'example' => 'user',
                                    'required' => false,
                                ],
                                'Content' => [
                                    'title' => '',
                                    'description' => 'The content block list.',
                                    'type' => 'array',
                                    'items' => [
                                        'type' => 'object',
                                        'properties' => [
                                            'Type' => [
                                                'title' => '',
                                                'description' => 'The content type.',
                                                'enumValueTitles' => ['text/file/image' => 'text/file/image'],
                                                'type' => 'string',
                                                'example' => 'text',
                                                'required' => false,
                                            ],
                                            'Text' => ['title' => '', 'description' => 'The text content (Type=text).', 'type' => 'string', 'example' => '帮我分析这张图片', 'required' => false],
                                            'ImageUrl' => ['title' => '', 'description' => 'The image URL or Base64-encoded string (Type=image).', 'type' => 'string', 'example' => 'https://example.com/img.jpg', 'required' => false],
                                            'FileUrl' => ['title' => '', 'description' => 'The file path or URL (Type=file).', 'type' => 'string', 'example' => '/workspace/report.pdf', 'required' => false],
                                            'FileName' => ['type' => 'string', 'example' => 'report.pdf', 'description' => '', 'title' => ''],
                                        ],
                                        'required' => false,
                                        'description' => '',
                                        'title' => '',
                                        'example' => '',
                                    ],
                                    'required' => false,
                                    'example' => '',
                                ],
                            ],
                            'required' => false,
                            'description' => '',
                            'title' => '',
                            'example' => '',
                        ],
                        'required' => false,
                        'example' => '[{"Role":"user","Content":[{"Type":"text","Text":"你好"}]}]',
                    ],
                ],
                [
                    'name' => 'SessionId',
                    'in' => 'formData',
                    'schema' => ['title' => '', 'description' => 'The session ID for multi-turn conversation context persistence.', 'type' => 'string', 'example' => 'test-session-001', 'required' => false],
                ],
                [
                    'name' => 'RoutingKey',
                    'in' => 'formData',
                    'schema' => ['title' => '', 'description' => 'The routing key that specifies the backend instance to process the request.', 'type' => 'string', 'example' => '""', 'required' => false],
                ],
                [
                    'name' => 'Authorization',
                    'in' => 'query',
                    'schema' => ['title' => '', 'description' => 'Bearer + JWT returned by GetAccessToken. URL-encode the entire string and pass it as a query parameter.', 'type' => 'string', 'example' => 'Bearer%20eyJhb****...****k', 'required' => false],
                ],
                [
                    'name' => 'ExternalUserId',
                    'in' => 'formData',
                    'schema' => ['title' => '', 'description' => 'The user ID from the external system.', 'type' => 'string', 'example' => 'test-user', 'required' => false],
                ],
                [
                    'name' => 'TemplateId',
                    'in' => 'query',
                    'schema' => ['title' => '', 'description' => 'The agent template ID.', 'type' => 'string', 'example' => 'template-abc123', 'required' => false],
                ],
                [
                    'name' => 'StreamOptions',
                    'in' => 'formData',
                    'style' => 'json',
                    'schema' => [
                        'title' => '',
                        'description' => 'The streaming output control options. Contains IncludeReasoning (boolean, default true, specifies whether to include the model thinking process) and IncludeToolCalls (boolean, default true, specifies whether to include tool invocation details). If not specified or set to a null object, the behavior is consistent with the legacy version.',
                        'type' => 'object',
                        'properties' => [
                            'IncludeReasoning' => ['title' => '', 'description' => 'Specifies whether to include the model thinking process. When set to false, the SSE stream does not include messages with Type="reasoning" or their content events.', 'type' => 'boolean', 'required' => false, 'example' => 'true'],
                            'IncludeToolCalls' => ['title' => '', 'description' => 'Specifies whether to include tool invocation details. When set to false, the SSE stream does not include messages of type plugin_call, plugin_call_output, mcp_call, or mcp_call_output, or their content events.', 'type' => 'boolean', 'required' => false, 'example' => 'true'],
                        ],
                        'required' => false,
                        'example' => '{"IncludeReasoning": false, "IncludeToolCalls": false}',
                    ],
                ],
                [
                    'name' => 'Settings',
                    'in' => 'formData',
                    'style' => 'json',
                    'schema' => [
                        'title' => '',
                        'description' => 'The additional settings. Contains the output file mode control parameter OutputFileMode (string, valid values: url or base64. Defaults to base64 for legacy compatibility. We recommend url).',
                        'type' => 'object',
                        'properties' => [
                            'OutputFileMode' => ['title' => '', 'description' => 'Controls the file output mode. Valid values: url or base64. If this parameter is not specified, base64 is used by default for legacy compatibility.', 'type' => 'string', 'example' => 'base64', 'required' => false],
                        ],
                        'required' => false,
                        'example' => '{"OutputFileMode": "url"}',
                    ],
                ],
                [
                    'name' => 'Model',
                    'in' => 'formData',
                    'schema' => ['type' => 'string', 'description' => '', 'title' => '', 'example' => ''],
                ],
                [
                    'name' => 'Resume',
                    'in' => 'formData',
                    'schema' => ['type' => 'boolean', 'description' => '', 'title' => '', 'example' => ''],
                ],
            ],
            'responses' => [
                200 => [
                    'schema' => [
                        'type' => 'object',
                        'properties' => [
                            'RequestId' => ['title' => '', 'description' => 'The request ID.', 'type' => 'string', 'example' => 'EA12****-****-****-****-****E5C'],
                            'Role' => ['title' => '', 'description' => 'The role (user / assistant / system / tool).', 'type' => 'string', 'example' => 'user'],
                            'Status' => ['title' => '', 'description' => 'The reply status (created / in_progress / completed).', 'type' => 'string', 'example' => 'in_progress'],
                            'Type' => ['title' => '', 'description' => 'The message type (reasoning (model thinking process) / message (formal reply)).', 'type' => 'string', 'example' => 'message / text'."\n"],
                            'Content' => [
                                'title' => '',
                                'description' => 'The content block list (included only when Status is completed).',
                                'type' => 'array',
                                'items' => [
                                    'type' => 'object',
                                    'properties' => [
                                        'Object' => ['title' => '', 'description' => 'The object type.', 'type' => 'string', 'example' => '""'],
                                        'Text' => ['title' => '', 'description' => 'The text content.', 'type' => 'string', 'example' => '您好'],
                                        'Type' => ['title' => '', 'description' => 'The content type ("text" / "data").', 'type' => 'string', 'example' => 'text'],
                                        'Data' => ['title' => '', 'description' => 'The structured data (such as tool invocation). Example: {"call_id":"call_xxx","name":"get_weather", "output":"Tool output details in text format"}.', 'type' => 'object', 'example' => '{"call_id":"call_xxx","name":"get_weather","arguments":"{"city":"Beijing"}"}'],
                                    ],
                                    'description' => '',
                                    'title' => '',
                                    'example' => '',
                                ],
                                'example' => '',
                            ],
                            'SequenceNumber' => ['title' => '', 'description' => 'The event sequence number (an incrementing integer in string format, used to guarantee ordering). Note: When StreamOptions filters out certain event types, the filtered events still consume sequence numbers. Therefore, the sequence numbers received by the client may not be contiguous.', 'type' => 'string', 'example' => '1'],
                            'Object' => [
                                'title' => '',
                                'description' => 'The event object type.',
                                'enumValueTitles' => ['response / message / content' => 'response / message / content'],
                                'type' => 'string',
                                'example' => 'response',
                            ],
                            'Id' => ['title' => '', 'description' => 'The unique message identifier.', 'type' => 'string', 'example' => 'msg_xxx'],
                            'Text' => ['title' => '', 'description' => 'The incremental text content (included in Object=content events).'."\n"
                                .'[_single.resp.200.props.Created.desc](Deprecated) The creation timestamp.', 'type' => 'string', 'example' => '"hello"'],
                            'Created' => ['description' => '(已废弃)创建时间戳', 'type' => 'string', 'example' => '1773380609', 'title' => ''],
                            'CreatedAt' => ['title' => '', 'description' => 'The creation timestamp (Unix seconds).', 'type' => 'string', 'example' => '1773380609'],
                            'SessionId' => ['title' => '', 'description' => 'The session ID.', 'type' => 'string', 'example' => '176405663****961'],
                            'Success' => ['title' => '', 'description' => 'Indicates whether the request is successful.', 'type' => 'boolean', 'example' => 'true'],
                            'Code' => ['title' => '', 'description' => 'The business status code.', 'type' => 'string', 'example' => '200'],
                            'HttpStatusCode' => ['title' => '', 'description' => 'The HTTP status code.', 'type' => 'integer', 'format' => 'int32', 'example' => '200'],
                            'Message' => ['title' => '', 'description' => 'The error details (returned on failure).', 'type' => 'string', 'example' => 'null'],
                            'TraceId' => ['type' => 'string', 'example' => '0a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d', 'description' => '', 'title' => ''],
                        ],
                        'description' => '',
                        'title' => '',
                        'example' => '',
                    ],
                ],
            ],
            'staticInfo' => ['returnType' => 'synchronous'],
            'title' => 'Streaming conversation',
            'summary' => 'Conducts a streaming conversation with JVS Crew, using the Server-Sent Events (SSE) protocol to push conversation content in real time.',
            'description' => '**Features**'."\n"
                ."\n"
                .'- Real-time streaming response that reduces time to first token.'."\n"
                .'- Supports multimodal input (text, images, and files).'."\n"
                .'- Session persistence for multi-turn conversations.'."\n"
                .'- Event-driven architecture for precise message status control.'."\n"
                ."\n"
                .'**Request information**'."\n"
                ."\n"
                .'- **Request method**: `POST`'."\n"
                .'- **Content-Type**: `application/json`'."\n"
                .'- **Response Content-Type**: `text/event-stream`.',
            'requestParamsDescription' => '##### StreamOptions structure'."\n"
                ."\n"
                .'`StreamOptions` is an optional streaming output control parameter used to streamline the events returned in the SSE stream.'."\n"
                ."\n"
                .'**Recommendation**: For consumer-facing scenarios, set `"IncludeReasoning": false, "IncludeToolCalls": false` to significantly simplify client-side parsing logic.'."\n"
                ."\n"
                .'**Notes**:'."\n"
                .'- If `StreamOptions` is not specified or set to a null object `{}`, the default behavior is fully consistent with the legacy version.'."\n"
                .'- Filtering affects only the SSE output. It does not affect the model inference process or the actual execution of tool invocations.'."\n"
                .'- After filtering, `SequenceNumber` values may not be contiguous, but the order is correct.'."\n"
                ."\n"
                .'##### Settings structure'."\n"
                ."\n"
                .'**Recommendation**: When `base64` is used, file-type data structures from tool output are returned in Base64 format. However, large Base64 payloads can affect SSE transmission stability, so this is not recommended. When `url` is used, a temporary downloadable URL is returned.'."\n"
                ."\n"
                .'**Notes**:'."\n"
                .'- If `Settings` is not specified or set to a null object `{}`, the default behavior is to use `base64`.'."\n"
                .'- The default mode is planned to switch to `url` in the future. Use `url` mode when integrating.'."\n"
                ."\n"
                .'##### Input structure'."\n"
                ."\n"
                .'The `Input` parameter is a **JSON string** (not an object array) that contains a Message array. Serialize it to a string before passing it.'."\n"
                ."\n"
                .'#### Request example'."\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"
                .'**Notes**:'."\n"
                ."\n"
                .'*   The `-N` parameter disables buffering to receive the SSE stream in real time.'."\n"
                ."\n"
                .'*   Set `x-acs-date` to the current UTC time in ISO 8601 format.'."\n"
                ."\n"
                .'*   `Input` is a JSON string. Escape the quotation marks.'."\n"
                ."\n"
                .'*   Replace `<access_token>` with the actual access token. If the token has expired (401 error), call GetAccessToken again to obtain a new one.',
            'responseParamsDescription' => '#### Response event fields'."\n"
                ."\n"
                .'The `Object=response` event is the lifecycle wrapper for the entire reply, marking the start and end of the reply.'."\n"
                ."\n"
                .'#### Message event fields'."\n"
                ."\n"
                .'The `Object=message` event represents a specific message. The `Type` field distinguishes the message type.'."\n"
                ."\n"
                .'#### Event types'."\n"
                ."\n"
                .'| Event type | Object | Description | Trigger |'."\n"
                .'| --- | --- | --- | --- |'."\n"
                .'| Reply created | `response` | Status=`created`. The lifecycle of the entire reply begins. | SSE stream starts |'."\n"
                .'| Reply in progress | `response` | Status=`in_progress` | Content generation starts |'."\n"
                .'| Reasoning started | `message` | Type=`reasoning`, Status=`in_progress` | Model starts reasoning |'."\n"
                .'| Reasoning content increment | `content` | Text fragment from the reasoning phase (Status=`in_progress`) | Each time a reasoning text segment is generated |'."\n"
                .'| Reasoning completed | `message` | Type=`reasoning`, Status=`completed` | Reasoning ends |'."\n"
                .'| Message started | `message` | Type=`message`, Status=`in_progress` | Formal reply generation starts |'."\n"
                .'| Message content increment | `content` | Text fragment of the formal reply (Status=`in_progress`) | Each time a reply text segment is generated |'."\n"
                .'| Message content completed | `content` | Aggregated full text (Status=`completed`) | Formal reply text generation is complete |'."\n"
                .'| Message completed | `message` | Type=`message`, Status=`completed` | Formal reply ends |'."\n"
                .'| Reply completed | `response` | Status=`completed` | SSE stream ends |'."\n"
                .'| Error | `error` | Error message | When an error occurs |'."\n"
                .'| Heartbeat | `:ping` (comment line) | Keeps the connection alive. The client can ignore this. | Every few seconds during idle periods |'."\n"
                ."\n"
                .'> **Note**: The content from the reasoning phase (`reasoning`) represents the model\'s internal reasoning process and should not be displayed to end users. The client should check the `Type` of the current message to determine whether to display the corresponding content.'."\n"
                ."\n"
                .'#### SSE response example'."\n"
                ."\n"
                .'**Complete flow**:'."\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"
                .'> **Tips**:'."\n"
                .'> - The content events at `SequenceNumber=3~4` belong to the `reasoning` (thinking) phase, and the content events at `SequenceNumber=6~7` belong to the `message` (formal reply) phase. The client should display only the content from the `message` phase.'."\n"
                .'> - `SequenceNumber=8` is an aggregated content event with `Status=completed` that contains the full text of a phase. It may appear after incremental events of a subsequent phase (asynchronous aggregation). The client should track the `Type` of the most recent `Object=message` event to determine which phase the current content belongs to.'."\n"
                .'> - `: ping` is an SSE protocol comment line. Browser EventSource and mainstream SSE libraries automatically ignore it.'."\n"
                ."\n"
                .'***URL-type file data structure example***:'."\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-type file data structure example***:'."\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' => 'The unique identifier of the user in the external system.', 'type' => 'string', 'example' => '"user-38764"', 'required' => false],
                ],
                [
                    'name' => 'TemplateId',
                    'in' => 'query',
                    'schema' => ['title' => '', 'description' => 'The ID of the agent template.', 'type' => 'string', 'required' => false, 'example' => '1600112233445566'],
                ],
            ],
            'responses' => [
                200 => [
                    'schema' => [
                        'title' => '',
                        'description' => 'PlainResult<CreateRepositoryItemResponseDTO>',
                        'type' => 'object',
                        'properties' => [
                            'Success' => ['title' => '', 'description' => 'Indicates whether the request was successful.', 'type' => 'boolean', 'example' => 'true'],
                            'Code' => ['title' => '', 'description' => 'The business status code.', 'type' => 'string', 'example' => '"200"'],
                            'Message' => ['title' => '', 'description' => 'The error details. This parameter is returned only when the request fails.', 'type' => 'string', 'example' => 'null'],
                            'HttpStatusCode' => ['title' => '', 'description' => 'The HTTP status code.', 'type' => 'integer', 'format' => 'int32', 'example' => '200'],
                            'RequestId' => ['title' => '', 'description' => 'The request ID, in UUID format. The first and last characters are retained for illustration purposes.', 'type' => 'string', 'example' => '"EA12****-****-****-****-****E5C"'],
                            'AccessToken' => ['title' => '', 'description' => 'The JWT used as the Authorization query parameter for the Chat operation. The token is valid for a limited period of time.', 'type' => 'string', 'example' => '"eyJhbGc****.eyJ********.****TCk"'],
                            'AccessDeniedDetail' => ['title' => '', 'description' => 'The details of the authentication failure.', 'type' => 'string', 'example' => 'null'],
                        ],
                        'example' => '',
                    ],
                ],
            ],
            'staticInfo' => ['returnType' => 'synchronous'],
            'title' => 'Obtain an access token',
            'summary' => 'Obtains an access token (AccessToken) for user conversations, which is used to authenticate when invoking the Chat operation.',
            'description' => '**Token format**: The AccessToken is a **JWT** consisting of **Header.Payload.Signature** segments, each Base64URL-encoded and concatenated with `.` into a single line. The examples in the following table are masked for illustration purposes. The actual RequestId and JWT segments are longer.'."\n"
                ."\n"
                .'**Token validity**: The AccessToken **is valid for a limited period of time**. After it expires, call this operation again to obtain a new token.'."\n"
                ."\n"
                .'**Authentication method**: POP V1 signature (AK/SK)'."\n"
                ."\n"
                .'**Action**: `GetAccessToken`.',
            'requestParamsDescription' => '#### Request example'."\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": "ap-southeast-1",'."\n"
                .'    "ExternalUserId": "user-38764",'."\n"
                .'}'."\n"
                .'params["Signature"] = _sign_v1(params, sk)'."\n"
                .'```.',
            'responseParamsDescription' => '#### Response example'."\n"
                ."\n"
                .'**Success**:'."\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"
                .'**Failure**:'."\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' => 'All Resource', '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' => 'The credential is already in use by another configuration.'],
        ['code' => 'SandboxImages.ImageBusy', 'message' => 'Image is being deployed/removed, please try again later.', 'http_code' => 409, 'description' => 'Image is being deployed/removed, please try again later.'],
        ['code' => 'SandboxImages.ImageInUse', 'message' => 'The image is being used by the template. Switch to another image first.', 'http_code' => 409, 'description' => 'The image is being used by the template. Switch to another image first.'],
        ['code' => 'SandboxImages.ImageNameDuplicate', 'message' => 'The image name already exists. Modify it and try again.', 'http_code' => 409, 'description' => 'The image name already exists. Modify it and try again.'],
        ['code' => 'SandboxImages.InternalError', 'message' => 'Internal service error, please try again later.', 'http_code' => 500, 'description' => 'Internal service error, please try again later.'],
        ['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' => 'Elastic Desktop Service',
        'ramCodes' => ['agentbay', 'ecd'],
        'ramLevel' => 'OPERATION',
        'ramConditions' => [],
        'ramActions' => [
            [
                'apiName' => 'GetAccessToken',
                'description' => '',
                'operationType' => 'get',
                'ramAction' => [
                    'action' => 'agentbay:GetAccessToken',
                    'authLevel' => 'operate',
                    'actionConditions' => [],
                    'resources' => [
                        ['validationType' => 'always', 'product' => 'WuyingAI', 'resourceType' => 'All Resource', 'arn' => '*'],
                    ],
                ],
            ],
        ],
        'resourceTypes' => [],
    ],
];