Improvement AI chat error handling (#15035)
- Fixed AI chat failures when tool calls were present in conversation history - Improved error handling and user feedback for AI streaming errors https://github.com/user-attachments/assets/ca85820f-32c0-4f42-86ee-98f4543e6038
This commit is contained in:
@@ -1,24 +1,10 @@
|
||||
import { type AIChatObjectMetadataAndRecordContext } from '@/ai/states/agentChatContextState';
|
||||
import { type UIMessageWithMetadata } from '@/ai/types/UIMessageWithMetadata';
|
||||
import { type Chat } from '@ai-sdk/react';
|
||||
import { createContext } from 'react';
|
||||
import { type ObjectRecord } from '../../object-record/types/ObjectRecord';
|
||||
|
||||
export type AgentChatContextValue = {
|
||||
messages: UIMessageWithMetadata[];
|
||||
isStreaming: boolean;
|
||||
isLoading: boolean;
|
||||
error?: Error;
|
||||
|
||||
input: string;
|
||||
handleInputChange: (value: string) => void;
|
||||
|
||||
handleSendMessage: (records?: ObjectRecord[]) => Promise<void>;
|
||||
handleSetContext: (
|
||||
items: Array<AIChatObjectMetadataAndRecordContext>,
|
||||
) => Promise<void>;
|
||||
|
||||
scrollWrapperId: string;
|
||||
context: Array<AIChatObjectMetadataAndRecordContext>;
|
||||
chat: Chat<UIMessageWithMetadata>;
|
||||
isLoadingData: boolean;
|
||||
};
|
||||
|
||||
export const AgentChatContext = createContext<AgentChatContextValue | null>(
|
||||
|
||||
Reference in New Issue
Block a user