224 Commits
Author SHA1 Message Date
didar 2ea6e6f4bb feat: update AI voice settings for improved responsiveness and pacing
deploy / deploy (push) Successful in 31s
2026-08-25 01:42:10 +05:00
didar 6ccdaf9167 feat: update ElevenLabs TTS model ID and add prebuffering for improved audio streaming
deploy / deploy (push) Successful in 31s
2026-08-25 01:20:52 +05:00
didar 70ec9ab384 feat: retrieving back ElevenLabs TTS model ID to eleven_flash_v2_5
deploy / deploy (push) Successful in 30s
2026-08-25 01:09:26 +05:00
didar c399296165 feat: implement no-speech reprompt functionality with configurable parameters
deploy / deploy (push) Successful in 33s
2026-08-24 14:17:00 +05:00
didarandClaude Sonnet 5 75d9ed85a7 fix: force narrowband slin on AI audiosocket channel
deploy / deploy (push) Successful in 31s
AudioSocket was delivering 16kHz audio despite the telecom-kz trunk being
codec-restricted to alaw/ulaw, causing the 8k->16k ASR resample to double
an already-16kHz stream to an effective 32kHz labeled as 16000 Hz -
audible as slow, deep-pitched, unintelligible speech. Force
audioread/writeformat=slin before AudioSocket() so the channel always
delivers narrowband 8kHz, matching every rate assumption in the runtime.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-23 15:42:01 +05:00
didar c590528694 feat: add debug audio dump functionality for ElevenLabs ASR provider
deploy / deploy (push) Successful in 30s
2026-08-23 13:38:56 +05:00
didar 9a09a39849 feat: enhance ElevenLabs ASR provider to accumulate autonomous VAD commits
deploy / deploy (push) Successful in 31s
2026-08-23 13:20:31 +05:00
didar 206b0bafe0 feat: update real-time commit strategy for ElevenLabs ASR to VAD
deploy / deploy (push) Successful in 30s
2026-08-23 13:05:58 +05:00
didar 1a91dc4489 feat: add tenant ID handling for sales voice and telegram sync requests
deploy / deploy (push) Successful in 30s
2026-08-23 12:55:25 +05:00
didar 8dd3e238f2 feat: enhance low signal transcript handling with finalization checks and logging
deploy / deploy (push) Successful in 31s
2026-08-23 12:40:59 +05:00
didar 642104ec0d Merge pull request 'feat: make ai_operator_settings config code the source of truth' (#3) from feat/ai-operator-config-source-of-truth into main
deploy / deploy (push) Successful in 29s
Reviewed-on: #3
2026-08-21 16:17:12 +00:00
didarandClaude Sonnet 5 c5dd87ee32 feat: make ai_operator_settings config code the source of truth
Add sync_ai_operator_config_from_code() which overwrites the DB-cached
ai_operator_settings row from ai_operator_default_config() on startup
of ai_orchestrator_service and ai_voice_runtime_service. Greeting and
system prompt changes now go through git + deploy instead of manual
psql/API edits to prod. Also adds a root README pointing to existing docs.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-21 21:00:34 +05:00
Codex 6d9b0ce98a feat: add aimaq production env file (TTS/ASR/LLM config in git)
deploy / deploy (push) Successful in 29s
2026-08-21 13:37:25 +00:00
Codex fae68aaaaf ci: FINAL test ? Gitea 1.27.2 + runner v3.2.0 + web UI fixed
deploy / deploy (push) Successful in 29s
2026-08-21 07:11:50 +00:00
Codex ca31a867a9 ci: FINAL test ? Gitea 1.27.2 + runner v3.2.0 + web UI fixed 2026-08-21 07:10:54 +00:00
Codex 34b902bb70 ci: post-upgrade test ? Gitea 1.27.2 + runner v3.2.0
deploy / deploy (push) Successful in 29s
2026-08-21 07:01:55 +00:00
Codex a80ec23ba8 ci: clean test #3 - monitoring status propagation
deploy / deploy (push) Canceled after 24h12m33s
2026-08-21 06:57:55 +00:00
Codex 9f03a2daf7 ci: trigger #2 - debug logging enabled
deploy / deploy (push) Canceled after 24h24m8s
2026-08-21 06:46:21 +00:00
Codex 9c3cee24e9 ci: test pipeline end-to-end after runner fix
deploy / deploy (push) Canceled after 24h25m4s
2026-08-21 06:45:25 +00:00
didar ffa779ffa0 Move ai-voice-runtime-service host port off 9019 to avoid cross-tenant conflict
deploy / deploy (push) Canceled after 24h48m11s
A separate deployment on the same host (aimaq-call-center) already binds
127.0.0.1:9019, so this project's ai-voice-runtime-service could never
start there. Remap the host side to 9024 and point Asterisk's
AudioSocket target at the new port; the container still listens on 9019
internally.
2026-08-20 23:22:16 +05:00
didar 13ef87eb2c Fix voice greeting test marker to hit the actually-served default
deploy / deploy (push) Canceled after 25h17m2s
The previous marker was added to operator_persona.py's inline fallback,
which only fires when config is None. Every real call path loads a
populated AIOperatorConfig via load_effective_ai_operator_config(),
so ai_operator_default_config() in services/shared/ai_operator_config.py
is the default that's actually served.
2026-08-20 22:53:27 +05:00
didar c5e11fde3d Add test marker to voice greeting to verify Gitea CI/CD deploy
deploy / deploy (push) Canceled after 25h22m40s
2026-08-20 22:47:34 +05:00
didar 4e1039ab58 Merge pull request 'Play a filler ack during slow voice decisions and cache KB search rows' (#2) from voice-latency-llm-tts-improvements into main
deploy / deploy (push) Canceled after 27h22m42s
Reviewed-on: #2
2026-08-20 09:47:45 +00:00
didar 9cc5d802d6 Merge pull request 'Add architecture longread and remove dead code found during review' (#1) from worktree-call-center-review into main
deploy / deploy (push) Canceled after 27h28m15s
Reviewed-on: #1
2026-08-20 09:42:15 +00:00
Didar KozhikovandClaude Sonnet 5 49489f89b5 Play a filler ack during slow voice decisions and cache KB search rows
Two independent latency fixes for the voice-assistant reply pipeline,
both scoped to the parts of the flow that run regardless of whether
voice_v2 is enabled for a queue:

1. media_runtime._process_utterance: the v1/fallback turn path (used by
   any queue not covered by AI_VOICE_V2_QUEUE_CODES) silently awaited the
   full LLM decision with no audio playing at all, unlike the v2 path
   which already has a decision-timeout ack. Give v1 the same behavior:
   wait up to 600ms (_v1_ack_wait_seconds) for the decision, and if it's
   still not ready, play a short "Секунду." filler via the existing
   _emit_early_ack before the real reply, instead of leaving the caller
   in silence for the full LLM+TTS round trip. Reuses the same ack
   selection/playback code path v2 already exercises, so no new failure
   modes - just an added timeout branch mirroring the existing v2 one.

2. ai_orchestrator_service._kb_search: every voice/chat turn re-ran a
   full-table scan of kb_articles (all columns, including body text) and
   rescored every row in Python, even though the KB rarely changes
   mid-conversation. Added an in-process cache keyed by language, gated
   on a cheap content fingerprint (row count + max id + max updated_at +
   summed title/body/tags length, all computed server-side without
   transferring the text columns). A fingerprint mismatch always
   triggers a fresh fetch, so this can never serve stale results after
   an insert/update/delete - unlike a naive TTL cache, which would have
   been be wrong the moment a test (or a real KB edit) changed the table
   within the cache window.

   Note the first fingerprint design (count + max id + max updated_at
   only) was insufficient: utc_now_iso() truncates to whole seconds and
   SQLite reuses primary keys after a full-table delete, so two
   different row sets written in the same wall-clock second could share
   a fingerprint. Caught this via a real test failure
   (test_ai_whatsapp_relaxed_kb_search_answers_phrase_query breaking
   only when run after test_ai_orchestrator_service.py in the same
   process) before it could reach production; the summed content-length
   term closes the gap.

Added test_media_runtime_plays_filler_ack_when_v1_decision_is_slow
(asserts greeting -> ack -> reply delivery order when process_turn is
slow) and verified the KB cache against the full
test_ai_orchestrator_service.py + test_ai_whatsapp_orchestrator_service.py
suite plus a wider kb/orchestrator/whatsapp/telegram/voice-filtered run:
only the same pre-existing, already-documented failures remain (unrelated
sales_service test-isolation ordering, one known persona-prompt
assertion) - no new failures from either change.

Streaming the LLM decision itself (start speaking reply_text before the
full structured JSON response finishes generating) was scoped but
deliberately deferred: it needs incremental JSON parsing on top of SSE
streaming to detect when just the reply_text field is complete, shared
across both voice and text-channel decision paths - a separate,
higher-risk change that deserves its own PR and testing pass rather than
being bundled here.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-19 21:54:02 +05:00
Didar KozhikovandClaude Sonnet 5 a9be976845 Implement real streaming TTS for ElevenLabs to cut voice-assistant reply latency
The AudioSocket/media_runtime playback pipeline already supports chunked
TTS streaming (voice_v2_streaming_tts), but every provider inherited the
base TTSProvider.synthesize_chunks(), which just called the blocking
synthesize() and yielded the entire finished audio as a single "chunk" -
so the caller waited for full-utterance synthesis before any playback
could start regardless of the flag.

ElevenLabs is the production default (AI_VOICE_TTS_PROVIDER=elevenlabs in
deployment/docker-compose.server.yml), so give it a real implementation
that POSTs to the /stream endpoint and yields audio as network chunks
arrive, instead of waiting for the whole response body. Chunk boundaries
are re-aligned to whole 16-bit PCM samples so a split sample at a network
read boundary can't corrupt playback. The full synthesized audio is still
written to the on-disk cache afterwards so repeat phrases stay fast and
skip the vendor call entirely, matching the existing synthesize() cache
behavior.

Added test_elevenlabs_tts_provider_streams_chunks_and_caches_full_audio to
cover: chunk splitting mid-sample gets re-aligned, all yielded chunks are
sample-aligned, the full audio round-trips through the cache, and a
cached synthesis is replayed without invoking the streaming endpoint
again.

Verified via tests/test_ai_voice_tts_provider.py (9/9 pass) and a wider
voice/tts-filtered run across the suite: the only failures present are
the same pre-existing, already-documented ones (sales_service test
cross-file isolation ordering, one known persona-prompt assertion) -
identical set to before this change, no new failures.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-19 21:40:35 +05:00
Didar KozhikovandClaude Sonnet 5 cdabe61bc2 Add architecture longread and remove dead code found during review
- docs: longread.md — deep architecture/flow review of the whole
  platform (services, event bus reality vs docs, AI/ML stack honesty
  check, tech debt inventory)
- ai_orchestrator_service/voice.py: drop _voice_decision_legacy
  (unreferenced) and the shadowed first _voice_decision definition
  (silently overwritten by the real one, dead code)
- ui/analyst/app.js: drop duplicate dead definitions of
  loadSavedAnalyticsViews/saveAnalyticsView/deleteAnalyticsView and
  the first loadAnalyticsTrend implementation, all shadowed by later
  declarations in the same file; kept the intentional AI-mode
  drilldown wrapper layer (openAnalyticsDrilldown/exportAnalyticsDrilldownCsv/etc.)
  since that duplication is deliberate delegation, not dead code
- ui/operator/vendor/sip-0.21.2.min.js: remove byte-identical orphaned
  duplicate of ui/operator/sip-0.21.2.min.js (unreferenced anywhere)

Verified via full pytest run: identical set of 97 pre-existing
failures before and after (sales_* test-isolation ordering issue and
one known persona-prompt test), no new regressions.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-18 22:25:27 +05:00
arystanbek 09a4ddac51 ci: add Gitea Actions deploy workflow
deploy / deploy (push) Has been cancelled
2026-08-12 15:14:52 +00:00
Codex 333d6a5684 ci: remove service port mappings (use docker DNS service names, avoid host port conflicts)
ci / test (push) Failing after 23s
ci / build-image (push) Has been skipped
ci / postgres-readiness (push) Has been cancelled
2026-08-10 13:16:36 +00:00
Codex 74a0462b10 ci: fix act-runner networking (service names not localhost) + non-conflicting host ports
ci / test (push) Failing after 42s
ci / postgres-readiness (push) Failing after 4s
ci / build-image (push) Has been skipped
2026-08-10 13:13:47 +00:00
Codex e73786985d ci: add workflow_dispatch trigger (enables manual Run Workflow button in Actions UI)
ci / test (push) Failing after 2m44s
ci / postgres-readiness (push) Failing after 4s
ci / build-image (push) Has been skipped
2026-08-10 13:07:36 +00:00
Codex 210106eaa0 restore(ui): recover frontend deleted in 8e51290 (login/operator/supervisor/analyst/admin/sales) 2026-08-10 12:28:12 +00:00
Codex d57c50bdc4 sync: latest working state before Gitea migration (2026-08-10)
ci / test (push) Failing after 1m31s
ci / postgres-readiness (push) Failing after 18s
ci / build-image (push) Has been skipped
2026-08-10 05:53:49 +00:00
Magzhan Zhumabayev 5236ee74ac Autostage Telegram sales leads 2026-05-12 19:41:04 +05:00
Magzhan Zhumabayev fbc77ba8a7 Expand sales leads and customer contracts 2026-05-12 19:09:31 +05:00
Magzhan Zhumabayev ce3ba270aa Add configurable AI operator persona 2026-05-11 17:37:26 +05:00
Magzhan Zhumabayev 67a0255c0d Fix sales post-repair acceptance gaps 2026-05-11 17:33:08 +05:00
Administrator ea200ab4fd Merge branch 'codex/p0-sales-contract-repair' into 'main'
Add sales contract repair routes

See merge request crm/call-center!3
2026-05-11 12:01:27 +00:00
Magzhan Zhumabayev 64862dd49a Add sales contract repair routes 2026-05-11 16:57:30 +05:00
Magzhan Zhumabayev ebba6c3f82 Allow tenant header for bearer-authenticated requests 2026-05-11 16:02:16 +05:00
Admin 0f1d59c9dd fix(ci): free ai voice audiosocket port before deploy 2026-05-11 15:30:17 +05:00
Admin 710e62fa86 fix(ci): remove stale ai voice runtime container before deploy 2026-05-11 15:17:30 +05:00
Codex 3e15158126 Resolve source deploy root for env file 2026-05-11 09:52:00 +00:00
Codex f74e69c63f Use server compose for source deploy 2026-05-11 09:32:29 +00:00
Codex a997343c36 Disable remote builds in source deploy 2026-05-11 09:17:10 +00:00
Codex 38ede737f0 Fix source deploy compose sync 2026-05-11 09:04:15 +00:00
Magzhan Zhumabayev 53f9845195 Enrich Telegram error alerts with request and upstream context 2026-05-11 13:52:13 +05:00
Magzhan Zhumabayev bf75a005c2 Normalize Telegram t.me channel IDs 2026-05-11 13:41:25 +05:00
Magzhan Zhumabayev 000ac984b6 Add Telegram channel alerts for gateway errors 2026-05-11 13:35:52 +05:00
Magzhan Zhumabayev a14fdea34f Fix sales API proxy endpoints and tests 2026-05-11 13:28:00 +05:00