创建 AI 助手消息

Changed on

针对指定的 domain,从 AI 助手生成一条回复消息。适用于 AI SDK v5 及更高版本。

使用 assistant API 密钥进行身份验证。

post/v2/assistant/{domain}/message

Request

  • Base URL
    https://api.mintlify.com/discovery
  • Auth
    HTTP bearer

Path parameters

domainstring required

来自你的 domain.mintlify.site URL 中的 domain 标识符。你可以在控制台 URL 的末尾找到它。例如,在 dashboard.mintlify.com/organization/domain 中,domain 标识符是 domain。

Request body

fpstring required

用于跟踪会话的指纹标识符。对匿名用户使用 anonymous,或提供一个唯一的用户标识符。

threadIdstring

一个可选的标识符,用于在多条消息之间保持会话的连续性。提供该值后,系统会将后续消息关联到同一个会话线程。当 event.type === 'finish' 时,响应中会在 event.threadId 字段返回该 threadId。

retrievalPageSizenumber

用于生成回答时检索的文档搜索结果数量。数值越高,可用的上下文越多,但可能增加响应时间。推荐值:5。

currentPathstring

用户当前正在查看的页面路径。若提供,AI 助手会利用该上下文给出更相关的回答。最大长度:200 个字符。

Response

消息已成功生成

object required

与 AI SDK v5 兼容的流式响应。使用 @ai-sdk/react 中的 useChat 钩子 来处理响应流。

Changes

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    5 more changes in this revision