Skip to content

Commit c56df26

Browse files
committed
move regenerate button to its own file
1 parent 0c319fb commit c56df26

File tree

10 files changed

+50
-27
lines changed

10 files changed

+50
-27
lines changed

dist/components/bubbles/BotBubble.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/components/buttons/FeedbackButtons.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@ type RatingButtonProps = {
99
export declare const CopyToClipboardButton: (props: RatingButtonProps) => JSX.Element;
1010
export declare const ThumbsUpButton: (props: RatingButtonProps) => JSX.Element;
1111
export declare const ThumbsDownButton: (props: RatingButtonProps) => JSX.Element;
12-
export declare const RegenerateResponseButton: (props: RatingButtonProps) => JSX.Element;
1312
export {};
1413
//# sourceMappingURL=FeedbackButtons.d.ts.map

dist/components/buttons/FeedbackButtons.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { JSX } from 'solid-js';
2+
type RegenerateResponseButtonProps = {
3+
feedbackColor?: string;
4+
isDisabled?: boolean;
5+
isLoading?: boolean;
6+
disableIcon?: boolean;
7+
} & JSX.ButtonHTMLAttributes<HTMLButtonElement>;
8+
export declare const RegenerateResponseButton: (props: RegenerateResponseButtonProps) => JSX.Element;
9+
export {};
10+
//# sourceMappingURL=RegenerateResponseButton.d.ts.map

dist/components/buttons/RegenerateResponseButton.d.ts.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/web.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/web.umd.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/bubbles/BotBubble.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { Marked } from '@ts-stack/markdown';
44
import DOMPurify from 'dompurify';
55
import { FeedbackRatingType, sendFeedbackQuery, sendFileDownloadQuery, updateFeedbackQuery } from '@/queries/sendMessageQuery';
66
import { FileUpload, IAction, MessageType } from '../Bot';
7-
import { CopyToClipboardButton, RegenerateResponseButton, ThumbsDownButton, ThumbsUpButton } from '../buttons/FeedbackButtons';
7+
import { CopyToClipboardButton, ThumbsDownButton, ThumbsUpButton } from '../buttons/FeedbackButtons';
8+
import { RegenerateResponseButton } from '../buttons/RegenerateResponseButton';
89
import { TTSButton } from '../buttons/TTSButton';
910
import FeedbackContentDialog from '../FeedbackContentDialog';
1011
import { AgentReasoningBubble } from './AgentReasoningBubble';

src/components/buttons/FeedbackButtons.tsx

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { JSX, Show } from 'solid-js';
22
import { Spinner } from './SendButton';
3-
import { ClipboardIcon, DeleteIcon as RefreshIcon, ThumbsDownIcon, ThumbsUpIcon } from '../icons';
3+
import { ClipboardIcon, ThumbsDownIcon, ThumbsUpIcon } from '../icons';
44

55
type RatingButtonProps = {
66
feedbackColor?: string;
@@ -70,23 +70,3 @@ export const ThumbsDownButton = (props: RatingButtonProps) => {
7070
</button>
7171
);
7272
};
73-
74-
export const RegenerateResponseButton = (props: RatingButtonProps) => {
75-
return (
76-
<button
77-
type="button"
78-
disabled={props.isDisabled || props.isLoading}
79-
{...props}
80-
class={
81-
'p-2 justify-center font-semibold text-white focus:outline-none flex items-center disabled:opacity-50 disabled:cursor-not-allowed disabled:brightness-100 transition-all filter hover:brightness-90 active:brightness-75 chatbot-button ' +
82-
props.class
83-
}
84-
style={{ background: 'transparent', border: 'none' }}
85-
title="Regenerate response"
86-
>
87-
<Show when={!props.isLoading} fallback={<Spinner class="text-white" />}>
88-
<RefreshIcon color={props.feedbackColor ?? defaultFeedbackColor} class={'send-icon flex ' + (props.disableIcon ? 'hidden' : '')} />
89-
</Show>
90-
</button>
91-
);
92-
};
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { JSX, Show } from 'solid-js';
2+
import { Spinner } from './SendButton';
3+
import { DeleteIcon as RefreshIcon } from '../icons';
4+
5+
type RegenerateResponseButtonProps = {
6+
feedbackColor?: string;
7+
isDisabled?: boolean;
8+
isLoading?: boolean;
9+
disableIcon?: boolean;
10+
} & JSX.ButtonHTMLAttributes<HTMLButtonElement>;
11+
12+
const defaultFeedbackColor = '#3B81F6';
13+
14+
export const RegenerateResponseButton = (props: RegenerateResponseButtonProps) => {
15+
return (
16+
<button
17+
type="button"
18+
disabled={props.isDisabled || props.isLoading}
19+
{...props}
20+
class={
21+
'p-2 justify-center font-semibold text-white focus:outline-none flex items-center disabled:opacity-50 disabled:cursor-not-allowed disabled:brightness-100 transition-all filter hover:brightness-90 active:brightness-75 chatbot-button ' +
22+
props.class
23+
}
24+
style={{ background: 'transparent', border: 'none' }}
25+
title="Regenerate response"
26+
>
27+
<Show when={!props.isLoading} fallback={<Spinner class="text-white" />}>
28+
<RefreshIcon color={props.feedbackColor ?? defaultFeedbackColor} class={'send-icon flex ' + (props.disableIcon ? 'hidden' : '')} />
29+
</Show>
30+
</button>
31+
);
32+
};

0 commit comments

Comments
 (0)