会話メッセージ詳細の取得
会話メッセージ詳細の取得
リクエストで指定した conversation_id に紐づく会話内の全メッセージ詳細を取得します。message_id、ユーザー質問、メッセージタイプ、メッセージ内容、生成時刻などが含まれます。
リクエストメソッド
GET
エンドポイント
https://api-${endpoint}.gptbots.ai/v2/messages
認証
認証方法については API 概要 をご参照ください。
リクエスト
リクエスト例
curl -X GET 'https://api-${endpoint}.gptbots.ai/v2/messages?conversation_id=xxxxxx&page=1&page_size=100' \
-H 'Authorization: Bearer ${API Key}'
curl -X GET 'https://api-${endpoint}.gptbots.ai/v2/messages?conversation_id=xxxxxx&page=1&page_size=100' \
-H 'Authorization: Bearer ${API Key}'
このコードブロックをポップアップで表示
リクエストパラメータ
| フィールド | 型 | 必須 | 説明 |
|---|---|---|---|
| conversation_id | string | はい | 会話識別子。 |
| page | int | はい | ページ数、リクエストしたいデータのページを示します。 |
| page_size | int | はい | 1ページあたりのデータ量、1ページに返してほしいデータの数を示します。最大100件。 |
レスポンス
レスポンス例
{
"total": 2,
"conversation_content": [
{
"message_id": "645dd86906931c4a9e0ffb1f",
"parent_message_id": "545dd86906931c4a9e0ffb1f",
"create_time": 1683871849906,
"feedback": "POSITIVE",
"role": "user",
"content": [
{
"branch_content": [
{
"type": "text",
"text": "I have uploaded 2 image files, please OCR and return 2 json records."
},
{
"type": "image",
"image": [
{
"url": "https://gptbots.ai/example.png",
"format": "jpeg",
"name": "TAXI1",
"size": 1024
},
{
"url": "https://gptbots.ai/example.png",
"format": "png",
"name": "TAXI2",
"size": 1024
}
]
},
{
"type": "audio",
"audio": [
{
"url": "https://gptbots.ai/example.mp3",
"format": "mp3",
"name": "example1 audio",
"size": 1024
}
]
},
{
"type": "document",
"document": [
{
"url": "https://gptbots.ai/example.pdf",
"format": "pdf",
"name": "example pdf",
"size": 1024
}
]
}
]
}
]
},
{
"message_id": "745dd86906931c4a9e0ffb1f",
"parent_message_id": "645dd86906931c4a9e0ffb1f",
"create_time": 1683871849906,
"feedback": "POSITIVE",
"role": "assistant",
"content": [
{
"from_component_branch": "1",
"branch_content": [
{
"type": "text",
"text": "Hi, is there anything I can help you?",
},
{
"type": "audio",
"audio": [
{
"url": "http://gptbots.ai/example.mp3",
"transcript": "音声から書き起こされたテキスト"
}
]
},
]
},
{
"from_component_branch": "2",
"branch_content": [
{
"type": "document",
"document": [
{
"url": "https://gptbots.ai/example.pdf",
"format": "pdf",
"name": "example pdf"
}
]
},
{
"type": "image",
"image": [
{
"url": "https://gptbots.ai/example.png",
"format": "png",
"name": "TAXI2"
}
]
}
]
}
]
}
]
}
{
"total": 2,
"conversation_content": [
{
"message_id": "645dd86906931c4a9e0ffb1f",
"parent_message_id": "545dd86906931c4a9e0ffb1f",
"create_time": 1683871849906,
"feedback": "POSITIVE",
"role": "user",
"content": [
{
"branch_content": [
{
"type": "text",
"text": "I have uploaded 2 image files, please OCR and return 2 json records."
},
{
"type": "image",
"image": [
{
"url": "https://gptbots.ai/example.png",
"format": "jpeg",
"name": "TAXI1",
"size": 1024
},
{
"url": "https://gptbots.ai/example.png",
"format": "png",
"name": "TAXI2",
"size": 1024
}
]
},
{
"type": "audio",
"audio": [
{
"url": "https://gptbots.ai/example.mp3",
"format": "mp3",
"name": "example1 audio",
"size": 1024
}
]
},
{
"type": "document",
"document": [
{
"url": "https://gptbots.ai/example.pdf",
"format": "pdf",
"name": "example pdf",
"size": 1024
}
]
}
]
}
]
},
{
"message_id": "745dd86906931c4a9e0ffb1f",
"parent_message_id": "645dd86906931c4a9e0ffb1f",
"create_time": 1683871849906,
"feedback": "POSITIVE",
"role": "assistant",
"content": [
{
"from_component_branch": "1",
"branch_content": [
{
"type": "text",
"text": "Hi, is there anything I can help you?",
},
{
"type": "audio",
"audio": [
{
"url": "http://gptbots.ai/example.mp3",
"transcript": "音声から書き起こされたテキスト"
}
]
},
]
},
{
"from_component_branch": "2",
"branch_content": [
{
"type": "document",
"document": [
{
"url": "https://gptbots.ai/example.pdf",
"format": "pdf",
"name": "example pdf"
}
]
},
{
"type": "image",
"image": [
{
"url": "https://gptbots.ai/example.png",
"format": "png",
"name": "TAXI2"
}
]
}
]
}
]
}
]
}
このコードブロックをポップアップで表示
成功時のレスポンス
| フィールド | 型 | 説明 |
|---|---|---|
| total | string | この会話内のメッセージ総数。 |
| conversation_content | JSON Array | メッセージの詳細情報。 |
| message_id | string | メッセージの一意なID。 |
| parent_message_id | string | このメッセージの親メッセージID。 |
| create_time | long | このメッセージが生成されたタイムスタンプ。 |
| feedback | string | このメッセージに対するユーザーのフィードバック、値:POSITIVE、NEGATIVE。フィードバックがない場合、このフィールドは返されません。 |
| role | string | メッセージの役割(user または assistant)。 |
| content | JSON Array | メッセージの内容。 |
| from_component_branch | string | メッセージの発信元コンポーネントのブランチID。ユーザー送信や通常のエージェントの場合は空欄。 |
| branch_content | JSON Array | メッセージのブランチ内容。 |
| type | string | メッセージ内容のタイプ(text、image、audio、document、video、file)。 |
| text | string | テキストメッセージの内容。 |
| image | JSON Array | 画像メッセージの内容。 |
| audio | JSON Array | 音声メッセージの内容。 |
| document | JSON Array | ドキュメントメッセージの内容。 |
| video | JSON Array | 動画メッセージの内容。 |
| file | JSON Array | ファイルメッセージの内容。 |
失敗時のレスポンス
| フィールド | 型 | 説明 |
|---|---|---|
| code | int | エラーコード。 |
| message | string | エラー詳細。 |
エラーコード
| コード | メッセージ |
|---|---|
| 40000 | パラメータエラー |
| 40005 | ページングパラメータが実際の件数を超えています |
| 40127 | 開発者認証に失敗しました |
| 40356 | 会話が存在しません |
| 20059 | エージェントが削除されています |
