Halyk Voice
Голосовой ассистент с интерфейсом на RU/KK/EN.
О проекте
Команда: MooT - cultmoot.online
Кейс HackAlem.ai: Коммуникации — Halyk Bank · кейс 2
Стадия: Рабочий MVP
Задача кейса: «Voice Router»: голосовой AI, маршрутизирующий звонки в контакт-центре страховой компании
Суть
Голосовой ассистент с интерфейсом на RU/KK/EN. Начинался как voice router по сценариям, затем превратился в read-only платформу помощи с историей диалогов, аккаунтами и голосовыми пошаговыми гайдами. Банковских операций нет.
Как устроено
Речь пользователя распознаёт gpt-4o-transcribe, короткие контекстные ответы даёт gpt-4.1-mini. Для известных навигационных и приветственных фраз модель не вызывается. Озвучка идёт через gpt-4o-mini-tts (голос Marin) потоком 24 kHz PCM в WebAudio. Router engine, policy, validator и state с каталогом сценариев остались как legacy-режим APP_MODE=demo. Аккаунты хранятся в SQLite с хешами scrypt, история шифруется Fernet. Развёртывание: Docker, Compose и Caddy.
Ключевые решения
- streaming PCM TTS
- отмена незавершённого ответа при новом вопросе
- scenario router + validator
- scrypt password hashing
- Fernet encryption
- rate limiting
Особенности
Хорошо проработана низкая задержка голоса: потоковый PCM, прерывание воспроизведения, пропуск модели для известных фраз. Продукт отошёл от кейса страхового контакт-центра в сторону банковского ассистента.
Стек
Python · React · TypeScript · Vite · SQLite · WebAudio · WebSocket · Docker · Caddy · GitHub Actions · Playwright
Модели
OpenAI gpt-4.1-mini · OpenAI gpt-4o-transcribe · OpenAI gpt-4o-mini-tts
Проект создан за 5 часов на финале хакатона HackAlem.ai (23 сентября 2026, Астана). Код — BAITC-Hacks/hack-4a297634-moot---cultmoot-online.
README
README.mdHalyk Voice · test release
Independent voice assistance platform with Russian, Kazakh and English interface, OpenAI speech recognition and a female synthesized voice. It provides conversation history and spoken step-by-step guides. It is not an official Halyk Bank service and has no access to banking accounts.
The default release uses gpt-4.1-mini for brief contextual replies, gpt-4o-transcribe for recognition and gpt-4o-mini-tts with the Marin voice. Known navigation/greeting responses avoid a model round trip. Audio streams as 24 kHz PCM into WebAudio with a short buffer; replay uses a private session cache. Starting a new spoken question stops playback and cancels an unfinished older answer. Empty recognition and connection failures return the interface to a usable state.
These are latency reductions, not a zero-latency guarantee. OpenAI availability, microphone quality and network conditions still matter. The voice is AI-generated. Voice guidance follows the OpenAI speech documentation.
Run locally on Windows
Requires Python 3.11+ and Node.js 22+. Quick setup: run ./setup.ps1, verify the local .env, then run ./start.ps1. Setup preserves an existing .env. By the owner's explicit request, this private test repository includes a configured .env. Anyone with repository access can use its API key and incur charges. Keep access restricted and configure a separate server-side key for each deployment.
- Create a Python virtual environment:
python -m venv .venv. - Install dependencies:
.venv/Scripts/python.exe -m pip install -r requirements.txt. - Use the supplied
.env, or copy.env.exampleto.envand fill in your ownOPENAI_API_KEYlocally. - In
frontend, runnpm ciandnpm run build. - Run
./start.ps1, then open http://localhost:8010 and create an account.
APP_MODE=assistant is the normal test mode: conversation and navigation, without fake balances, synthetic client identifiers, or mock transactions. Its short contextual prompt does not send the legacy scenario catalog to OpenAI. APP_MODE=demo is a legacy router test mode and must not be used as an actual bank integration. The internal scenario taxonomy does not authorize bank actions.
Accounts and data
Email/password accounts are stored in SQLite. Passwords are salted scrypt hashes. Conversation text is encrypted with a server-local Fernet key. Users can delete history, change their password and revoke all login sessions. Email address ownership is not verified; Gmail OAuth and password-reset email delivery are not configured.
Back up both runtime/accounts.sqlite3 and runtime/history.key securely. Restrict access to .env; never publish runtime files or backups. A production operator must restrict filesystem permissions and protect backups. See SECURITY.md for implemented controls and their limits.
HTTPS deployment
Dockerfile, compose.yaml and Caddyfile provide a single-worker deployment with a non-root application, persistent data and a reverse proxy. Set PUBLIC_DOMAIN to a domain you control in the deployment .env, configure DNS and make ports 80/443 reachable, then run docker compose up --build -d. No application port is published directly. Only the proxy's fixed private address is trusted for forwarded headers. If the subnet conflicts with your server network, change both the subnet/addresses and FORWARDED_ALLOW_IPS together.
These deployment files have not been exercised against a public domain in this workspace. Supply a real bank-approved API and authorization contract before adding banking operations. Infrastructure DDoS protection, email verification, MFA and an independent security assessment remain production rollout tasks.
Checks
Install requirements-dev.txt. Run .venv/Scripts/python.exe -m unittest tests.test_release.ReleaseTests tests.test_release.VoiceRelayTests -v. Build the frontend, then run .venv/Scripts/python.exe scripts/check_ui.py for isolated browser checks using Edge. Set HV_BROWSER_CHANNEL=chrome to use Chrome, or chromium after installing Playwright Chromium. The UI test creates a temporary database, runs a test server on port 8011 and uses synthetic microphone/PCM/WebSocket fixtures, without OpenAI calls. It checks playback, interruption, recovery, accounts, guides and desktop/mobile layout. Screenshots are saved in ignored reports/.
Optional live speech check: .venv/Scripts/python.exe scripts/check_speech.py --save-sample. This makes billable OpenAI requests using only a fixed synthetic greeting; it never reads customer history or sends the routing catalog. It checks Marin PCM generation, model availability and recognition of the generated Russian sample. It is not a real microphone accuracy benchmark.
Official banking information: https://halykbank.kz/knowledge_base and https://halykbank.kz/knowledge_base/3286.
Авторы коммитов
История коммитов
- 2026-09-23 17:42Include configured test environment at repository owner's requestCodex
- 2026-09-23 17:38Release test assistant with Marin voice and responsive PCM streamingCodex
- 2026-09-23 17:14Redesign Halyk Voice and introduce read-only assistance platform modeCodex
- 2026-09-23 16:56Bound voice response latency and harden authentication and private historyCodex
- 2026-09-23 16:17Improve voice capture and add accounts, private history and spoken tutorialsCodex
- 2026-09-23 16:03Add OpenAI voice router applicationCodex
Структура репозитория (73 файлов)
.dockerignore .env .env.example .github/workflows/check.yml .gitignore Caddyfile Dockerfile README.md SECURITY.md backend/__init__.py backend/accounts.py backend/config.py backend/data/knowledge_base.demo.json backend/data/mock_backend.json backend/data/scenarios.demo.halyk.json backend/main.py backend/prompts/router_system.txt backend/providers/__init__.py backend/providers/base.py backend/providers/openai_provider.py backend/router/__init__.py backend/router/engine.py backend/router/policy.py backend/router/scenario_adapter.py backend/router/schema.py backend/router/state.py backend/router/validator.py backend/security/__init__.py backend/security/headers.py backend/security/rate_limit.py backend/security/redaction.py backend/services/__init__.py backend/services/advice.py backend/services/assistant.py backend/services/knowledge.py backend/services/mock_backend.py backend/tutorials.py backend/voice/__init__.py backend/voice/realtime.py compose.yaml frontend/index.html frontend/package-lock.json frontend/package.json frontend/public/pcm-worklet.js frontend/src/Platform.tsx frontend/src/api/client.ts frontend/src/components/Auth.tsx frontend/src/components/Icon.tsx frontend/src/components/Orb.tsx frontend/src/components/Tutorial.tsx frontend/src/i18n/index.ts frontend/src/main.tsx frontend/src/styles/app.css frontend/src/styles/platform.css frontend/src/styles/upgrade.css frontend/src/voice/SpeechPlayer.ts frontend/src/voice/VoiceConnection.ts frontend/tsconfig.json frontend/vite.config.ts requirements-dev.lock requirements-dev.txt requirements.txt scripts/benchmark_openai.py scripts/check_speech.py scripts/check_ui.py scripts/evaluate.py setup.ps1 start.ps1 tests/__init__.py tests/data/demo_router_cases.json tests/test_platform.py tests/test_release.py tests/test_upgrade.py
Обсуждение 0 комментариев
Войдите, чтобы комментироватьПока нет комментариев — будьте первым.