Spaces:
Runtime error
Runtime error
matt HOFFNER
commited on
Commit
Β·
8b233d8
1
Parent(s):
b9d9891
cleanup
Browse files- src/components/Chat/Chat.tsx +4 -3
- src/components/Chat/ChatInput.tsx +0 -14
- src/types/chat.ts +2 -2
src/components/Chat/Chat.tsx
CHANGED
|
@@ -34,6 +34,7 @@ export const Chat = memo(({ stopConversationRef }: Props) => {
|
|
| 34 |
conversations,
|
| 35 |
loading
|
| 36 |
},
|
|
|
|
| 37 |
dispatch: homeDispatch,
|
| 38 |
}: any = useContext(HomeContext);
|
| 39 |
|
|
@@ -245,7 +246,7 @@ export const Chat = memo(({ stopConversationRef }: Props) => {
|
|
| 245 |
|
| 246 |
const onClearAll = () => {
|
| 247 |
if (
|
| 248 |
-
confirm(
|
| 249 |
selectedConversation
|
| 250 |
) {
|
| 251 |
handleUpdateConversation(selectedConversation, {
|
|
@@ -336,9 +337,9 @@ export const Chat = memo(({ stopConversationRef }: Props) => {
|
|
| 336 |
<ChatInput
|
| 337 |
stopConversationRef={stopConversationRef}
|
| 338 |
textareaRef={textareaRef}
|
| 339 |
-
onSend={(message: any
|
| 340 |
setCurrentMessage(message);
|
| 341 |
-
handleSend(message, 0
|
| 342 |
}}
|
| 343 |
onScrollDownClick={handleScrollDown}
|
| 344 |
onRegenerate={() => {
|
|
|
|
| 34 |
conversations,
|
| 35 |
loading
|
| 36 |
},
|
| 37 |
+
handleUpdateConversation,
|
| 38 |
dispatch: homeDispatch,
|
| 39 |
}: any = useContext(HomeContext);
|
| 40 |
|
|
|
|
| 246 |
|
| 247 |
const onClearAll = () => {
|
| 248 |
if (
|
| 249 |
+
confirm('Are you sure you want to clear all messages?') &&
|
| 250 |
selectedConversation
|
| 251 |
) {
|
| 252 |
handleUpdateConversation(selectedConversation, {
|
|
|
|
| 337 |
<ChatInput
|
| 338 |
stopConversationRef={stopConversationRef}
|
| 339 |
textareaRef={textareaRef}
|
| 340 |
+
onSend={(message: any) => {
|
| 341 |
setCurrentMessage(message);
|
| 342 |
+
handleSend(message, 0);
|
| 343 |
}}
|
| 344 |
onScrollDownClick={handleScrollDown}
|
| 345 |
onRegenerate={() => {
|
src/components/Chat/ChatInput.tsx
CHANGED
|
@@ -135,20 +135,6 @@ const updatePromptListVisibility = useCallback((text: string) => {
|
|
| 135 |
}
|
| 136 |
}, []);
|
| 137 |
|
| 138 |
-
const handlePromptSelect = (prompt: Prompt) => {
|
| 139 |
-
const parsedVariables = parseVariables(prompt.content);
|
| 140 |
-
setVariables(parsedVariables);
|
| 141 |
-
|
| 142 |
-
if (parsedVariables.length > 0) {
|
| 143 |
-
setIsModalVisible(true);
|
| 144 |
-
} else {
|
| 145 |
-
setContent((prevContent) => {
|
| 146 |
-
const updatedContent = prevContent?.replace(/\/\w*$/, prompt.content);
|
| 147 |
-
return updatedContent;
|
| 148 |
-
});
|
| 149 |
-
updatePromptListVisibility(prompt.content);
|
| 150 |
-
}
|
| 151 |
-
};
|
| 152 |
|
| 153 |
const handleSubmit = (updatedVariables: string[]) => {
|
| 154 |
const newContent = content?.replace(/{{(.*?)}}/g, (match, variable) => {
|
|
|
|
| 135 |
}
|
| 136 |
}, []);
|
| 137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
|
| 139 |
const handleSubmit = (updatedVariables: string[]) => {
|
| 140 |
const newContent = content?.replace(/{{(.*?)}}/g, (match, variable) => {
|
src/types/chat.ts
CHANGED
|
@@ -8,9 +8,9 @@ export interface Message {
|
|
| 8 |
export interface ChatBody {
|
| 9 |
model: any;
|
| 10 |
messages: Message[];
|
| 11 |
-
key
|
| 12 |
prompt: string;
|
| 13 |
-
temperature
|
| 14 |
}
|
| 15 |
|
| 16 |
export interface Conversation {
|
|
|
|
| 8 |
export interface ChatBody {
|
| 9 |
model: any;
|
| 10 |
messages: Message[];
|
| 11 |
+
key?: string;
|
| 12 |
prompt: string;
|
| 13 |
+
temperature?: number;
|
| 14 |
}
|
| 15 |
|
| 16 |
export interface Conversation {
|