klg-asutk-app/components/settings/AIAccessSettings.tsx
Yuriy aa052763f6 Безопасность и качество: 8 исправлений + обновления
- .env.example: полный шаблон, защита секретов
- .gitignore: явное исключение .env.* и секретов
- layout.tsx: XSS — заменён dangerouslySetInnerHTML на next/script для SW
- ESLint: no-console error (allow warn/error), ignore scripts/
- scripts/remove-console-logs.js: очистка console.log без glob
- backend/routes/modules: README с планом рефакторинга крупных файлов
- SECURITY.md: гид по секретам, XSS, CORS, auth, линту
- .husky/pre-commit: запуск npm run lint

+ прочие правки приложения и бэкенда

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-14 21:29:16 +03:00

34 lines
1.6 KiB
TypeScript
Raw 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-3-sonnet">Claude 3 Sonnet</option><option value="claude-3-opus">Claude 3 Opus</option>
<option value="gpt-4">GPT-4</option><option value="local">Локальная модель</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>
);
}