@rimori/react-client 0.4.17-next.2 → 0.4.17-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,13 +9,10 @@ interface Props {
9
9
  children?: React.ReactNode;
10
10
  autoStartConversation?: FirstMessages;
11
11
  className?: string;
12
- knowledgeId?: string;
13
12
  /** Server-side prompt name (e.g. 'studyplan.reflection'). When set, the backend resolves the system prompt. */
14
13
  prompt?: string;
15
14
  /** Variables for the server-side prompt template. */
16
15
  promptVariables?: Record<string, any>;
17
- /** Set to true to disable automatic dialect TTS from userInfo. Default: false (dialect enabled). */
18
- disableDialect?: boolean;
19
16
  }
20
- export declare function Avatar({ avatarImageUrl, voiceId, agentTools, autoStartConversation, children, circleSize, className, cache, knowledgeId, prompt, promptVariables, disableDialect, }: Props): import("react/jsx-runtime").JSX.Element;
17
+ export declare function Avatar({ avatarImageUrl, voiceId, agentTools, autoStartConversation, children, circleSize, className, cache, prompt, promptVariables, }: Props): import("react/jsx-runtime").JSX.Element;
21
18
  export {};
@@ -7,18 +7,19 @@ import { useChat } from '../../hooks/UseChatHook';
7
7
  import { useRimori } from '../../providers/PluginProvider';
8
8
  import { getFirstMessages } from './utils';
9
9
  import { useTheme } from '../../hooks/ThemeSetter';
