From 5bf8a2eebbaed49e670c64847c7244f161706e93 Mon Sep 17 00:00:00 2001 From: Rozstone Date: Tue, 10 Dec 2024 14:58:20 +0800 Subject: [PATCH 1/2] feat: add options to for in ai submit options to allow sending other contexts in body --- packages/ai/src/react/ai-chat/utils/submitAIChat.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/ai/src/react/ai-chat/utils/submitAIChat.ts b/packages/ai/src/react/ai-chat/utils/submitAIChat.ts index cabf707d5a..2cca51570d 100644 --- a/packages/ai/src/react/ai-chat/utils/submitAIChat.ts +++ b/packages/ai/src/react/ai-chat/utils/submitAIChat.ts @@ -1,3 +1,5 @@ +import type { ChatRequestOptions } from 'ai'; + import { type PlateEditor, getEditorPlugin } from '@udecode/plate-common/react'; import { isSelecting } from '@udecode/plate-selection'; @@ -10,10 +12,12 @@ export const submitAIChat = ( editor: PlateEditor, { mode, + options, prompt, system, }: { mode?: 'chat' | 'insert'; + options?: ChatRequestOptions; prompt?: EditorPrompt; system?: EditorPrompt; } = {} @@ -60,6 +64,7 @@ export const submitAIChat = ( promptTemplate: systemTemplate, }), }, + ...options, } ); }; From a1ad4ab3f685142d2802001eb648c0a84eeaaeba Mon Sep 17 00:00:00 2001 From: Ziad Beyens Date: Tue, 10 Dec 2024 10:57:26 +0100 Subject: [PATCH 2/2] Create light-dolphins-nail.md --- .changeset/light-dolphins-nail.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/light-dolphins-nail.md diff --git a/.changeset/light-dolphins-nail.md b/.changeset/light-dolphins-nail.md new file mode 100644 index 0000000000..9b35736b14 --- /dev/null +++ b/.changeset/light-dolphins-nail.md @@ -0,0 +1,5 @@ +--- +"@udecode/plate-ai": patch +--- + +`submitAIChat`: add `ChatRequestOptions` options