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,41 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import {
|
||||
getAutoContextSettings,
|
||||
setAutoContextEnabled,
|
||||
} from '@/services/settings/autoContextSettings';
|
||||
|
||||
export const runtime = 'nodejs';
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
const settings = getAutoContextSettings();
|
||||
return NextResponse.json({ success: true, data: settings });
|
||||
} catch (error) {
|
||||
console.error('Failed to read auto-context settings:', error);
|
||||
return NextResponse.json(
|
||||
{ success: false, error: 'Unable to read auto-context settings' },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export async function PUT(request: NextRequest) {
|
||||
try {
|
||||
const body = await request.json();
|
||||
if (!body || typeof body.autoContextEnabled !== 'boolean') {
|
||||
return NextResponse.json(
|
||||
{ success: false, error: 'autoContextEnabled boolean is required' },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
const updated = setAutoContextEnabled(body.autoContextEnabled);
|
||||
return NextResponse.json({ success: true, data: updated });
|
||||
} catch (error) {
|
||||
console.error('Failed to update auto-context settings:', error);
|
||||
return NextResponse.json(
|
||||
{ success: false, error: 'Unable to update auto-context settings' },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import fs from 'fs';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
|
||||
export const runtime = 'nodejs';
|
||||
|
||||
const STATUS_PATH = path.join(
|
||||
os.homedir(),
|
||||
'Library',
|
||||
'Application Support',
|
||||
'RA-H',
|
||||
'config',
|
||||
'mcp-status.json'
|
||||
);
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
if (!fs.existsSync(STATUS_PATH)) {
|
||||
return NextResponse.json({
|
||||
enabled: false,
|
||||
port: null,
|
||||
url: null,
|
||||
last_updated: null,
|
||||
target_base_url: null
|
||||
});
|
||||
}
|
||||
|
||||
const raw = fs.readFileSync(STATUS_PATH, 'utf-8');
|
||||
const parsed = JSON.parse(raw);
|
||||
return NextResponse.json(parsed);
|
||||
} catch (error) {
|
||||
console.error('Failed to read MCP status file:', error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
enabled: false,
|
||||
port: null,
|
||||
url: null,
|
||||
last_updated: null,
|
||||
target_base_url: null,
|
||||
error: 'Unable to read MCP status'
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user