feat(37-04): add voiceMode to chatApi.postMessageAndStream + useStreamingChat.startStream
- postMessageAndStream data type extended with optional voiceMode field - startStream signature updated: (userMessage, agentId?, voiceMode?) - voiceMode forwarded into fetch body via postMessageAndStream call
This commit is contained in:
parent
b777ebe345
commit
39bfec7fd8
2 changed files with 3 additions and 3 deletions
|
|
@ -62,7 +62,7 @@ export const chatApi = {
|
||||||
|
|
||||||
async postMessageAndStream(
|
async postMessageAndStream(
|
||||||
conversationId: string,
|
conversationId: string,
|
||||||
data: { content: string; agentId?: string },
|
data: { content: string; agentId?: string; voiceMode?: string },
|
||||||
callbacks: {
|
callbacks: {
|
||||||
onToken: (token: string) => void;
|
onToken: (token: string) => void;
|
||||||
onDone: (messageId: string, content: string) => void;
|
onDone: (messageId: string, content: string) => void;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ export function useStreamingChat(conversationId: string | null) {
|
||||||
const [, startTransition] = useTransition();
|
const [, startTransition] = useTransition();
|
||||||
|
|
||||||
const startStream = useCallback(
|
const startStream = useCallback(
|
||||||
(userMessage: string, agentId?: string) => {
|
(userMessage: string, agentId?: string, voiceMode?: string) => {
|
||||||
if (!conversationId) return;
|
if (!conversationId) return;
|
||||||
|
|
||||||
setIsStreaming(true);
|
setIsStreaming(true);
|
||||||
|
|
@ -21,7 +21,7 @@ export function useStreamingChat(conversationId: string | null) {
|
||||||
|
|
||||||
chatApi.postMessageAndStream(
|
chatApi.postMessageAndStream(
|
||||||
conversationId,
|
conversationId,
|
||||||
{ content: userMessage, agentId },
|
{ content: userMessage, agentId, voiceMode },
|
||||||
{
|
{
|
||||||
onToken: (token: string) => {
|
onToken: (token: string) => {
|
||||||
startTransition(() => {
|
startTransition(() => {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue