Tradução de apoio para consulta. Código e identificadores técnicos preservados. Consultar referência original ↗
Atualizar conversa
OpenAPI
openapi: 3.1.0
info:
title: QwenCloud Conversations API
description: Auto-managed chat history for multi-turn context across devices and sessions.
version: 1.0.0
servers:
- url: https://maas.qwencloudapi.com/compatible-mode/v1
description: Singapore
security:
- BearerAuth: []
paths:
/conversations/{conversation_id}:
post:
operationId: updateConversation
summary: Update conversation
description: Update a conversation's metadata. This completely replaces existing metadata.
parameters:
- name: conversation_id
in: path
required: true
description: The conversation ID.
schema:
type: string
example: conv_xxx
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/UpdateConversationRequest"
responses:
"200":
description: Conversation updated successfully
content:
application/json:
schema:
$ref: "#/components/schemas/ConversationObject"
example:
created_at: 1771318152759
id: conv_xxx
metadata:
topic: update
object: conversation
x-codeSamples:
- lang: python
label: Python
source: |-
import os
from openai import OpenAI
client = OpenAI(
api_key=os.getenv("DASHSCOPE_API_KEY"),
base_url="https://maas.qwencloudapi.com/compatible-mode/v1",
)
updated = client.conversations.update(
"conv_xxx",
metadata={"topic": "update"}
)
print(updated)
- lang: javascript
label: Node.js
source: |-
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.DASHSCOPE_API_KEY,
baseURL: "https://maas.qwencloudapi.com/compatible-mode/v1",
});
const updated = await client.conversations.update(
"conv_xxx",
{ metadata: { topic: "update" } }
);
console.log(updated);
- lang: curl
label: cURL
source: |-
curl -X POST "https://maas.qwencloudapi.com/compatible-mode/v1/conversations/conv_xxx" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-d '{
"metadata": {
"topic": "update"
}
}'
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
description: QwenCloud API Key. Create one in the [console](https://home.qwencloud.com/api-keys).
schemas:
MessageItemInput:
type: object
required:
- type
- role
- content
properties:
type:
type: string
enum:
- message
description: Only `message` is supported.
role:
type: string
enum:
- user
- assistant
- system
- developer
description: Message role. `system` and `developer` roles have higher priority than `user`. `assistant` indicates model-generated messages from previous interactions.
content:
description: Message content as a plain text string or a structured content list (such as ResponseInputText object array).
oneOf:
- type: string
- type: array
items:
$ref: "#/components/schemas/ContentPart"
ContentPart:
type: object
properties:
type:
type: string
description: Content type, such as `input_text` (user input) or `output_text` (model output).
example: input_text
text:
type: string
description: The text value.
CreateConversationRequest:
type: object
properties:
items:
type: array
description: Up to 20 initial message items.
maxItems: 20
items:
$ref: "#/components/schemas/MessageItemInput"
metadata:
type: object
description: "Conversation metadata. Up to 16 key-value pairs (keys: max 64 chars, values: max 512 chars)."
additionalProperties:
type: string
UpdateConversationRequest:
type: object
required:
- metadata
properties:
metadata:
type: object
description: "Conversation metadata. **Completely overwrites existing metadata.** Up to 16 key-value pairs (keys: max 64 chars, values: max 512 chars)."
additionalProperties:
type: string
CreateItemsRequest:
type: object
required:
- items
properties:
items:
type: array
description: Message items to add (up to 20 per request).
maxItems: 20
items:
$ref: "#/components/schemas/MessageItemInput"
ConversationObject:
type: object
properties:
created_at:
type: integer
description: Unix timestamp (milliseconds) when the conversation was created.
example: 1771316949128
id:
type: string
description: The conversation ID.
example: conv_xxx
metadata:
type: object
description: "Metadata key-value pairs. Up to 16 pairs (keys: max 64 chars, values: max 512 chars)."
additionalProperties:
type: string
object:
type: string
enum:
- conversation
description: Always `conversation`.
DeleteConversationResponse:
type: object
properties:
deleted:
type: boolean
description: Whether the deletion succeeded.
id:
type: string
description: The deleted conversation's ID.
example: conv_xxx
object:
type: string
enum:
- conversation.deleted
description: Always `conversation.deleted`.
MessageItem:
type: object
properties:
id:
type: string
description: The message item ID.
example: msg_xxx
content:
description: Message content. A plain text string or a structured content list (such as ResponseInputText object array).
oneOf:
- type: string
- type: array
items:
$ref: "#/components/schemas/ContentPart"
role:
type: string
enum:
- user
- assistant
- system
- developer
description: "Message role: `user`, `assistant`, `system`, or `developer`."
status:
type: string
enum:
- in_progress
- completed
- incomplete
description: "Processing status: `in_progress`, `completed`, or `incomplete`."
type:
type: string
enum:
- message
description: Always `message`.
ItemListResponse:
type: object
properties:
data:
type: array
description: Created message items.
items:
$ref: "#/components/schemas/MessageItem"
first_id:
type: string
description: ID of the first message item.
has_more:
type: boolean
description: Whether more data is available.
last_id:
type: string
description: ID of the last message item.
ItemListWithObjectResponse:
type: object
properties:
data:
type: array
description: Message items.
items:
$ref: "#/components/schemas/MessageItem"
first_id:
type: string
description: ID of the first message item.
has_more:
type: boolean
description: Whether more data is available.
last_id:
type: string
description: ID of the last message item.
object:
type: string
enum:
- list
description: Always `list`.
DeleteItemResponse:
type: object
properties:
deleted:
type: boolean
description: Whether the deletion succeeded.
id:
type: string
description: The deleted message item's ID.
example: msg_xxx
object:
type: string
enum:
- conversation.item.deleted
description: Always `conversation.item.deleted`.