From d327cfea2958c1cf2e053b01c4964daf5adcad22 Mon Sep 17 00:00:00 2001 From: Anirban Kar Date: Tue, 17 Dec 2024 21:19:43 +0530 Subject: [PATCH 1/6] feat: added terminal error capturing and automated fix prompt --- app/commit.json | 2 +- app/components/chat/BaseChat.tsx | 429 +++++++++++++++------------- app/components/chat/Chat.client.tsx | 3 + app/components/chat/ChatAlert.tsx | 81 ++++++ app/lib/runtime/action-runner.ts | 88 +++++- app/lib/stores/workbench.ts | 16 +- app/types/actions.ts | 7 + app/utils/shell.ts | 61 +++- 8 files changed, 474 insertions(+), 213 deletions(-) create mode 100644 app/components/chat/ChatAlert.tsx diff --git a/app/commit.json b/app/commit.json index 832678f..4d68a74 100644 --- a/app/commit.json +++ b/app/commit.json @@ -1 +1 @@ -{ "commit": "1e72d52278730f7d22448be9d5cf2daf12559486", "version": "0.0.2" } +{ "commit": "42bde1cae43de887a6bc5a72f6352a63f65677e6" } diff --git a/app/components/chat/BaseChat.tsx b/app/components/chat/BaseChat.tsx index 2084cbb..7879d78 100644 --- a/app/components/chat/BaseChat.tsx +++ b/app/components/chat/BaseChat.tsx @@ -28,6 +28,8 @@ import { SpeechRecognitionButton } from '~/components/chat/SpeechRecognition'; import type { IProviderSetting, ProviderInfo } from '~/types/model'; import { ScreenshotStateManager } from './ScreenshotStateManager'; import { toast } from 'react-toastify'; +import type { ActionAlert } from '~/types/actions'; +import ChatAlert from './ChatAlert'; const TEXTAREA_MIN_HEIGHT = 76; @@ -58,6 +60,8 @@ interface BaseChatProps { setUploadedFiles?: (files: File[]) => void; imageDataList?: string[]; setImageDataList?: (dataList: string[]) => void; + actionAlert?: ActionAlert; + clearAlert?: () => void; } export const BaseChat = React.forwardRef( @@ -89,6 +93,8 @@ export const BaseChat = React.forwardRef( imageDataList = [], setImageDataList, messages, + actionAlert, + clearAlert, }, ref, ) => { @@ -313,226 +319,247 @@ export const BaseChat = React.forwardRef( }}
- - - - - - - - - - - - - - - - - - -
-
- - {(providerList || []).length > 0 && provider && ( - { - const newApiKeys = { ...apiKeys, [provider.name]: key }; - setApiKeys(newApiKeys); - Cookies.set('apiKeys', JSON.stringify(newApiKeys)); - }} - /> - )} -
-
- { - setUploadedFiles?.(uploadedFiles.filter((_, i) => i !== index)); - setImageDataList?.(imageDataList.filter((_, i) => i !== index)); - }} - /> - - {() => ( - + {actionAlert && ( + clearAlert?.()} + postMessage={(message) => { + sendMessage?.({} as any, message); + clearAlert?.(); + }} /> )} - +
-