Skip to content

Commit 5fd5d2c

Browse files
authored
Merge pull request #21 from devchat-ai/feat/fixregeneration
Refactor RegenerationButton component and reset error message in Chat…
2 parents 369e5e6 + 5753849 commit 5fd5d2c

File tree

2 files changed

+39
-37
lines changed

2 files changed

+39
-37
lines changed
Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,44 @@
1-
2-
import * as React from 'react';
3-
import { Button } from '@mantine/core';
4-
import { IconRotateDot } from '@tabler/icons-react';
1+
import * as React from "react";
2+
import { Button } from "@mantine/core";
3+
import { IconRotateDot } from "@tabler/icons-react";
54
import { observer } from "mobx-react-lite";
65
import { useMst } from "@/views/stores/RootStore";
76

8-
97
const RegenerationButton = observer(() => {
10-
const { chat } = useMst();
11-
return (<Button
12-
size='xs'
13-
sx={{
14-
backgroundColor:"#ED6A45",
15-
fontFamily: 'var(--vscode-editor-font-familyy)',
16-
fontSize: 'var(--vscode-editor-font-size)',
17-
color:"#fff",
18-
"&:hover":{
19-
backgroundColor:"#ED6A45",
20-
opacity: 0.8,
21-
},
22-
"&:focus":{
23-
backgroundColor:"#ED6A45",
24-
opacity: 0.8,
25-
}
26-
}}
27-
styles={{
28-
icon: {
29-
color:"#fff",
30-
},
31-
label: {
32-
fontSize: 'var(--vscode-editor-font-size)',
33-
color:"#fff",
34-
}
35-
}}
36-
leftIcon={<IconRotateDot color='var(--vscode-button-foreground)' />}
37-
onClick={() => chat.reGenerating()}
38-
variant="white" >
39-
Regeneration
40-
</Button >);
8+
const { chat } = useMst();
9+
return (
10+
<Button
11+
size="xs"
12+
sx={{
13+
backgroundColor: "#ED6A45",
14+
fontFamily: "var(--vscode-editor-font-familyy)",
15+
fontSize: "var(--vscode-editor-font-size)",
16+
color: "#fff",
17+
"&:hover": {
18+
backgroundColor: "#ED6A45",
19+
opacity: 0.8,
20+
},
21+
"&:focus": {
22+
backgroundColor: "#ED6A45",
23+
opacity: 0.8,
24+
},
25+
}}
26+
styles={{
27+
icon: {
28+
color: "#fff",
29+
},
30+
label: {
31+
fontSize: "var(--vscode-editor-font-size)",
32+
color: "#fff",
33+
},
34+
}}
35+
leftIcon={<IconRotateDot color="#fff" />}
36+
onClick={() => chat.reGenerating()}
37+
variant="white"
38+
>
39+
Regeneration
40+
</Button>
41+
);
4142
});
4243

43-
export default RegenerationButton;
44+
export default RegenerationButton;

src/views/stores/ChatStore.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ Thinking...
403403
self.isLastPage = true;
404404
if (reset) {
405405
self.messages = [] as any;
406+
self.errorMessage = "";
406407
}
407408
if (self.messages.length === 0) {
408409
helpMessage(true);

0 commit comments

Comments
 (0)