为你的提示词提供更多上下文
Available in Start plan
通过 context 选项,你可以向 AI 模型提供额外信息,帮助其生成更相关的内容。当你希望生成更符合对话上下文的内容时,这非常有用。
Context 选项
上下文可以通过两种格式提供,text 和 url。text 格式用于向 AI 模型提供额外的文本上下文,而 url 格式用于提供网址上下文。
URL 要求
提供的 URL 必须是 Tiptap 内容 AI 可以访问的有效网址。当你想为 AI 模型提供引用第三方来源的额外上下文时,这非常有用。
// 将响应作为富文本流式传输到编辑器
editor
.chain()
.aiTextPrompt({
text: 'Alice 的职业是什么?',
stream: true,
format: 'rich-text',
context: [
{ type: 'text', text: 'John 和 Alice 是软件工程师。' },
{ type: 'url', url: 'https://company.example.com/team' },
],
})
.run()