fix(tools):use authenticated tool requests

This commit is contained in:
Anish Sarkar 2026-06-24 03:59:34 +05:30
parent 83ee9aa7ea
commit 9b982f575a
4 changed files with 7 additions and 6 deletions

View file

@ -12,7 +12,7 @@ import { TextShimmerLoader } from "@/components/prompt-kit/loader";
import { Button } from "@/components/ui/button";
import { useMediaQuery } from "@/hooks/use-media-query";
import { baseApiService } from "@/lib/apis/base-api.service";
import { getAuthHeaders } from "@/lib/auth-utils";
import { getAuthHeaders } from "@/lib/auth-fetch";
import { buildBackendUrl } from "@/lib/env-config";
pdfjsLib.GlobalWorkerOptions.workerSrc = new URL(

View file

@ -13,7 +13,7 @@ import {
} from "@/components/ui/accordion";
import { baseApiService } from "@/lib/apis/base-api.service";
import { podcastsApiService } from "@/lib/apis/podcasts-api.service";
import { authenticatedFetch } from "@/lib/auth-utils";
import { authenticatedFetch } from "@/lib/auth-fetch";
import { buildBackendUrl } from "@/lib/env-config";
import { speakerLabel } from "./schema";

View file

@ -16,7 +16,7 @@ import { z } from "zod";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
import { getBearerToken } from "@/lib/auth-utils";
import { getDesktopAccessToken } from "@/lib/auth-fetch";
import { buildBackendUrl } from "@/lib/env-config";
import { cn } from "@/lib/utils";
@ -157,12 +157,13 @@ function truncateCommand(command: string, maxLen = 80): string {
// ============================================================================
async function downloadSandboxFile(threadId: string, filePath: string, fileName: string) {
const token = getBearerToken();
const token = await getDesktopAccessToken();
const url = buildBackendUrl(`/api/v1/threads/${threadId}/sandbox/download`, {
path: filePath,
});
const res = await fetch(url, {
headers: { Authorization: `Bearer ${token || ""}` },
headers: token ? { Authorization: `Bearer ${token}` } : undefined,
credentials: "include",
});
if (!res.ok) {
throw new Error(`Download failed: ${res.statusText}`);

View file

@ -9,7 +9,7 @@ import { z } from "zod";
import { TextShimmerLoader } from "@/components/prompt-kit/loader";
import { Button } from "@/components/ui/button";
import { baseApiService } from "@/lib/apis/base-api.service";
import { authenticatedFetch } from "@/lib/auth-utils";
import { authenticatedFetch } from "@/lib/auth-fetch";
import { buildBackendUrl } from "@/lib/env-config";
import { compileCheck, compileToComponent } from "@/lib/remotion/compile-check";
import { FPS } from "@/lib/remotion/constants";