WeKnora/internal/models/chat
wizardchen 98ad41cda4 fix(models): harden background concurrency governor
Follow-up hardening on the per-model background concurrency governor:

- limiter: heartbeat now refreshes the ZSET key's PEXPIRE alongside the
  lease score, so a semaphore that stays saturated with no slot turnover
  can't let the whole key expire (which would drop every lease and admit
  over the limit); reuse one poll timer instead of allocating time.After
  each iteration under contention.
- governor: extract the process-wide governor + Gate helper into the
  limiter package so chat and vlm share one limiter/limit without
  importing each other; add an in-process localLimiter for Lite mode.
- vlm: gate background multimodal (VLM) calls through the same governor;
  previously only chat was throttled.
- chat: ChatStream releases its slot when the consumer abandons the
  stream and cancels ctx (select on ctx.Done, drain inner), fixing a
  slot/goroutine leak.
- container/sync_task: install the local governor in Lite mode and tag
  SyncTaskExecutor runs as background; honour model.max_concurrency=0 as
  an explicit disable instead of falling back to the default.
- tests: cover the governor gating, local limiter, and stream release.
2026-07-09 20:40:51 +08:00
..
anthropic.go feat(thinkingControl): implement thinking mode configuration in model editor 2026-06-05 14:56:48 +08:00
anthropic_test.go fix: support Anthropic gateway streaming 2026-05-13 00:14:23 +08:00
chat.go feat(models): cap background LLM concurrency per model 2026-07-09 20:40:51 +08:00
concurrency_wrapper.go fix(models): harden background concurrency governor 2026-07-09 20:40:51 +08:00
concurrency_wrapper_test.go fix(models): harden background concurrency governor 2026-07-09 20:40:51 +08:00
config_from_model_test.go feat(models): support custom HTTP headers across all remote model calls 2026-04-23 23:36:40 +08:00
image_resolve.go feat(chat): implement local image resolver for multimodal chat 2026-06-01 20:54:37 +08:00
json_field_extractor.go feat: implement final_answer tool and enhance agent duration tracking 2026-03-09 11:46:56 +08:00
json_field_extractor_test.go feat: implement final_answer tool and enhance agent duration tracking 2026-03-09 11:46:56 +08:00
langfuse_wrapper.go feat(tests): add unit tests for Langfuse wrapper functions 2026-06-04 15:48:04 +08:00
langfuse_wrapper_test.go feat(tests): add unit tests for Langfuse wrapper functions 2026-06-04 15:48:04 +08:00
llm_debug.go feat(logger): implement LLM debug logging functionality 2026-04-16 23:15:02 +08:00
llm_debug_wrapper.go feat(logger): implement LLM debug logging functionality 2026-04-16 23:15:02 +08:00
ollama.go fix(security): harden outbound requests and file previews 2026-07-02 19:15:46 +08:00
ollama_test.go fix(security): harden outbound requests and file previews 2026-07-02 19:15:46 +08:00
openai_request.go fix(chat): preserve provider tool-call metadata 2026-06-09 20:55:20 +08:00
openai_stream.go fix(chat): preserve provider tool-call metadata 2026-06-09 20:55:20 +08:00
provider.go fix(chat): preserve provider tool-call metadata 2026-06-09 20:55:20 +08:00
provider_test.go fix(chat): preserve provider tool-call metadata 2026-06-09 20:55:20 +08:00
remote_api.go fix(chat): preserve provider tool-call metadata 2026-06-09 20:55:20 +08:00
remote_api_test.go fix(chat): preserve provider tool-call metadata 2026-06-09 20:55:20 +08:00
sse_reader.go fix: ReadEvent incompatible sse data format 2026-04-20 22:29:38 +08:00
stream_emit.go feat(thinkingControl): implement thinking mode configuration in model editor 2026-06-05 14:56:48 +08:00
stream_raw_dump.go refactor(chat): improve model name sanitization and path validation 2026-06-05 19:35:02 +08:00
thinking.go feat(models): add model test debugger for saved model configs 2026-06-25 17:05:33 +08:00
thinking_test.go feat(models): add model test debugger for saved model configs 2026-06-25 17:05:33 +08:00
timeout_test.go fix(chat): LLM 兜底超时仅在上层无 deadline 时生效,并修复 ChatStream raw HTTP 路径的 cancel 泄漏 2026-05-10 00:16:12 +08:00
transport.go feat(thinkingControl): implement thinking mode configuration in model editor 2026-06-05 14:56:48 +08:00
usage.go feat(thinkingControl): implement thinking mode configuration in model editor 2026-06-05 14:56:48 +08:00