Skip to content

Commit bd7c649

Browse files
committed
feat: remove unusued Regenerate button
1 parent 26b1797 commit bd7c649

File tree

8 files changed

+38
-89
lines changed

8 files changed

+38
-89
lines changed

src/components/Chat/Chat.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ interface Props {
2121
export const Chat = memo(({ stopConversationRef }: Props) => {
2222
const {
2323
state: { selectedConversation, conversations },
24-
handleUpdateConversation,
2524
dispatch: homeDispatch,
2625
} = useContext(ReactStreamChatContext)
2726

src/components/Chat/ChatInput.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ export const ChatInput = ({
115115
className="absolute top-0 left-0 right-0 mx-auto mb-3 flex w-fit items-center gap-3 rounded border border-neutral-200 bg-white py-2 px-4 text-black hover:opacity-50 dark:border-neutral-600 dark:bg-[#343541] dark:text-white md:mb-0 md:mt-2"
116116
onClick={handleStopConversation}
117117
>
118-
<IconPlayerStop size={16} /> {'Stop Generating'}
118+
<IconPlayerStop size={16} />
119+
Stop Generating
119120
</button>
120121
)}
121122

@@ -126,7 +127,8 @@ export const ChatInput = ({
126127
className="absolute top-0 left-0 right-0 mx-auto mb-3 flex w-fit items-center gap-3 rounded border border-neutral-200 bg-white py-2 px-4 text-black hover:opacity-50 dark:border-neutral-600 dark:bg-[#343541] dark:text-white md:mb-0 md:mt-2"
127128
onClick={onRegenerate}
128129
>
129-
<IconRepeat size={16} /> {'Regenerate response'}
130+
<IconRepeat size={16} />
131+
Regenerate response
130132
</button>
131133
)}
132134

src/components/Chat/ChatMessage.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,7 @@ export interface Props {
2525
export const ChatMessage: FC<Props> = memo(
2626
({ message, messageIndex, onEdit }) => {
2727
const {
28-
state: {
29-
selectedConversation,
30-
conversations,
31-
currentMessage,
32-
messageIsStreaming,
33-
},
28+
state: { selectedConversation, conversations, messageIsStreaming },
3429
dispatch: homeDispatch,
3530
} = useContext(ReactStreamChatContext)
3631

src/components/Chat/Regenerate.tsx

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/components/Markdown/CodeBlock.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
import { IconCheck, IconClipboard } from '@tabler/icons-react';
2-
import { FC, memo, useState } from 'react';
3-
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
4-
import { oneDark } from 'react-syntax-highlighter/dist/cjs/styles/prism';
1+
import { IconCheck, IconClipboard } from '@tabler/icons-react'
2+
import { FC, memo, useState } from 'react'
3+
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'
4+
import { oneDark } from 'react-syntax-highlighter/dist/esm/styles/prism'
55

66
interface Props {
7-
language: string;
8-
value: string;
7+
language: string
8+
value: string
99
}
1010

1111
export const CodeBlock: FC<Props> = memo(({ language, value }) => {
12-
const [isCopied, setIsCopied] = useState<Boolean>(false);
12+
const [isCopied, setIsCopied] = useState<Boolean>(false)
1313

1414
const copyToClipboard = () => {
1515
if (!navigator.clipboard || !navigator.clipboard.writeText) {
16-
return;
16+
return
1717
}
1818

1919
navigator.clipboard.writeText(value).then(() => {
20-
setIsCopied(true);
20+
setIsCopied(true)
2121

2222
setTimeout(() => {
23-
setIsCopied(false);
24-
}, 2000);
25-
});
26-
};
23+
setIsCopied(false)
24+
}, 2000)
25+
})
26+
}
2727

2828
return (
2929
<div className="codeblock relative font-sans text-[16px]">
@@ -49,6 +49,6 @@ export const CodeBlock: FC<Props> = memo(({ language, value }) => {
4949
{value}
5050
</SyntaxHighlighter>
5151
</div>
52-
);
53-
});
54-
CodeBlock.displayName = 'CodeBlock';
52+
)
53+
})
54+
CodeBlock.displayName = 'CodeBlock'

