For the complete documentation index, see llms.txt. This page is also available as Markdown.

附件與檔案

建立新附件 (整合)

POST /api/v1/attachments-upload/

程式碼範例

# 呼叫 API 示例 (Shell)
curl -X POST "https://api.maiagent.ai/api/v1/attachments-upload/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -F "file=@example_file.pdf"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
const axios = require('axios');
const FormData = require('form-data');

// 建立FormData對象
const formData = new FormData();
// 請用實際檔案替換
formData.append('file', /* 實際檔案物件 */, 'example_file.pdf');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    ...formData.getHeaders()
  }
};

axios.post("https://api.maiagent.ai/api/v1/attachments-upload/", formData, config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });

回應內容

狀態碼
說明

200

No response body


取得檔案上傳用的預簽署 URL

POST /api/v1/upload-presigned-url/

參數

參數名稱
必填
類型
說明

fieldName

string

欄位名稱

filename

string

檔案名稱

modelName

string

模型名稱

請求內容

請求參數

欄位
類型
必填
說明

fileSize

integer

請求結構範例

請求範例值

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


Presigned 上傳附件

POST /api/v1/attachments/

請求內容

請求參數

欄位
類型
必填
說明

type

object

filename

string

file

string (uri)

請求結構範例

請求範例值

程式碼範例

回應內容

狀態碼: 201

回應結構範例

回應範例值


建立對話附件

POST /api/v1/conversations/{conversationPk}/attachments/

參數

參數名稱
必填
類型
說明

conversationPk

string

請求內容

請求參數

欄位
類型
必填
說明

type

object

filename

string

file

string (uri)

conversation

string (uuid)

請求結構範例

請求範例值

程式碼範例

回應內容

狀態碼: 201

回應結構範例

回應範例值


取得允許的檔案規格

GET /api/v1/allowed-file-specs/

程式碼範例

回應內容

狀態碼: 200

回應結構範例

回應範例值


Last updated

Was this helpful?