@economic/agents-react 1.1.7 → 1.1.9
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.
- package/dist/index.d.mts +18 -6
- package/dist/index.mjs +8 -8
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -221,13 +221,25 @@ type ChatSummary = {
|
|
|
221
221
|
created_at: number;
|
|
222
222
|
updated_at: number;
|
|
223
223
|
};
|
|
224
|
-
type
|
|
224
|
+
type MessageFeedback = {
|
|
225
225
|
message_id: string;
|
|
226
226
|
rating: number;
|
|
227
227
|
comment?: string;
|
|
228
228
|
created_at: number;
|
|
229
229
|
updated_at: number;
|
|
230
230
|
};
|
|
231
|
+
type MessageFeedbackHandler = (messageId: string, rating: number, comment?: string) => Promise<void>;
|
|
232
|
+
type GetMessageFeedbackHandler = () => Promise<Record<string, MessageFeedback>>;
|
|
233
|
+
type GetChatsHandler = () => Promise<ChatSummary[]>;
|
|
234
|
+
type CreateChatHandler = () => Promise<string>;
|
|
235
|
+
type OpenChatHandler = (chatId: string) => void;
|
|
236
|
+
type DeleteChatHandler = (chatId: string) => Promise<void>;
|
|
237
|
+
interface AssistantActions {
|
|
238
|
+
getChats: GetChatsHandler;
|
|
239
|
+
createChat: CreateChatHandler;
|
|
240
|
+
openChat: OpenChatHandler;
|
|
241
|
+
deleteChat: DeleteChatHandler;
|
|
242
|
+
}
|
|
231
243
|
//#endregion
|
|
232
244
|
//#region src/useAgent.d.ts
|
|
233
245
|
interface UseAgentOptions {
|
|
@@ -297,8 +309,8 @@ declare function useChat<ToolContext extends Record<string, unknown>>(options: U
|
|
|
297
309
|
isStreaming: boolean;
|
|
298
310
|
isToolContinuation: boolean;
|
|
299
311
|
};
|
|
300
|
-
|
|
301
|
-
|
|
312
|
+
submitMessageFeedback: MessageFeedbackHandler;
|
|
313
|
+
getMessageFeedback: GetMessageFeedbackHandler;
|
|
302
314
|
};
|
|
303
315
|
//#endregion
|
|
304
316
|
//#region src/useAssistant.d.ts
|
|
@@ -342,9 +354,9 @@ declare function useAssistant<ToolContext extends Record<string, unknown>>(optio
|
|
|
342
354
|
isStreaming: boolean;
|
|
343
355
|
isToolContinuation: boolean;
|
|
344
356
|
};
|
|
345
|
-
|
|
346
|
-
|
|
357
|
+
submitMessageFeedback: MessageFeedbackHandler;
|
|
358
|
+
getMessageFeedback: GetMessageFeedbackHandler;
|
|
347
359
|
};
|
|
348
360
|
};
|
|
349
361
|
//#endregion
|
|
350
|
-
export { type AgentConnectionState, type AgentConnectionStatus, type AgentConnectionType, type ChatSummary, type
|
|
362
|
+
export { type AgentConnectionState, type AgentConnectionStatus, type AgentConnectionType, type AssistantActions, type ChatSummary, type CreateChatHandler, type DeleteChatHandler, type GetChatsHandler, type GetMessageFeedbackHandler, type MessageFeedback, type MessageFeedbackHandler, type OpenChatHandler, useAgent, useAssistant, useChat };
|
package/dist/index.mjs
CHANGED
|
@@ -57,22 +57,22 @@ function useChat(options) {
|
|
|
57
57
|
chat.messages.length,
|
|
58
58
|
welcomeMessage
|
|
59
59
|
]);
|
|
60
|
-
async
|
|
61
|
-
|
|
60
|
+
const submitMessageFeedback = async (messageId, rating, comment) => {
|
|
61
|
+
await agent.call("submitMessageFeedback", [
|
|
62
62
|
messageId,
|
|
63
63
|
rating,
|
|
64
64
|
comment
|
|
65
65
|
]);
|
|
66
|
-
}
|
|
67
|
-
async
|
|
68
|
-
return await agent.call("
|
|
69
|
-
}
|
|
66
|
+
};
|
|
67
|
+
const getMessageFeedback = async () => {
|
|
68
|
+
return await agent.call("getMessageFeedback");
|
|
69
|
+
};
|
|
70
70
|
return {
|
|
71
71
|
status,
|
|
72
72
|
agent,
|
|
73
73
|
chat,
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
submitMessageFeedback,
|
|
75
|
+
getMessageFeedback
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
//#endregion
|