Alexej Wolff 68c2b129fa Major refactor: security, performance, and code organization
Security:
- DeepSeek API moved to server-side proxy with rate limiting (20 req/min)
- Whitelist validation for all POST/PUT routes
- Cookie security (secure, sameSite, httpOnly in production)
- Input validation for messages, tokens, temperature
- Sanitized hasOwnProperty to prevent prototype pollution

Performance:
- Lazy loading for chat messages (sliding window of 20)
- Streaming response throttling (50ms batches)
- Scroll optimization (only scroll on new messages)
- AbortController fix for stop button

Code organization:
- GamePage refactored from ~1170 to ~750 lines
- New hooks: useGameSession, useStreamingResponse, useCharacterDetection, useLazyMessages
- New components: MessageList, ChatInput, SessionSelector, CharacterPanel
- Fixed ESLint errors

Features:
- OOC mode button for direct AI instructions
- Message versions (aiResponse) now persist to DB
- playerId saved in sessions
2026-05-05 23:41:52 +02:00
2026-02-11 01:11:36 +01:00
2026-02-11 00:15:59 +01:00
2026-02-11 00:15:59 +01:00
2026-02-11 00:15:59 +01:00
2026-02-11 00:15:59 +01:00
2026-02-11 00:15:59 +01:00
2026-02-11 00:15:59 +01:00

ReSekai

ReSekai — интерактивная платформа для создания и прохождения текстовых ролевых историй с AI-персонажами.

🌐 Демо: resekai.draug.me

Возможности

  • 📖 Создание историй — описывайте сеттинг, персонажей и стартовую сцену
  • 🎭 AI-персонажи — уникальные характеры с настраиваемыми личностями
  • 💬 Интерактивный чат — общайтесь с персонажами в реальном времени (streaming)
  • 🎨 Настройка креативности — выбирайте температуру генерации (0.9–1.05)
  • 💾 Сохранение прогресса — истории хранятся локально в браузере
  • 📱 Адаптивный дизайн — работает на десктопе и мобильных устройствах

Технологии

Frontend

  • React 18 + TypeScript
  • Vite
  • CSS (без фреймворков)

Backend

  • Express.js (прокси-сервер)
  • DeepSeek API (модель deepseek-chat V3)

Установка

# Клонировать репозиторий
git clone https://git.draug.me/draug/resekai.git
cd resekai

# Установить зависимости
npm install
cd server && npm install && cd ..

# Настроить backend (скопировать .env.example и заполнить)
# Обязательно указать DEEPSEEK_API_KEY в server/.env

# Запустить в режиме разработки
npm run dev          # Frontend (порт 5173)
cd server && node index.js  # Backend (порт 3001)

Структура проекта

src/
├── components/     # Header, Footer
├── contexts/       # AuthContext
├── pages/          # Страницы приложения
│   ├── StoriesPage     # Список историй
│   ├── CreateStoryPage # Создание/редактирование
│   ├── GamePage        # Игровой чат
│   └── CharactersPage  # Управление персонажами
├── services/       # API, DeepSeek, Storage
└── types/          # TypeScript типы
server/
└── index.js        # Express прокси для DeepSeek API

Лицензия

MIT

S
Description
No description provided
Readme 1,006 KiB
Languages
TypeScript 65%
CSS 22.7%
JavaScript 11.9%
HTML 0.4%