klg-asutk-app/components/settings/AIAccessSettings.tsx
Yuriy 44b14cc4fd feat: все AI-функции переведены на Anthropic Claude API
- ai_service.py: единый AI-сервис (chat, chat_with_history, analyze_document)
- routes/ai.py: POST /api/v1/ai/chat (chat, summarize, extract_risks, classify, translate)
- config.py: ANTHROPIC_API_KEY, ANTHROPIC_MODEL
- requirements.txt: anthropic>=0.42.0
- api-client.ts: aiApi (chat, summarize, extractRisks)
- CSP: connect-src добавлен https://api.anthropic.com
- app/api/ai-chat: прокси на бэкенд /api/v1/ai/chat (Anthropic)
- legal_agents/llm_client.py: переведён на ai_service (Claude)
- AIAccessSettings: только Claude (Sonnet 4, 3 Sonnet, 3 Opus)
- k8s, .env.example: OPENAI → ANTHROPIC
- package.json: удалена зависимость openai
- Документация: OpenAI/GPT заменены на Claude/Anthropic

Провайдер: исключительно Anthropic Claude
Модель по умолчанию: claude-sonnet-4-20250514

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-15 15:51:59 +03:00

35 lines
1.6 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use client';
import { useState } from 'react';
import FormField from '@/components/ui/FormField';
interface Props { onSave?: (s: any) => void; }
export default function AIAccessSettings({ onSave }: Props) {
const [model, setModel] = useState('claude-3-sonnet');
const [enabled, setEnabled] = useState(true);
const [maxTokens, setMaxTokens] = useState(4096);
return (
<div className="space-y-4">
<h3 className="text-lg font-bold">AI Настройки</h3>
<FormField label="AI Ассистент">
<label className="flex items-center gap-2 cursor-pointer">
<input type="checkbox" checked={enabled} onChange={e => setEnabled(e.target.checked)} className="w-4 h-4" />
<span className="text-sm">Включить AI ассистент</span>
</label>
</FormField>
<FormField label="Модель">
<select value={model} onChange={e => setModel(e.target.value)} className="input-field" disabled={!enabled}>
<option value="claude-sonnet-4-20250514">Claude Sonnet 4</option>
<option value="claude-3-sonnet">Claude 3 Sonnet</option>
<option value="claude-3-opus">Claude 3 Opus</option>
</select>
</FormField>
<FormField label="Макс. токенов">
<input type="number" value={maxTokens} onChange={e => setMaxTokens(+e.target.value)} className="input-field w-32" min={256} max={32768} disabled={!enabled} />
</FormField>
<button onClick={() => onSave?.({ model, enabled, maxTokens })} className="btn-primary" disabled={!enabled}>Сохранить</button>
</div>
);
}