Files
bolt-diy/app/types/actions.ts
xKevIsDev 26c46088bc feat: enhance error handling for LLM API calls
Add LLM error alert functionality to display specific error messages based on API responses. Introduce new LlmErrorAlertType interface for structured error alerts. Update chat components to manage and display LLM error alerts effectively, improving user feedback during error scenarios.
2025-07-10 18:54:12 +00:00

86 lines
1.9 KiB
TypeScript

import type { Change } from 'diff';
export type ActionType = 'file' | 'shell' | 'supabase';
export interface BaseAction {
content: string;
}
export interface FileAction extends BaseAction {
type: 'file';
filePath: string;
}
export interface ShellAction extends BaseAction {
type: 'shell';
}
export interface StartAction extends BaseAction {
type: 'start';
}
export interface BuildAction extends BaseAction {
type: 'build';
}
export interface SupabaseAction extends BaseAction {
type: 'supabase';
operation: 'migration' | 'query';
filePath?: string;
projectId?: string;
}
export type BoltAction = FileAction | ShellAction | StartAction | BuildAction | SupabaseAction;
export type BoltActionData = BoltAction | BaseAction;
export interface ActionAlert {
type: string;
title: string;
description: string;
content: string;
source?: 'terminal' | 'preview'; // Add source to differentiate between terminal and preview errors
}
export interface SupabaseAlert {
type: string;
title: string;
description: string;
content: string;
source?: 'supabase';
}
export interface DeployAlert {
type: 'success' | 'error' | 'info';
title: string;
description: string;
content?: string;
url?: string;
stage?: 'building' | 'deploying' | 'complete';
buildStatus?: 'pending' | 'running' | 'complete' | 'failed';
deployStatus?: 'pending' | 'running' | 'complete' | 'failed';
source?: 'vercel' | 'netlify' | 'github';
}
export interface LlmErrorAlertType {
type: 'error' | 'warning';
title: string;
description: string;
content?: string;
provider?: string;
errorType?: 'authentication' | 'rate_limit' | 'quota' | 'network' | 'unknown';
}
export interface FileHistory {
originalContent: string;
lastModified: number;
changes: Change[];
versions: {
timestamp: number;
content: string;
}[];
// Novo campo para rastrear a origem das mudanças
changeSource?: 'user' | 'auto-save' | 'external';
}