Skip to content

Commit fc064e9

Browse files
committed
2 parents 258d864 + ca26d26 commit fc064e9

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

course-matrix/frontend/src/pages/Assistant/assistant.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { SERVER_URL } from "@/api/config";
66
import { RuntimeProvider } from "./runtime-provider";
77

88
export const Assistant = () => {
9-
109
return (
1110
<RuntimeProvider>
1211
<div className="grid h-dvh grid-cols-[200px_1fr] gap-x-2 px-4 py-4">

course-matrix/frontend/src/pages/Assistant/runtime-provider.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ import { SERVER_URL } from "@/api/config";
22
import { AssistantCloud, AssistantRuntimeProvider } from "@assistant-ui/react";
33
import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
44

5-
const PUBLIC_ASSISTANT_BASE_URL = import.meta.env.VITE_PUBLIC_ASSISTANT_BASE_URL;
5+
const PUBLIC_ASSISTANT_BASE_URL = import.meta.env
6+
.VITE_PUBLIC_ASSISTANT_BASE_URL;
67
const ASSISTANT_UI_KEY = import.meta.env.VITE_ASSISTANT_UI_KEY;
78

8-
const user = JSON.parse(localStorage.getItem("userInfo") ?? "{}")
9-
const userId = (user?.user?.id);
9+
const user = JSON.parse(localStorage.getItem("userInfo") ?? "{}");
10+
const userId = user?.user?.id;
1011

1112
const getAuthToken = async () => {
1213
const client = new AssistantCloud({
@@ -15,16 +16,16 @@ const getAuthToken = async () => {
1516
workspaceId: userId,
1617
});
1718
const { token } = await client.auth.tokens.create();
18-
return token
19-
}
19+
return token;
20+
};
2021

2122
const cloud = new AssistantCloud({
2223
baseUrl: PUBLIC_ASSISTANT_BASE_URL!,
2324
// authToken: () =>
2425
// fetch("/api/assistant-ui-token", { method: "POST" })
2526
// .then((r) => r.json())
2627
// .then((r) => r.token),
27-
authToken: () => getAuthToken()
28+
authToken: () => getAuthToken(),
2829
});
2930

3031
export function RuntimeProvider({
@@ -42,4 +43,4 @@ export function RuntimeProvider({
4243
{children}
4344
</AssistantRuntimeProvider>
4445
);
45-
}
46+
}

0 commit comments

Comments
 (0)