全部產品
Search
文件中心

AI Coding Assistant Lingma:添加資源到 Session

更新時間:Jul 02, 2026

此功能為 M3 門控特性,需要先通過 Files API 上傳檔案擷取 file_id

要求標頭

頭部

必選

說明

Authorization

Bearer

Content-Type

application/json

路徑參數

參數

類型

必選

說明

session_id

string

Session ID(sess_ 首碼)

請求體

欄位

類型

必選

說明

resources

array

資來源物件數組

resources[].type

string

取值 "file""github_repository"

resources[].file_id

string

檔案 ID(通過 Files API 上傳後獲得)

樣本請求

curl -X POST "https://api.qoder.com.cn/api/v1/cloud/sessions/sess_019e392c0d1e74e095d21ea4c6b41def/resources" \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Content-Type: application/json" \
  -d '{
    "resources": [
      {"type": "file", "file_id": "file_abc123def456"}
    ]
  }'

樣本響應

HTTP 200 OK

返回更新後的 Session 對象(含新的 resources 列表)。

錯誤碼

HTTP

type

觸發條件

400

invalid_request_error

請求格式錯誤(如 type 不為 "file""github_repository",或缺少 file_id

401

authentication_error

PAT 無效或到期

404

not_found_error

Session 或檔案不存在

錯誤響應樣本:

{
  "type": "error",
  "error": {
    "type": "invalid_request_error",
    "message": "resources[0]: field 'type' must be one of 'file', 'github_repository'."
  }
}
{
  "type": "error",
  "error": {
    "type": "not_found_error",
    "message": "File 'file_fake_test_id' was not found."
  }
}

完整錯誤信封說明詳見 錯誤參考