gpt-engineer-app[bot] commited on
Commit Β·
9bb3b7a
1
Parent(s): 68809c8
Changes
Browse files
src/server/forensic.functions.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { createServerFn } from "@tanstack/react-start";
|
|
| 2 |
import { z } from "zod";
|
| 3 |
import { sanitize, restore } from "./branch-debug.functions";
|
| 4 |
import { requireSupabaseAuth } from "@/integrations/supabase/auth-middleware";
|
| 5 |
-
import {
|
| 6 |
|
| 7 |
// βββββββββββββββββββββββββ SSRF Guard βββββββββββββββββββββββββ
|
| 8 |
// Reject loopback, private (RFC1918), link-local, and cloud metadata addresses
|
|
@@ -497,19 +497,14 @@ export const runForensicStage = createServerFn({ method: "POST" })
|
|
| 497 |
if (logsS) userParts.push(`\n\nSYSTEM LOGS (anonymized):\n${logsS.sanitized.slice(0, 40_000)}`);
|
| 498 |
if (bagS) userParts.push(`\n\nROS BAG / SENSOR DATA (anonymized):\n${bagS.sanitized.slice(0, 40_000)}`);
|
| 499 |
|
| 500 |
-
const resp = await
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
|
| 508 |
-
],
|
| 509 |
-
tools,
|
| 510 |
-
tool_choice: { type: "function", function: { name: toolName } },
|
| 511 |
-
}),
|
| 512 |
-
});
|
| 513 |
|
| 514 |
if (!resp.ok) {
|
| 515 |
const text = await resp.text();
|
|
|
|
| 2 |
import { z } from "zod";
|
| 3 |
import { sanitize, restore } from "./branch-debug.functions";
|
| 4 |
import { requireSupabaseAuth } from "@/integrations/supabase/auth-middleware";
|
| 5 |
+
import { fetchAIWithFallback, getAIConfig } from "./ai-config";
|
| 6 |
|
| 7 |
// βββββββββββββββββββββββββ SSRF Guard βββββββββββββββββββββββββ
|
| 8 |
// Reject loopback, private (RFC1918), link-local, and cloud metadata addresses
|
|
|
|
| 497 |
if (logsS) userParts.push(`\n\nSYSTEM LOGS (anonymized):\n${logsS.sanitized.slice(0, 40_000)}`);
|
| 498 |
if (bagS) userParts.push(`\n\nROS BAG / SENSOR DATA (anonymized):\n${bagS.sanitized.slice(0, 40_000)}`);
|
| 499 |
|
| 500 |
+
const resp = await fetchAIWithFallback(JSON.stringify({
|
| 501 |
+
messages: [
|
| 502 |
+
{ role: "system", content: STAGE_PROMPTS[data.stage] },
|
| 503 |
+
{ role: "user", content: userParts.join("") },
|
| 504 |
+
],
|
| 505 |
+
tools,
|
| 506 |
+
tool_choice: { type: "function", function: { name: toolName } },
|
| 507 |
+
}), "google/gemini-2.5-flash", `forensicStage${data.stage}`);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 508 |
|
| 509 |
if (!resp.ok) {
|
| 510 |
const text = await resp.text();
|