refactor: rename swift → cortex in code and documentation
Complete rename of "swift" terminology to "cortex" across the codebase: Code Changes: - Rename directories: lib/swift → lib/cortex, components/swift → components/cortex - Rename API routes: /api/swift/* → /api/cortex/* - Rename page routes: /epd/swift → /epd/cortex - Rename store: swift-store.ts → cortex-store.ts Type Renames: - SwiftIntent → CortexIntent - SwiftStore → CortexStore - useSwiftStore → useCortexStore - SwiftContext → CortexContext - useSwiftVoice → useCortexVoice Documentation Updates (docs/intent/): - Safety Net → Nudge (Layer 3 rename) - SafetySuggestion → NudgeSuggestion - evaluateSafetyNet → evaluateNudge - SWIFT_* feature flags → CORTEX_* - All path references updated to match new structure Files affected: 47 files, ~700 lines changed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
/**
|
||||
* Swift Chat API Route (v3.0)
|
||||
* Cortex Chat API Route (v3.0)
|
||||
*
|
||||
* Streaming chat endpoint voor Swift Assistent met Server-Sent Events (SSE).
|
||||
* Streaming chat endpoint voor Cortex Assistent met Server-Sent Events (SSE).
|
||||
*
|
||||
* Epic: E3 (Chat API & Swift Assistent)
|
||||
* Epic: E3 (Chat API & Cortex Assistent)
|
||||
* Story: E3.S1 (Chat API endpoint skeleton)
|
||||
*/
|
||||
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { z } from 'zod';
|
||||
import { getSession } from '@/lib/auth/server';
|
||||
import type { ChatMessage as ChatMessageType, ChatAction } from '@/stores/swift-store';
|
||||
import type { ChatMessage as ChatMessageType, ChatAction } from '@/stores/cortex-store';
|
||||
|
||||
// Configuration
|
||||
const SWIFT_MODEL = process.env.SWIFT_MODEL ?? 'claude-sonnet-4-20250514';
|
||||
const CORTEX_MODEL = process.env.CORTEX_MODEL ?? 'claude-sonnet-4-20250514';
|
||||
const MAX_HISTORY_MESSAGES = 20;
|
||||
const MAX_USER_MESSAGE_LENGTH = 2000;
|
||||
|
||||
@@ -76,7 +76,7 @@ const RequestSchema = z.object({
|
||||
type RequestData = z.infer<typeof RequestSchema>;
|
||||
|
||||
/**
|
||||
* Build Swift Assistent system prompt (E3.S3)
|
||||
* Build Cortex Assistent system prompt (E3.S3)
|
||||
* Full prompt with intent detection, entity extraction, and action generation
|
||||
*/
|
||||
function buildSystemPrompt(context?: RequestData['context']): string {
|
||||
@@ -92,7 +92,7 @@ function buildSystemPrompt(context?: RequestData['context']): string {
|
||||
|
||||
const shiftContext = context?.shift ?? 'ochtend';
|
||||
|
||||
return `Je bent Swift Assistent, een medische assistent voor Swift EPD, een Nederlands EPD-systeem voor GGZ-instellingen.
|
||||
return `Je bent Cortex Assistent, een medische assistent voor Cortex EPD, een Nederlands EPD-systeem voor GGZ-instellingen.
|
||||
|
||||
## Je rol
|
||||
|
||||
@@ -524,7 +524,7 @@ export async function POST(request: NextRequest) {
|
||||
// 4. Prepare conversation history (limit to last N messages)
|
||||
const history = messages.slice(-MAX_HISTORY_MESSAGES);
|
||||
|
||||
// 5. Build Swift Assistent system prompt (E3.S3)
|
||||
// 5. Build Cortex Assistent system prompt (E3.S3)
|
||||
const systemPrompt = buildSystemPrompt(context);
|
||||
|
||||
// 6. Check for Claude API key
|
||||
@@ -543,7 +543,7 @@ export async function POST(request: NextRequest) {
|
||||
Accept: 'text/event-stream',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
model: SWIFT_MODEL,
|
||||
model: CORTEX_MODEL,
|
||||
max_tokens: 2048,
|
||||
temperature: 0.7,
|
||||
stream: true,
|
||||
@@ -667,7 +667,7 @@ export async function POST(request: NextRequest) {
|
||||
return NextResponse.json({ error: 'Ongeldige JSON payload' }, { status: 400 });
|
||||
}
|
||||
|
||||
console.error('Swift chat endpoint error:', error);
|
||||
console.error('Cortex chat endpoint error:', error);
|
||||
return NextResponse.json({ error: 'Onverwachte serverfout' }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -8,10 +8,10 @@
|
||||
import { createClient } from '@/lib/auth/server';
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { z } from 'zod';
|
||||
import { classifyIntent, isHighConfidence } from '@/lib/swift/intent-classifier';
|
||||
import { classifyIntentWithAI } from '@/lib/swift/intent-classifier-ai';
|
||||
import { extractEntities } from '@/lib/swift/entity-extractor';
|
||||
import type { IntentClassificationResult } from '@/lib/swift/types';
|
||||
import { classifyIntent, isHighConfidence } from '@/lib/cortex/intent-classifier';
|
||||
import { classifyIntentWithAI } from '@/lib/cortex/intent-classifier-ai';
|
||||
import { extractEntities } from '@/lib/cortex/entity-extractor';
|
||||
import type { IntentClassificationResult } from '@/lib/cortex/types';
|
||||
|
||||
// Request schema
|
||||
const ClassifyRequestSchema = z.object({
|
||||
|
||||
Reference in New Issue
Block a user