10
- export function Avatar({ avatarImageUrl, voiceId, agentTools, autoStartConversation, children, circleSize = '300px', className, cache = false, knowledgeId, prompt, promptVariables, disableDialect = false, }) {
10
+ export function Avatar({ avatarImageUrl, voiceId, agentTools, autoStartConversation, children, circleSize = '300px', className, cache = false, prompt, promptVariables, }) {
11
11
  const { ai, event, plugin, userInfo } = useRimori();
12
12
  const { isDark: isDarkThemeValue } = useTheme(plugin.theme);
13
13
  const [agentReplying, setAgentReplying] = useState(false);
14
14
  const [isProcessingMessage, setIsProcessingMessage] = useState(false);
15
- const dialectTtsInstruction = !disableDialect && (userInfo === null || userInfo === void 0 ? void 0 : userInfo.dialect) ? `Speak with a ${userInfo.dialect} accent and pronunciation.` : undefined;
15
+ const dialectTtsInstruction = (userInfo === null || userInfo === void 0 ? void 0 : userInfo.dialect)
16
+ ? `Speak with a ${userInfo.dialect} accent and pronunciation.`
17
+ : undefined;
16
18
  const sender = useMemo(() => new MessageSender((...args) => ai.getVoice(...args), voiceId, cache), [voiceId, ai, cache]);
17
19
  useEffect(() => {
18
20
  sender.setInstructions(dialectTtsInstruction);
19
21
  }, [sender, dialectTtsInstruction]);
20
22
  const { messages, append, isLoading, lastMessage, setMessages } = useChat(agentTools, {
21
- knowledgeId,
22
23
  prompt,
23
24
  promptVariables,
24
25
  });
@@ -7,10 +7,8 @@ export interface BuddyAssistantAutoStart {
7
7
  userMessage?: string;
8
8
  }
9
9
  export interface BuddyAssistantProps {
10
- /** @deprecated Use `prompt` + `promptVariables` instead of building system prompts client-side. */
11
- systemPrompt?: string;
12
- /** Server-side prompt name (e.g. 'studyplan.goalSummary'). When set, the backend resolves the system prompt. */
13
- prompt?: string;
10
+ /** Server-side prompt name (e.g. 'studyplan.goalSummary'). The backend resolves the system prompt. */
11
+ prompt: string;
14
12
  /** Variables for the server-side prompt template. */
15
13
  promptVariables?: Record<string, any>;
16
14
  autoStartConversation?: BuddyAssistantAutoStart;
@@ -20,9 +18,7 @@ export interface BuddyAssistantProps {
20
18
  className?: string;
21
19
  voiceSpeed?: number;
22
20
  tools?: Tool[];
23
- /** Set to true to disable automatic dialect from userInfo. Default: false (dialect enabled). */
24
- disableDialect?: boolean;
25
21
  /** Show the buddy name below the avatar. Default: false. */
26
22
  showName?: boolean;
27
23
  }
28
- export declare function BuddyAssistant({ systemPrompt, prompt, promptVariables, autoStartConversation, circleSize, chatPlaceholder, bottomAction, className, voiceSpeed, tools, disableDialect, showName, }: BuddyAssistantProps): JSX.Element;
24
+ export declare function BuddyAssistant({ prompt, promptVariables, autoStartConversation, circleSize, chatPlaceholder, bottomAction, className, voiceSpeed, tools, showName, }: BuddyAssistantProps): JSX.Element;
@@ -8,15 +8,12 @@ import { useTheme } from '../../hooks/ThemeSetter';
8
8
  import { BiSolidRightArrow } from 'react-icons/bi';
9
9
  let idCounter = 0;
10
10
  const genId = () => `ba-${++idCounter}`;
11
- export function BuddyAssistant({ systemPrompt, prompt, promptVariables, autoStartConversation, circleSize = '160px', chatPlaceholder, bottomAction, className, voiceSpeed = 1, tools, disableDialect = false, showName = false, }) {
11
+ export function BuddyAssistant({ prompt, promptVariables, autoStartConversation, circleSize = '160px', chatPlaceholder, bottomAction, className, voiceSpeed = 1, tools, showName = false, }) {
12
12
  const { ai, event, plugin, userInfo } = useRimori();
13
13
  const ttsEnabled = plugin.ttsEnabled;
14
14
  const { isDark } = useTheme(plugin.theme);
15
15
  const buddy = userInfo.study_buddy;
16
- const dialect = !disableDialect ? userInfo === null || userInfo === void 0 ? void 0 : userInfo.dialect : undefined;
17
- const dialectSystemSuffix = dialect
18
- ? `\n\nThe user is learning the regional ${dialect} dialect. Occasionally use typical regional vocabulary and expressions from this dialect to help them learn local language naturally.`
19
- : '';
16
+ const dialect = userInfo === null || userInfo === void 0 ? void 0 : userInfo.dialect;
20
17
  const dialectTtsInstruction = dialect ? `Speak with a ${dialect} accent and pronunciation.` : undefined;
21
18
  const [chatInput, setChatInput] = useState('');
22
19
  const [messages, setMessages] = useState([]);
@@ -42,32 +39,33 @@ export function BuddyAssistant({ systemPrompt, prompt, promptVariables, autoStar
42
39
  sender.setOnEndOfSpeech(() => setIsSpeaking(false));
43
40
  return () => sender.cleanup();
44
41
  }, [sender]);
45
- // Build full API message list — when using server-side prompt, skip the client-side system message
46
42
  const buildApiMessages = (history) => {
47
- const msgs = history.map((m) => ({ role: m.role, content: m.content }));
48
- if (!prompt && systemPrompt) {
49
- return [{ role: 'system', content: systemPrompt + dialectSystemSuffix }, ...msgs];
50
- }
51
- return msgs;
43
+ return history.map((m) => ({ role: m.role, content: m.content }));
52
44
  };
53
45
  const triggerAI = (history) => {
54
46
  setIsLoading(true);
55
- void ai.getSteamedText(buildApiMessages(history), (id, partial, finished) => {
56
- setIsLoading(!finished);
57
- const assistantId = `ai-${id}`;
58
- setMessages((prev) => {
59
- const last = prev[prev.length - 1];
60
- if ((last === null || last === void 0 ? void 0 : last.id) === assistantId) {
61
- return [...prev.slice(0, -1), Object.assign(Object.assign({}, last), { content: partial })];
47
+ void ai.getStreamedText({
48
+ messages: buildApiMessages(history),
49
+ onMessage: (id, partial, finished) => {
50
+ setIsLoading(!finished);
51
+ const assistantId = `ai-${id}`;
52
+ setMessages((prev) => {
53
+ const last = prev[prev.length - 1];
54
+ if ((last === null || last === void 0 ? void 0 : last.id) === assistantId) {
55
+ return [...prev.slice(0, -1), Object.assign(Object.assign({}, last), { content: partial })];
56
+ }
57
+ return [...prev, { id: assistantId, role: 'assistant', content: partial }];
58
+ });
59
+ if (ttsEnabledRef.current) {
60
+ void sender.handleNewText(partial, !finished);
61
+ if (partial)
62
+ setIsSpeaking(true);
62
63
  }
63
- return [...prev, { id: assistantId, role: 'assistant', content: partial }];
64
- });
65
- if (ttsEnabledRef.current) {
66
- void sender.handleNewText(partial, !finished);
67
- if (partial)
68
- setIsSpeaking(true);
69
- }
70
- }, tools, false, undefined, undefined, prompt, promptVariables);
64
+ },
65
+ tools,
66
+ prompt,
67
+ variables: promptVariables,
68
+ });
71
69
  };
72
70
  // Auto-start conversation on mount
73
71
  const autoStartedRef = useRef(false);
@@ -1,8 +1,5 @@
1
- /** @deprecated Use server-side prompt definitions (prompt + variables) instead of building messages client-side. */
2
1
  export interface FirstMessages {
3
- instructions?: string;
4
2
  userMessage?: string;
5
3
  assistantMessage?: string;
6
4
  }
7
- /** @deprecated Use server-side prompt definitions (prompt + variables) instead of building messages client-side. */
8
- export declare function getFirstMessages(instructions: FirstMessages): any[];
5
+ export declare function getFirstMessages(config: FirstMessages): any[];
@@ -1,14 +1,10 @@
1
- /** @deprecated Use server-side prompt definitions (prompt + variables) instead of building messages client-side. */
2
- export function getFirstMessages(instructions) {
1
+ export function getFirstMessages(config) {
3
2
  const messages = [];
4
- if (instructions.instructions) {
5
- messages.push({ id: '1', role: 'system', content: instructions.instructions });
3
+ if (config.userMessage) {
4
+ messages.push({ id: '1', role: 'user', content: config.userMessage });
6
5
  }
7
- if (instructions.userMessage) {
8
- messages.push({ id: '2', role: 'user', content: instructions.userMessage });
9
- }
10
- if (instructions.assistantMessage) {
11
- messages.push({ id: '3', role: 'assistant', content: instructions.assistantMessage });
6
+ if (config.assistantMessage) {
7
+ messages.push({ id: '2', role: 'assistant', content: config.assistantMessage });
12
8
  }
13
9
  return messages;
14
10
  }
@@ -250,16 +250,11 @@ export const MarkdownEditor = ({ content, editable, className, onUpdate, labels,
250
250
  return;
251
251
  const selectedText = editor.state.doc.textBetween(from, to, '\n');
252
252
  setIsTransforming(true);
253
- const transformed = yield ai.getText([
254
- {
255
- role: 'system',
256
- content: 'You are a text editor assistant. Transform the provided text according to the user instruction. Return only the transformed text, no explanations. If formattation is wished, use markdown syntax in the output.',
257
- },
258
- {
259
- role: 'user',
260
- content: `Instruction: ${prompt}\n\nText:\n${selectedText}`,
261
- },
262
- ]);
253
+ const transformed = yield ai.getText({
254
+ messages: [],
255
+ prompt: 'global.editor.transform-text',
256
+ variables: { instruction: prompt, text: selectedText },
257
+ });
263
258
  setIsTransforming(false);
264
259
  if (!transformed)
265
260
  return;
@@ -8,8 +8,6 @@ export interface UseChatConfig {
8
8
  promptVariables?: Record<string, any>;
9
9
  }
10
10
  export declare function useChat(tools?: Tool[], options?: {
11
- /** @deprecated Use uuid variable with resolver 'knowledgeEntry' in prompt definitions instead. */
12
- knowledgeId?: string;
13
11
  /** Server-side prompt name (e.g. 'storytelling.story'). When set, the backend resolves the system prompt. */
14
12
  prompt?: string;
15
13
  /** Variables for the server-side prompt template. */
@@ -21,19 +21,24 @@ export function useChat(tools, options) {
21
21
  const allMessages = [...messages, ...appendMessages];
22
22
  setMessages(allMessages);
23
23
  setIsLoading(true);
24
- const knowledgeId = options === null || options === void 0 ? void 0 : options.knowledgeId;
25
24
  const promptVariables = (_a = configRef.current.promptVariables) !== null && _a !== void 0 ? _a : options === null || options === void 0 ? void 0 : options.promptVariables;
26
25
  const prompt = (_b = configRef.current.prompt) !== null && _b !== void 0 ? _b : options === null || options === void 0 ? void 0 : options.prompt;
27
- void ai.getSteamedText(allMessages, (id, message, finished, toolInvocations) => {
28
- setIsLoading(!finished);
29
- setMessages((prev) => {
30
- const last = prev[prev.length - 1];
31
- if ((last === null || last === void 0 ? void 0 : last.id) === id) {
32
- return [...prev.slice(0, -1), Object.assign(Object.assign({}, last), { content: message, toolCalls: toolInvocations })];
33
- }
34
- return [...prev, { id, role: 'assistant', content: message, toolCalls: toolInvocations }];
35
- });
36
- }, tools, false, undefined, knowledgeId, prompt, promptVariables);
26
+ void ai.getStreamedText({
27
+ messages: allMessages,
28
+ onMessage: (id, message, finished, toolInvocations) => {
29
+ setIsLoading(!finished);
30
+ setMessages((prev) => {
31
+ const last = prev[prev.length - 1];
32
+ if ((last === null || last === void 0 ? void 0 : last.id) === id) {
33
+ return [...prev.slice(0, -1), Object.assign(Object.assign({}, last), { content: message, toolCalls: toolInvocations })];
34
+ }
35
+ return [...prev, { id, role: 'assistant', content: message, toolCalls: toolInvocations }];
36
+ });
37
+ },
38
+ tools,
39
+ prompt,
40
+ variables: promptVariables,
41
+ });
37
42
  };
38
43
  return {
39
44
  messages,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimori/react-client",
3
- "version": "0.4.17-next.2",
3
+ "version": "0.4.17-next.3",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,7 +25,7 @@
25
25
  "format": "prettier --write ."
26
26
  },
27
27
  "peerDependencies": {
28
- "@rimori/client": "2.5.28-next.5",
28
+ "@rimori/client": "2.5.28-next.7",
29
29
  "react": "^18.1.0",
30
30
  "react-dom": "^18.1.0"
31
31
  },
@@ -49,7 +49,7 @@
49
49
  },
50
50
  "devDependencies": {
51
51
  "@eslint/js": "^9.37.0",
52
- "@rimori/client": "2.5.28-next.5",
52
+ "@rimori/client": "2.5.28-next.7",
53
53
  "@types/react": "^18.3.21",
54
54
  "eslint-config-prettier": "^10.1.8",
55
55
  "eslint-plugin-prettier": "^5.5.4",
@@ -18,13 +18,10 @@ interface Props {
18
18
  children?: React.ReactNode;
19
19
  autoStartConversation?: FirstMessages;
20
20
  className?: string;
21
- knowledgeId?: string;
22
21
  /** Server-side prompt name (e.g. 'studyplan.reflection'). When set, the backend resolves the system prompt. */
23
22
  prompt?: string;
24
23
  /** Variables for the server-side prompt template. */
25
24
  promptVariables?: Record<string, any>;
26
- /** Set to true to disable automatic dialect TTS from userInfo. Default: false (dialect enabled). */
27
- disableDialect?: boolean;
28
25
  }
29
26
 
30
27
  export function Avatar({
@@ -36,17 +33,16 @@ export function Avatar({
36
33
  circleSize = '300px',
37
34
  className,
38
35
  cache = false,
39
- knowledgeId,
40
36
  prompt,
41
37
  promptVariables,
42
- disableDialect = false,
43
38
  }: Props) {
44
39
  const { ai, event, plugin, userInfo } = useRimori();
45
40
  const { isDark: isDarkThemeValue } = useTheme(plugin.theme);
46
41
  const [agentReplying, setAgentReplying] = useState(false);
47
42
  const [isProcessingMessage, setIsProcessingMessage] = useState(false);
48
- const dialectTtsInstruction =
49
- !disableDialect && userInfo?.dialect ? `Speak with a ${userInfo.dialect} accent and pronunciation.` : undefined;
43
+ const dialectTtsInstruction = userInfo?.dialect
44
+ ? `Speak with a ${userInfo.dialect} accent and pronunciation.`
45
+ : undefined;
50
46
  const sender = useMemo(
51
47
  () => new MessageSender((...args) => ai.getVoice(...args), voiceId, cache),
52
48
  [voiceId, ai, cache],
@@ -56,7 +52,6 @@ export function Avatar({
56
52
  sender.setInstructions(dialectTtsInstruction);
57
53
  }, [sender, dialectTtsInstruction]);
58
54
  const { messages, append, isLoading, lastMessage, setMessages } = useChat(agentTools, {
59
- knowledgeId,
60
55
  prompt,
61
56
  promptVariables,
62
57
  });
@@ -16,10 +16,8 @@ export interface BuddyAssistantAutoStart {
16
16
  }
17
17
 
18
18
  export interface BuddyAssistantProps {
19
- /** @deprecated Use `prompt` + `promptVariables` instead of building system prompts client-side. */
20
- systemPrompt?: string;
21
- /** Server-side prompt name (e.g. 'studyplan.goalSummary'). When set, the backend resolves the system prompt. */
22
- prompt?: string;
19
+ /** Server-side prompt name (e.g. 'studyplan.goalSummary'). The backend resolves the system prompt. */
20
+ prompt: string;
23
21
  /** Variables for the server-side prompt template. */
24
22
  promptVariables?: Record<string, any>;
25
23
  autoStartConversation?: BuddyAssistantAutoStart;
@@ -29,8 +27,6 @@ export interface BuddyAssistantProps {
29
27
  className?: string;
30
28
  voiceSpeed?: number;
31
29
  tools?: Tool[];
32
- /** Set to true to disable automatic dialect from userInfo. Default: false (dialect enabled). */
33
- disableDialect?: boolean;
34
30
  /** Show the buddy name below the avatar. Default: false. */
35
31
  showName?: boolean;
36
32
  }
@@ -39,7 +35,6 @@ let idCounter = 0;
39
35
  const genId = () => `ba-${++idCounter}`;
40
36
 
41
37
  export function BuddyAssistant({
42
- systemPrompt,
43
38
  prompt,
44
39
  promptVariables,
45
40
  autoStartConversation,
@@ -49,17 +44,13 @@ export function BuddyAssistant({
49
44
  className,
50
45
  voiceSpeed = 1,
51
46
  tools,
52
- disableDialect = false,
53
47
  showName = false,
54
48
  }: BuddyAssistantProps): JSX.Element {
55
49
  const { ai, event, plugin, userInfo } = useRimori();
56
50
  const ttsEnabled = plugin.ttsEnabled;
57
51
  const { isDark } = useTheme(plugin.theme);
58
52
  const buddy = userInfo.study_buddy;
59
- const dialect = !disableDialect ? userInfo?.dialect : undefined;
60
- const dialectSystemSuffix = dialect
61
- ? `\n\nThe user is learning the regional ${dialect} dialect. Occasionally use typical regional vocabulary and expressions from this dialect to help them learn local language naturally.`
62
- : '';
53
+ const dialect = userInfo?.dialect;
63
54
  const dialectTtsInstruction = dialect ? `Speak with a ${dialect} accent and pronunciation.` : undefined;
64
55
  const [chatInput, setChatInput] = useState('');
65
56
  const [messages, setMessages] = useState<ChatMessage[]>([]);
@@ -93,20 +84,15 @@ export function BuddyAssistant({
93
84
  return () => sender.cleanup();
94
85
  }, [sender]);
95
86
 
96
- // Build full API message list — when using server-side prompt, skip the client-side system message
97
87
  const buildApiMessages = (history: ChatMessage[]) => {
98
- const msgs = history.map((m) => ({ role: m.role, content: m.content }));
99
- if (!prompt && systemPrompt) {
100
- return [{ role: 'system' as const, content: systemPrompt + dialectSystemSuffix }, ...msgs];
101
- }
102
- return msgs;
88
+ return history.map((m) => ({ role: m.role, content: m.content }));
103
89
  };
104
90
 
105
91
  const triggerAI = (history: ChatMessage[]) => {
106
92
  setIsLoading(true);
107
- void ai.getSteamedText(
108
- buildApiMessages(history),
109
- (id: string, partial: string, finished: boolean) => {
93
+ void ai.getStreamedText({
94
+ messages: buildApiMessages(history),
95
+ onMessage: (id: string, partial: string, finished: boolean) => {
110
96
  setIsLoading(!finished);
111
97
  const assistantId = `ai-${id}`;
112
98
  setMessages((prev) => {
@@ -122,12 +108,9 @@ export function BuddyAssistant({
122
108
  }
123
109
  },
124
110
  tools,
125
- false,
126
- undefined,
127
- undefined,
128
111
  prompt,
129
- promptVariables,
130
- );
112
+ variables: promptVariables,
113
+ });
131
114
  };
132
115
 
133
116
  // Auto-start conversation on mount
@@ -1,22 +1,16 @@
1
- /** @deprecated Use server-side prompt definitions (prompt + variables) instead of building messages client-side. */
2
1
  export interface FirstMessages {
3
- instructions?: string;
4
2
  userMessage?: string;
5
3
  assistantMessage?: string;
6
4
  }
7
5
 
8
- /** @deprecated Use server-side prompt definitions (prompt + variables) instead of building messages client-side. */
9
- export function getFirstMessages(instructions: FirstMessages): any[] {
6
+ export function getFirstMessages(config: FirstMessages): any[] {
10
7
  const messages = [];
11
8
 
12
- if (instructions.instructions) {
13
- messages.push({ id: '1', role: 'system', content: instructions.instructions });
9
+ if (config.userMessage) {
10
+ messages.push({ id: '1', role: 'user', content: config.userMessage });
14
11
  }
15
- if (instructions.userMessage) {
16
- messages.push({ id: '2', role: 'user', content: instructions.userMessage });
17
- }
18
- if (instructions.assistantMessage) {
19
- messages.push({ id: '3', role: 'assistant', content: instructions.assistantMessage });
12
+ if (config.assistantMessage) {
13
+ messages.push({ id: '2', role: 'assistant', content: config.assistantMessage });
20
14
  }
21
15
 
22
16
  return messages;
@@ -717,17 +717,11 @@ export const MarkdownEditor = ({
717
717
  if (from === to) return;
718
718
  const selectedText = editor.state.doc.textBetween(from, to, '\n');
719
719
  setIsTransforming(true);
720
- const transformed = await ai.getText([
721
- {
722
- role: 'system',
723
- content:
724
- 'You are a text editor assistant. Transform the provided text according to the user instruction. Return only the transformed text, no explanations. If formattation is wished, use markdown syntax in the output.',
725
- },
726
- {
727
- role: 'user',
728
- content: `Instruction: ${prompt}\n\nText:\n${selectedText}`,
729
- },
730
- ]);
720
+ const transformed = await ai.getText({
721
+ messages: [],
722
+ prompt: 'global.editor.transform-text',
723
+ variables: { instruction: prompt, text: selectedText },
724
+ });
731
725
  setIsTransforming(false);
732
726
  if (!transformed) return;
733
727
  editor.chain().focus().deleteRange({ from, to }).insertContentAt(from, transformed).run();
@@ -13,8 +13,6 @@ export interface UseChatConfig {
13
13
  export function useChat(
14
14
  tools?: Tool[],
15
15
  options?: {
16
- /** @deprecated Use uuid variable with resolver 'knowledgeEntry' in prompt definitions instead. */
17
- knowledgeId?: string;
18
16
  /** Server-side prompt name (e.g. 'storytelling.story'). When set, the backend resolves the system prompt. */
19
17
  prompt?: string;
20
18
  /** Variables for the server-side prompt template. */
@@ -42,13 +40,12 @@ export function useChat(
42
40
  const allMessages = [...messages, ...appendMessages];
43
41
  setMessages(allMessages);
44
42
  setIsLoading(true);
45
- const knowledgeId = options?.knowledgeId;
46
43
  const promptVariables = configRef.current.promptVariables ?? options?.promptVariables;
47
44
  const prompt = configRef.current.prompt ?? options?.prompt;
48
45
 
49
- void ai.getSteamedText(
50
- allMessages,
51
- (id, message, finished: boolean, toolInvocations?: ToolInvocation[]) => {
46
+ void ai.getStreamedText({
47
+ messages: allMessages,
48
+ onMessage: (id, message, finished: boolean, toolInvocations?: ToolInvocation[]) => {
52
49
  setIsLoading(!finished);
53
50
  setMessages((prev) => {
54
51
  const last = prev[prev.length - 1];
@@ -59,12 +56,9 @@ export function useChat(
59
56
  });
60
57
  },
61
58
  tools,
62
- false,
63
- undefined,
64
- knowledgeId,
65
59
  prompt,
66
- promptVariables,
67
- );
60
+ variables: promptVariables,
61
+ });
68
62
  };
69
63
 
70
64
  return {