diff --git a/.env.example b/.env.example index 943fbdb8..5cdbec2f 100644 --- a/.env.example +++ b/.env.example @@ -25,6 +25,11 @@ # Example: VEKTRA_LLM_API_BASE=http://localhost:8000/v1 # VEKTRA_LLM_API_BASE= +# Extra JSON body forwarded to litellm. Useful for vLLM thinking models +# (Qwen3.5, DeepSeek-R1) to disable thinking mode. +# Example: VEKTRA_LLM_EXTRA_BODY={"chat_template_kwargs": {"enable_thinking": false}} +# VEKTRA_LLM_EXTRA_BODY= + # Or set provider-specific keys directly: # OPENAI_API_KEY=sk-... # ANTHROPIC_API_KEY=sk-ant-... @@ -83,6 +88,12 @@ # VEKTRA_CONTEXT_CHUNK_RATIO=0.6 # VEKTRA_PROMPT_TEMPLATES_DIR= +# Default RAG grounding policy. Per-namespace override via +# PATCH /api/v1/admin/namespaces/{id}/config. +# strict - answer from retrieved context + history only +# hybrid - fall back to model knowledge when confident +# VEKTRA_PROMPT_GROUNDING_MODE=strict + # Query rewriting (AdvancedQueryPipeline) # VEKTRA_QUERY_REWRITE_ENABLED=true # VEKTRA_QUERY_REWRITE_MODEL= @@ -141,6 +152,14 @@ # VEKTRA_AUDIT_RETENTION_DAYS=90 # VEKTRA_EVAL_MODE=false +# Persist QueryTrace rows for every query (DEBT-011). When unset, defaults +# to true if vektra-analytics is configured, false otherwise. +# VEKTRA_ANALYTICS_STORE_TRACES= + +# Log original and rewritten query text at debug level. Development only; +# query text is otherwise redacted from logs. +# VEKTRA_DEBUG_LOG_QUERIES=false + # -------------------------------------------------------------------------- # Security # -------------------------------------------------------------------------- @@ -174,3 +193,10 @@ # Set to false when an external LMS (e.g. Moodle) manages enrollment. # When false, namespace is derived from JWT (namespace claim or course_id fallback). # VEKTRA_LEARN_REQUIRE_ENROLLMENT=true + +# Default visibility of the source-citations section in the chatbot widget +# (FEAT-014). Resolution chain: data-show-sources attr (client) > +# namespaces.config.show_sources (per-course) > this env var > hardcoded true. +# The API always returns the full sources list; this flag only instructs the +# widget whether to render them. +# VEKTRA_LEARN_SHOW_SOURCES=true diff --git a/.gemini/styleguide.md b/.gemini/styleguide.md index 76d5c073..69bb2a7c 100644 --- a/.gemini/styleguide.md +++ b/.gemini/styleguide.md @@ -1,4 +1,4 @@ -# Vektra coding conventions for Gemini Code Assist +# Vektra RAG coding conventions for Gemini Code Assist ## General diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index e49c2a6c..3e5699b4 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,5 +1,5 @@ name: Bug report -description: Report a bug in Vektra +description: Report a bug in Vektra RAG labels: ["bug"] body: - type: markdown diff --git a/.s2s/BACKLOG.md b/.s2s/BACKLOG.md index fa32efba..38e57aea 100644 --- a/.s2s/BACKLOG.md +++ b/.s2s/BACKLOG.md @@ -664,6 +664,172 @@ As a result, `conversation.j2` and `TemplateRenderer.render_conversation()` are --- +### DEBT-017: Consolidate namespace-resolution logic in vektra-learn + +**Status**: planned | **Priority**: low | **Created**: 2026-04-21 +**Origin**: CodeRabbit review on PR #66 (v0.5.0), `vektra-learn/src/vektra_learn/api.py:498-512` + +**Context**: `_resolve_namespace_from_token()` (added for WI-1 in v0.5.0) re-implements the same fallback chain that `course_query` does inline around lines 663-673 and 694-695: read `course_id` from the JWT, fall back to `namespace` claim, default to `course_id`. The learn-query path additionally performs an enrollment lookup when `VEKTRA_LEARN_REQUIRE_ENROLLMENT=true` which is interleaved with the plain resolution, so a naive extraction would miss that branch. + +**Proposed approach**: extend `_resolve_namespace_from_token` to return a `(course_id, namespace, namespace_source)` tuple, then refactor `course_query` to call it for the non-enrollment branch while keeping the enrollment path inline. Both endpoints stay in lockstep if the JWT schema evolves (e.g., a new claim is added). + +**Acceptance criteria**: +- [ ] Single helper used by both `get_conversation_turns` and `course_query` (non-enrollment branch) +- [ ] Enrollment-required branch unchanged +- [ ] Tests cover both call sites against a shared fixture set +- [ ] No behaviour change to error codes (ERR-LEARN-003 on missing course_id) + +--- + +### DEBT-018: Scope widget `--vektra-primary` override and dedupe style node + +**Status**: completed | **Priority**: low | **Created**: 2026-04-21 | **Completed**: 2026-04-27 (v0.5.0) +**Origin**: CodeRabbit review on PR #66 (v0.5.0), `vektra-learn/widget/src/chat-ui.js:138-144` + +**Resolution**: `_injectStyles()` now writes the `--vektra-primary` override scoped to `.vektra-chat-btn, .vektra-chat-panel` (no longer to `:root`) and reuses a single `