Initial commit: RA-H Open Source Edition
Local-first knowledge management system with BYO API keys. Features: - 3-panel UI (Nodes | Focus | Helpers) - SQLite + sqlite-vec for vector search - Agent system (Easy/Hard mode orchestrators) - Content extraction (YouTube, PDF, web) - Integrate workflow for connection discovery - Dimension system with auto-assignment Tech stack: - Next.js 15 + TypeScript + Tailwind CSS - Anthropic (Claude) + OpenAI (GPT) via Vercel AI SDK Setup: npm install && npm rebuild better-sqlite3 scripts/dev/bootstrap-local.sh npm run dev MIT License
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
"use client";
|
||||
|
||||
export async function openExternalUrl(url: string) {
|
||||
if (typeof window === "undefined") return;
|
||||
|
||||
try {
|
||||
const newWindow = window.open(url, "_blank", "noopener,noreferrer");
|
||||
if (!newWindow) {
|
||||
window.location.href = url;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("[external] window.open failed", error);
|
||||
window.location.href = url;
|
||||
}
|
||||
}
|
||||
|
||||
export function shouldOpenExternally(rawUrl: string) {
|
||||
if (typeof window === "undefined") return false;
|
||||
|
||||
try {
|
||||
const resolved = new URL(rawUrl, window.location.href);
|
||||
if (!["http:", "https:"].includes(resolved.protocol)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const localhostHosts = new Set([
|
||||
window.location.hostname,
|
||||
"127.0.0.1",
|
||||
"localhost",
|
||||
"0.0.0.0",
|
||||
]);
|
||||
|
||||
return !localhostHosts.has(resolved.hostname);
|
||||
} catch (error) {
|
||||
console.error("[external] failed to parse url", rawUrl, error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user