Skip to content

Commit 21741ca

Browse files
committed
refact chat
1 parent 5646bde commit 21741ca

File tree

3 files changed

+2063
-1853
lines changed

3 files changed

+2063
-1853
lines changed

src/App.tsx

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import React from "react";
22
import { usePolyfire } from "polyfire-js/hooks";
33
import Chat, { useChatContext } from "@polyfire-ai/chat-ui";
4-
import { ChatOptions } from "polyfire-js/chats";
54

6-
const ChatUI = () => {
5+
const App: React.FC = () => {
76
const { auth } = usePolyfire();
87
const { utils, chat } = useChatContext();
98

@@ -36,16 +35,4 @@ const ChatUI = () => {
3635
);
3736
};
3837

39-
const options: ChatOptions = {
40-
systemPrompt: "Repond moi en Russe",
41-
};
42-
43-
const App: React.FC = () => {
44-
return (
45-
<Chat.Root baseChatColor="#4682B4" options={options}>
46-
<ChatUI />
47-
</Chat.Root>
48-
);
49-
};
50-
5138
export default App;

src/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React from "react";
22
import ReactDOM from "react-dom/client";
33
import App from "./App";
4+
import Chat from "@polyfire-ai/chat-ui";
5+
46
import reportWebVitals from "./reportWebVitals";
57
import { PolyfireProvider } from "polyfire-js/hooks";
68

@@ -14,7 +16,9 @@ const root = ReactDOM.createRoot(
1416

1517
root.render(
1618
<PolyfireProvider project={process.env.REACT_APP_POLYFIRE_PROJECT as string}>
17-
<App />
19+
<Chat.Root baseChatColor="#4682B4">
20+
<App />
21+
</Chat.Root>
1822
</PolyfireProvider>
1923
);
2024

0 commit comments

Comments
 (0)