<span id="替换保存的响应文本"></span>

# Replace saved response text

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

Replace modified_response text in a message record.


```http
PUT https://api.moi.matrixorigin.cn/v5/workspaces/{workspace_id}/llm/sessions/{session_id}/messages/{message_id}/modify-response
```

<span id="调用前准备"></span>

## Before you call this API

`BASE_URL` uses the product API prefix `https://api.moi.matrixorigin.cn/v5`. For a dedicated deployment, use its corresponding product API address.

[Configure Workspace identity and variables in the same environment](objects.md#request-prerequisites).

<span id="请求"></span>

## Request

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Request example

```bash
curl --request PUT \
  "$BASE_URL/workspaces/$WORKSPACE_ID/llm/sessions/$SESSION_ID/messages/$MESSAGE_ID/modify-response" \
  --header "X-API-Key: $MOI_KEY" \
  --header "X-Workspace-ID: $WORKSPACE_ID" \
  --header "Content-Type: application/json" \
  --data-raw '{"modified_response":"修改后的文本"}'
```

:::::
:::::{tab-item} Parameters

| Parameter | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `workspace_id` | Path | string | Yes | Target Workspace, matching X-Workspace-ID. |
| `session_id` | Path | integer | Yes | Positive integer ID returned by this service. |
| `message_id` | Path | integer | Yes | Positive integer ID returned by this service. |
| `modified_response` | Body | string | No | Replacement text. Omitted/null/empty string sets it to an empty string. |

The message must belong to the current user and path conversation. Read message details after success to confirm modified_response. This does not change original response or call the model to regenerate.

:::::
::::::
:::::::

<span id="成功响应"></span>

## Successful response

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```http
HTTP/1.1 204 No Content
```

:::::
:::::{tab-item} Fields

HTTP 204 with no body. This operation returns no JSON data object.

:::::
::::::
:::::::

<span id="错误响应"></span>

## Error response

[Error formats and read scope](objects.md#error-contract) explains differing identity, parameter, resource-read, and storage-failure outcomes.
