全部產品
Search
文件中心

Database Autonomy Service:Chat

更新時間:Sep 15, 2026

DAS大型模型能力非同步邏輯介面。

介面說明

前提條件:

  • 使用阿里雲或 DAS 的 SDK 時,建議使用最新版本。

  • 在使用 SDK 呼叫 DAS 服務時,需要將地域指定為 cn-shanghai。

  • 僅開通了 DAS 企業版的資料庫執行個體支援建立離線任務。DAS 企業版各個版本支援的資料庫和地域請參見 DAS 產品系列及支援的功能。

更多使用 Chat 介面與 DAS Agent 進行互動的方法和範例,請參考 DAS Agent 互動最佳實務(整合 Chat API)。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

hdm:Chat

get

*全部資源。

*

無 無

請求文法

POST /chat HTTP/1.1

請求參數

名稱

類型

必填

描述

樣本值

Message

string

是

訊息。

{"id":"68fe0321-37fe-4c75-a118-b61b33156f6a","role":"user","content":[{"type":"text","text":"hello"}]}

SessionId

string

否

可選,對話 ID,格式為 UUID 字串。如未指定預設建立新的對話。上下文對話需保持同一個對話 ID。

123e4567-e89b-12d3-a456-xxxxxxxxxxxx

AgentId

string

否

可選,用於服務的 Agent ID。可指定為開啟 DAS Agent 後產生的 Agent 或主動建立的 Agent。如未指定則使用預設 Agent 進行服務。

ag-472T0DxtmjIxxxxx

Summary

string

否

是否輸出摘要資訊。

false

否

使用者互動回饋。

[{"metadata":{"a2uiClientDataModel":{"decided":true,"interaction":{"request":{"allowFreeText":true,"question":"question?","options":[{"label":"162 個","value":"162"},{"label":"242 個","value":"242"},{"label":"243 個","value":"243"},{"label":"486 個","value":"486"}]},"kind":"choice","interruptId":"5857955e-4856-4ab3-969e-f8b4c484bda4","status":"pending"},"free_text":""},"a2uiAction":{"name":"das_interaction_response","context":{"value":"162"},"surfaceId":"render-choice-7c03eb4f927f42ff8c30b30a2cc0797d","sourceComponentId":"opts-0","timestamp":"2026-09-15T06:54:15.556Z"}},"payload":{"value":"162"},"interruptId":"5857955e-4856-4ab3-969e-f8b4c484bda4","status":"resolved"}]

返回參數

名稱

類型

描述

樣本值

object

Schema of Response

ActivityType

string

心跳。

waiting_for_agent_thinking

AgentId

string

Agent ID。

agent-7f9c2a81

Content

string

回答內容。

I see you have several PolarDB instances, and I will query them for you shortly

Delta

string

是否增量內容。

hello

Kind

string

STEP_STARTED 的步驟類型,例如 task。

task

Label

string

STEP_STARTED 的子 Agent 顯示名稱。

SQL 效能診斷

MessageId

string

訊息 ID。

61820b594664275c4429****

Name

string

擴充 Key。

summary

OriginatingToolCallId

string

呼叫工具的原始 ID。

ag-xxxx

ParentAgentId

string

父層 Agent ID。

agent-3a6f1c92

ParentMessageId

string

父訊息 ID。

76bee207-31ee-4707-8851-6b9d4da033aa

Role

string

對話角色 ID。

assistant

RunId

string

執行 ID。

ed7cb7b1-ddc8-45d7-9ff3-b315726cb5f7

StepName

string

執行步驟名稱。

sub_agent_performance_diagnose_mysql

StepStatus

string

STEP_FINISHED 的步驟狀態,例如 completed。

completed

TaskTrackerId

string

回呼工具類別。

das_api

ThreadId

string

執行緒 ID。

8e481be1-21d5-4a92-a2fb-fb54be0ab4f6

Timestamp

integer

事件時間戳記。

1767225600000

ToolCallError

string

工具呼叫時發生的錯誤。

error

ToolCallId

string

工具呼叫 ID。

call_edf9cdb69e0e4c9796a6a5a6

ToolCallName

string

工具名稱。

das_api

Type

string

事件類型。

TEXT_MESSAGE_CONTENT

Value

any

擴充 Value。

{"CharCount":393,"End":1777428785996,"RequestId":"BE59AED5-D831-5811-BBAD-590B917B2089","SessionId":"123e4567-e89b-12d3-a456-xxxxxxxxxxxx","Start":1777428707927}

樣本

正常返回樣本

JSON格式

{
  "ActivityType": "waiting_for_agent_thinking",
  "AgentId": "agent-7f9c2a81",
  "Content": "I see you have several PolarDB instances, and I will query them for you shortly",
  "Delta": "hello",
  "Kind": "task",
  "Label": "SQL性能诊断",
  "MessageId": "61820b594664275c4429****",
  "Name": "summary",
  "OriginatingToolCallId": "ag-xxxx",
  "ParentAgentId": " agent-3a6f1c92",
  "ParentMessageId": "76bee207-31ee-4707-8851-6b9d4da033aa",
  "Role": "assistant",
  "RunId": "ed7cb7b1-ddc8-45d7-9ff3-b315726cb5f7",
  "StepName": "sub_agent_performance_diagnose_mysql",
  "StepStatus": "completed",
  "TaskTrackerId": "das_api",
  "ThreadId": "8e481be1-21d5-4a92-a2fb-fb54be0ab4f6",
  "Timestamp": 1767225600000,
  "ToolCallError": "error",
  "ToolCallId": "call_edf9cdb69e0e4c9796a6a5a6",
  "ToolCallName": "das_api",
  "Type": "TEXT_MESSAGE_CONTENT",
  "Value": "{\"CharCount\":393,\"End\":1777428785996,\"RequestId\":\"BE59AED5-D831-5811-BBAD-590B917B2089\",\"SessionId\":\"123e4567-e89b-12d3-a456-xxxxxxxxxxxx\",\"Start\":1777428707927}"
}

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 InvalidParams The request parameters are invalid. 請求參數錯誤。
500 Timeout The request processing has failed due to timeout. 由於逾時請求處理失敗。
403 NoPermission You are not authorized to do this action. 沒有權限執行該操作。
404 InstanceNotFound Requested instance not found. 對應執行個體 ID 無法找到。

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情。