Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(chatgpt): add missing chatgptOauthCheckToken binding + ChatGptPanel TS errors

Louis Beaumontf39cb92e031c
diff --git a/apps/screenpipe-app-tauri/components/settings/connections-section.tsx b/apps/screenpipe-app-tauri/components/settings/connections-section.tsx
index 538fba2ba..668a64ac0 100644
--- a/apps/screenpipe-app-tauri/components/settings/connections-section.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/connections-section.tsx
@@ -16,6 +16,7 @@ import { Download, ExternalLink, Check, Loader2, Copy, Terminal, Lock, LogIn, Lo
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
import { commands } from "@/lib/utils/tauri";
import { useSettings } from "@/lib/hooks/use-settings";
+import { useToast } from "@/components/ui/use-toast";
import { ensureChatGptPreset } from "@/lib/utils/chatgpt-preset";
import { notifyConnectionsUpdated } from "@/lib/connections-events";
import { CONNECTION_CATEGORY_BY_ID } from "@/lib/constants/connections";
@@ -1400,10 +1401,11 @@ function ChatGptPanel() {
// "loading" — login or logout in progress
// "logged_in" — logged in with a valid, usable token
// "expired" — logged in but token is expired and could not be auto-refreshed
- const [status, setStatus] = useState
+ const [status, setStatus] = useState<
"idle" | "checking" | "loading" | "logged_in" | "expired"
>("idle");
const { settings, updateSettings } = useSettings();
+ const { toast } = useToast();
useEffect(() => {
const check = async () => {
diff --git a/apps/screenpipe-app-tauri/lib/utils/tauri.ts b/apps/screenpipe-app-tauri/lib/utils/tauri.ts
index fff084119..e6e9703a7 100644
--- a/apps/screenpipe-app-tauri/lib/utils/tauri.ts
+++ b/apps/screenpipe-app-tauri/lib/utils/tauri.ts
@@ -1162,6 +1162,14 @@ async chatgptOauthGetToken() : Promise<Result<string, string>> {
else return { status: "error", error: e as any };
}
},
+async chatgptOauthCheckToken() : Promise<Result<boolean, string>> {
+ try {
+ return { status: "ok", data: await TAURI_INVOKE("chatgpt_oauth_check_token") };
+} catch (e) {
+ if(e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+}
+},
async chatgptOauthLogout() : Promise<Result<boolean, string>> {
try {
return { status: "ok", data: await TAURI_INVOKE("chatgpt_oauth_logout") };