src/components/ReactStreamChat/index.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,19 @@ import {
1212
} from '@/utils/app/conversation'
1313
import { Conversation } from '@/types/chat'
1414
import { KeyValuePair } from '@/types/data'
15-
import { OpenAIModelID, OpenAIModels } from '@/types/openai'
15+
import { OpenAIModels } from '@/types/openai'
1616
import { Chat } from '@/components/Chat/Chat'
1717
import { ReactStreamChatContext } from './context'
1818
import { ReactStreamChatInitialState, initialState } from './state'
1919
import { v4 as uuidv4 } from 'uuid'
2020

21-
const defaultModelId = OpenAIModelID.GPT_3_5
22-
2321
export const ReactStreamChat = () => {
2422
const contextValue = useCreateReducer<ReactStreamChatInitialState>({
2523
initialState,
2624
})
2725

2826
const {
29-
state: { lightMode, conversations, selectedConversation },
27+
state: { conversations, selectedConversation, defaultModelId },
3028
dispatch,
3129
} = contextValue
3230

@@ -144,7 +142,7 @@ export const ReactStreamChat = () => {
144142
>
145143
{selectedConversation && (
146144
<main
147-
className={`flex h-screen w-screen flex-col text-sm text-white dark:text-white ${lightMode}`}
145+
className={`flex h-screen w-screen flex-col text-sm text-white dark:text-white dark`}
148146
>
149147
<div className="flex h-full w-full pt-[48px] sm:pt-0">
150148
<div className="flex flex-1">
Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,20 @@
11
import { Conversation, Message } from '@/types/chat'
2-
import { OpenAIModel, OpenAIModelID } from '@/types/openai'
2+
import { OpenAIModelID } from '@/types/openai'
33

44
export interface ReactStreamChatInitialState {
55
loading: boolean
6-
lightMode: 'light' | 'dark'
76
messageIsStreaming: boolean
8-
models: OpenAIModel[]
97
conversations: Conversation[]
108
selectedConversation: Conversation | undefined
119
currentMessage: Message | undefined
12-
temperature: number
13-
showPromptbar: boolean
14-
messageError: boolean
15-
searchTerm: string
16-
defaultModelId: OpenAIModelID | undefined
10+
defaultModelId: OpenAIModelID
1711
}
1812

1913
export const initialState: ReactStreamChatInitialState = {
2014
loading: false,
21-
lightMode: 'dark',
2215
messageIsStreaming: false,
23-
models: [],
2416
conversations: [],
2517
selectedConversation: undefined,
2618
currentMessage: undefined,
27-
temperature: 1,
28-
showPromptbar: true,
29-
messageError: false,
30-
searchTerm: '',
31-
defaultModelId: undefined,
19+
defaultModelId: OpenAIModelID.GPT_3_5,
3220
}

src/types/chat.ts

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,18 @@
1-
import { OpenAIModel } from './openai';
1+
import { OpenAIModel } from './openai'
22

33
export interface Message {
4-
role: Role;
5-
content: string;
4+
role: Role
5+
content: string
66
}
77

8-
export type Role = 'assistant' | 'user';
9-
10-
export interface ChatBody {
11-
model: OpenAIModel;
12-
messages: Message[];
13-
key: string;
14-
prompt: string;
15-
temperature: number;
16-
}
8+
export type Role = 'assistant' | 'user'
179

1810
export interface Conversation {
19-
id: string;
20-
name: string;
21-
messages: Message[];
22-
model: OpenAIModel;
23-
prompt: string;
24-
temperature: number;
25-
folderId: string | null;
11+
id: string
12+
name: string
13+
messages: Message[]
14+
model: OpenAIModel
15+
prompt: string
16+
temperature: number
17+
folderId: string | null
2618
}

0 commit comments

Comments
 (0)