Skip to content

Feat/add obsidian 3#233

Merged
AnkushMalaker merged 26 commits intodevfrom
feat/add-obsidian-3
Dec 24, 2025
Merged

Feat/add obsidian 3#233
AnkushMalaker merged 26 commits intodevfrom
feat/add-obsidian-3

Conversation

@AnkushMalaker
Copy link
Collaborator

@AnkushMalaker AnkushMalaker commented Dec 24, 2025

only to trigger tests

Summary by CodeRabbit

Release Notes

  • New Features
    • Obsidian vault integration: import vaults via ZIP upload, track ingestion progress, and search vault content within chat
    • Enhanced chat with optional Obsidian vault context in responses
    • Chat session management: create, retrieve, update, and delete sessions
    • Memory configuration validation for administrators
    • Neo4j graph database backend for knowledge storage

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 24, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

This pull request introduces a complete Obsidian vault ingestion system spanning frontend and backend. It adds a React Native component for vault ingestion, FastAPI endpoints for upload/status tracking, Neo4j integration for graph-based storage, RQ background job processing, chat memory integration, and necessary configuration and utility modules across the stack.

Changes

Cohort / File(s) Summary
Frontend - Obsidian Ingestion Component
app/app/components/ObsidianIngest.tsx, app/app/index.tsx
New React Native component with vault path input, validation, and POST endpoint to backend ingestion API; conditionally rendered in app when authenticated.
Frontend - Web UI - Chat & Upload
backends/advanced/webui/src/pages/Chat.tsx, backends/advanced/webui/src/pages/Upload.tsx
Added Obsidian checkbox control to chat for memory inclusion; new upload panel with zip file input, progress tracking, job status polling, and result display for Obsidian vault ingestion.
Frontend - Web UI - Settings & API
backends/advanced/webui/src/components/MemorySettings.tsx, backends/advanced/webui/src/services/api.ts
Added admin-only access control and improved error messaging in Memory Settings; extended chatApi with includeObsidianMemory parameter and session management endpoints; added new obsidianApi with uploadZip, start, status, and cancel methods.
Backend - Docker & Dependencies
backends/advanced/docker-compose.yml, backends/advanced/pyproject.toml
Activated neo4j-mem0 service with image, ports, environment config, and obsidian profile; added neo4j and httpx dependencies.
Backend - Core Obsidian Services
backends/advanced/src/advanced_omi_backend/services/obsidian_service.py, backends/advanced/src/advanced_omi_backend/services/neo4j_client.py
New ObsidianService for markdown parsing, chunking, embedding, and Neo4j ingestion; new Neo4jClient with driver management and read/write interface abstractions.
Backend - API Routes - Obsidian
backends/advanced/src/advanced_omi_backend/routers/modules/obsidian_routes.py, backends/advanced/src/advanced_omi_backend/routers/modules/__init__.py
New obsidian_routes module with endpoints for ingest (POST /ingest), upload (POST /upload_zip), start (POST /start), and status (GET /status); handles job queue submission via RQ and persistent state via Redis.
Backend - API Routes - Chat & System
backends/advanced/src/advanced_omi_backend/routers/modules/chat_routes.py, backends/advanced/src/advanced_omi_backend/routers/modules/system_routes.py, backends/advanced/src/advanced_omi_backend/routers/modules/health_routes.py, backends/advanced/src/advanced_omi_backend/routers/api_router.py
Added includeObsidianMemory field to ChatMessageRequest; added memory config validation endpoints; extended health check with registry-based config loading; registered obsidian_router in main API.
Backend - Chat Service Integration
backends/advanced/src/advanced_omi_backend/chat_service.py
Updated get_relevant_memories to return MemoryEntry; added include_obsidian_memory parameter to format_conversation_context and generate_response_stream; integrated Obsidian context retrieval with error handling.
Backend - Configuration & Utilities
backends/advanced/src/advanced_omi_backend/services/memory/config.py, backends/advanced/src/advanced_omi_backend/services/memory/providers/llm_providers.py, backends/advanced/src/advanced_omi_backend/utils/config_utils.py, backends/advanced/src/advanced_omi_backend/utils/file_utils.py, backends/advanced/src/advanced_omi_backend/utils/model_utils.py
Added YAML config loader and helper functions (create_openai_config, create_qdrant_config, create_mycelia_config); extended MemoryConfig with nested config structures; extracted embedding generation to reusable helper; added environment variable resolution and ZIP extraction utilities.
Backend - Background Jobs
backends/advanced/src/advanced_omi_backend/workers/obsidian_jobs.py
New async RQ job for vault ingestion with per-file processing, progress tracking, error collection, and cancellation support.
Backend - Tests
backends/advanced/tests/test_obsidian_service.py
Comprehensive unit tests for ObsidianService covering search, database setup, chunking, ingestion, and error paths with mocked Neo4j and embedding generation.
Backend - Controller & LLM Config
backends/advanced/src/advanced_omi_backend/controllers/system_controller.py, backends/advanced/src/advanced_omi_backend/llm_client.py
Removed unused task_manager import; removed environment variable fallbacks for LLM client config, now relying on direct parameter passing.
Backend - Setup Scripts
services.py, status.py, wizard.py
Updated to conditionally enable obsidian Docker profile based on NEO4J_HOST presence in .env; added Obsidian/Neo4j detection and reporting in wizard output.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant FE as Frontend<br/>(Upload UI)
    participant API as FastAPI<br/>(Obsidian Routes)
    participant Redis
    participant RQ as Job Queue<br/>(RQ)
    participant ObsService as Obsidian Service
    participant Neo4j

    User->>FE: Select & upload vault.zip
    FE->>API: POST /obsidian/upload_zip
    API->>API: Validate & extract ZIP
    API->>Redis: Store pending state<br/>(24h expiry)
    API-->>FE: Return job_id & vault_path
    
    User->>FE: Click "Start Ingestion"
    FE->>API: POST /obsidian/start
    API->>Redis: Fetch pending state
    API->>RQ: Enqueue ingest_obsidian_vault_job
    API-->>FE: Return RQ job_id
    
    loop User Polls Status
        FE->>API: GET /obsidian/status?job_id=...
        API->>RQ: Check job status
        alt Job found in RQ
            API->>API: Extract meta (progress, total)
            API-->>FE: Return status & progress
        else Fallback to Redis
            API->>Redis: Get pending state
            API-->>FE: Return pending state
        end
    end
    
    rect rgb(220, 240, 255)
    note over RQ,Neo4j: Background Job Processing
    RQ->>ObsService: Process each .md file
    loop For each Markdown file
        ObsService->>ObsService: Parse, chunk, embed
        ObsService->>Neo4j: Create Note & Chunk nodes
        ObsService->>Neo4j: Create relationships
        ObsService->>RQ: Update job meta (progress)
    end
    ObsService-->>RQ: Job complete with summary
    end
Loading
sequenceDiagram
    actor User
    participant ChatUI as Chat UI
    participant API as FastAPI<br/>(Chat Routes)
    participant ChatSvc as Chat Service
    participant ObsidianSvc as Obsidian Service
    participant LLM as LLM Provider

    User->>ChatUI: Type message<br/>(check "Include Obsidian Memory")
    ChatUI->>API: POST /chat/stream<br/>include_obsidian_memory=true
    
    API->>ChatSvc: generate_response_stream(...<br/>include_obsidian_memory=true)
    
    rect rgb(220, 240, 255)
    note over ChatSvc,ObsidianSvc: Context Formatting with Obsidian
    ChatSvc->>ChatSvc: get_relevant_memories(query)
    ChatSvc->>ChatSvc: format_conversation_context(...<br/>include_obsidian_memory=true)
    
    alt include_obsidian_memory is true
        ChatSvc->>ObsidianSvc: search_obsidian(query)
        ObsidianSvc->>ObsidianSvc: Generate embeddings
        ObsidianSvc-->>ChatSvc: Obsidian search results<br/>(source, tags, links)
        ChatSvc->>ChatSvc: Merge Obsidian context<br/>with memory context
    end
    end
    
    ChatSvc->>LLM: generate(...context)
    LLM-->>ChatSvc: Streamed response
    ChatSvc-->>API: Stream response chunks
    API-->>ChatUI: Display response
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • Memory config from UI #90: Modifies memory configuration APIs and system controller/routes, directly overlapping with memory config endpoint changes in this PR.
  • Fix/cleanup model #219: Touches the same config/registry-driven configuration surface (config.yml, model_registry usage) and backend module initialization paths as this PR.
  • Feat/local omi scripts #129: Modifies wizard.py and dotenv environment-reading setup flow for service orchestration, sharing similar NEO4J_HOST detection logic introduced here.

Suggested reviewers

  • thestumonkey

Poem

🐰 Whisker-twitching through vaults of notes,
Neo4j graphs now float our boats,
Obsidian dreams, embedded so deep,
From markdown mines, memories we'll keep!
Jobs queue up, progress we track—
A knowledge graph has our back! 🌿✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 63.01% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive Title "Feat/add obsidian 3" is vague and uses non-descriptive phrasing that doesn't convey meaningful information about the changeset. It lacks specificity about what Obsidian functionality is being added. Use a more descriptive title that specifies the primary change, such as "Add Obsidian vault ingestion and Neo4j integration" or "Implement Obsidian memory search in chat service".
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
status.py (1)

71-71: Remove redundant import inside function.

dotenv_values is already imported at the module level (line 21). This local import is redundant and violates the coding guideline that all imports must be at the top of the file.

🔎 Proposed fix
         # Handle speaker-recognition profiles
         if service_name == 'speaker-recognition':
-            from dotenv import dotenv_values
             env_file = service_path / '.env'

As per coding guidelines, ALL imports must be at the top of the file after the docstring.

🧹 Nitpick comments (21)
backends/advanced/webui/src/components/MemorySettings.tsx (1)

224-224: Consider clearing the error state when configuration is modified.

When !!error is true, both Validate and Save buttons are disabled. However, if the user edits the YAML after an error occurred, they cannot validate/save until they reload. Consider clearing the error when configYaml changes.

🔎 Suggested enhancement
 <textarea
   value={configYaml}
-  onChange={(e) => setConfigYaml(e.target.value)}
+  onChange={(e) => {
+    setConfigYaml(e.target.value)
+    if (error) setError('')
+  }}
   placeholder="Loading configuration..."

Also applies to: 242-242

backends/advanced/src/advanced_omi_backend/utils/file_utils.py (1)

66-81: Use logging.exception() in except blocks to capture stack traces.

Based on learnings, logging.exception() should be used inside except blocks to automatically log the full stack trace, improving debuggability.

🔎 Suggested fix
     except zipfile.BadZipFile as e:
         error_msg = f"Invalid zip file: {zip_path} - {e}"
-        logger.error(error_msg)
+        logger.exception(error_msg)
         raise zipfile.BadZipFile(error_msg) from e
     except zipfile.LargeZipFile as e:
         error_msg = f"Zip file too large: {zip_path} - {e}"
-        logger.error(error_msg)
+        logger.exception(error_msg)
         raise ZipExtractionError(error_msg) from e
     except PermissionError as e:
         error_msg = f"Permission denied extracting zip file: {zip_path} - {e}"
-        logger.error(error_msg)
+        logger.exception(error_msg)
         raise ZipExtractionError(error_msg) from e
     except Exception as e:
         error_msg = f"Error extracting zip file {zip_path}: {e}"
-        logger.error(error_msg)
+        logger.exception(error_msg)
         raise ZipExtractionError(error_msg) from e
backends/advanced/webui/src/pages/Upload.tsx (2)

32-39: Consider defining an interface for obsidianStatus instead of using any.

Using any loses type safety. Based on the API response structure used in lines 509-530, define a proper type.

🔎 Suggested type definition
interface ObsidianIngestionStatus {
  status: 'pending' | 'processing' | 'completed' | 'failed'
  processed: number
  total: number
  percent: number
  last_file?: string
  errors?: string[]
  error?: string
}

// Then replace:
const [obsidianStatus, setObsidianStatus] = useState<ObsidianIngestionStatus | null>(null)

479-485: Consider adding a Cancel button for in-progress ingestion.

The obsidianApi.cancel(jobId) endpoint exists (per api.ts lines 229-246) but isn't exposed in the UI. Users may want to cancel a long-running ingestion.

backends/advanced/src/advanced_omi_backend/chat_service.py (1)

336-345: Use logging.exception() and bare raise for proper error handling.

Based on learnings, use logging.exception() to automatically capture stack traces. Also, use bare raise instead of raise e to preserve the original traceback.

🔎 Suggested fix
             except ObsidianSearchError as exc:
-                logger.error(
+                logger.exception(
                     "Failed to get Obsidian context (%s stage): %s",
                     exc.stage,
                     exc,
                 )
                 raise
             except Exception as e:
-                logger.error(f"Failed to get Obsidian context: {e}")
-                raise e
+                logger.exception(f"Failed to get Obsidian context: {e}")
+                raise
backends/advanced/src/advanced_omi_backend/services/neo4j_client.py (1)

15-18: Consider thread safety for lazy driver initialization.

If multiple threads call get_driver() simultaneously on first access, multiple drivers could be created. For single-threaded async usage this is fine, but if used in threaded contexts, consider adding a lock.

🔎 Thread-safe alternative (if needed)
import threading

class Neo4jClient:
    def __init__(self, uri: str, user: str, password: str):
        self.uri = uri
        self.auth = (user, password)
        self._driver: Optional[Driver] = None
        self._lock = threading.Lock()

    def get_driver(self) -> Driver:
        if not self._driver:
            with self._lock:
                if not self._driver:  # Double-check pattern
                    self._driver = GraphDatabase.driver(self.uri, auth=self.auth)
        return self._driver
wizard.py (1)

400-410: Remove unnecessary f-string prefixes.

Lines 400 and 408 use f-strings without any placeholders. These should be regular strings for clarity and to avoid confusion.

As per coding guidelines:

🔎 Proposed fix
-    console.print(f"\n🎊 [bold green]Setup Complete![/bold green]")
+    console.print("\n🎊 [bold green]Setup Complete![/bold green]")
     console.print(f"✅ {success_count}/{len(selected_services)} services configured successfully")
     
     if failed_services:
         console.print(f"❌ Failed services: {', '.join(failed_services)}")
     
     # Inform about Obsidian/Neo4j if configured
     if obsidian_enabled:
-        console.print(f"\n📚 [bold cyan]Obsidian Integration Detected[/bold cyan]")
+        console.print("\n📚 [bold cyan]Obsidian Integration Detected[/bold cyan]")
         console.print("   Neo4j will be automatically started with the 'obsidian' profile")
         console.print("   when you start the backend service.")
backends/advanced/src/advanced_omi_backend/services/memory/providers/llm_providers.py (1)

283-285: Use logging.exception() and chain the exception for better debuggability.

Per project conventions, prefer logging.exception() in except blocks to capture the full stack trace automatically. Also chain the exception with raise ... from e to preserve context.

🔎 Proposed fix
         except Exception as e:
-            memory_logger.error(f"OpenAI embedding generation failed: {e}")
-            raise
+            memory_logger.exception(f"OpenAI embedding generation failed: {e}")
+            raise RuntimeError(f"OpenAI embedding generation failed: {e}") from e

Based on learnings, in Python code (chronicle project), prefer logging.exception() inside except blocks to automatically log the full stack trace, and chain with raise ... from e to preserve context.

app/app/components/ObsidianIngest.tsx (1)

1-3: Remove leading empty line and unused import.

Line 1 has an unnecessary empty line, and ActivityIndicator is imported but never used in the component's render output.

🔎 Proposed fix
-
 import React, { useState } from 'react';
-import { View, Text, TextInput, TouchableOpacity, StyleSheet, Alert, ActivityIndicator } from 'react-native';
+import { View, Text, TextInput, TouchableOpacity, StyleSheet, Alert } from 'react-native';

Alternatively, if you want to show a spinner while loading, use the ActivityIndicator:

       <TouchableOpacity
         style={[styles.button, loading ? styles.buttonDisabled : null]}
         onPress={handleIngest}
         disabled={loading}
       >
+        {loading && <ActivityIndicator color="white" style={{ marginRight: 8 }} />}
         <Text style={styles.buttonText}>
           {loading ? 'Starting Ingestion...' : 'Ingest to Neo4j'}
         </Text>
       </TouchableOpacity>
backends/advanced/src/advanced_omi_backend/workers/obsidian_jobs.py (3)

17-25: Rename unused loop variable.

In count_markdown_files, the root variable is not used within the loop body. Rename to _root to indicate intentional non-use.

🔎 Proposed fix
 def count_markdown_files(vault_path: str) -> int:
     """Recursively count markdown files in a vault."""
     count = 0
-    for root, dirs, files in os.walk(vault_path):
+    for _root, dirs, files in os.walk(vault_path):
         dirs[:] = [d for d in dirs if not d.startswith(".")]
         for filename in files:
             if filename.endswith(".md"):
                 count += 1
     return count

46-51: Remove redundant exception object from logging.exception() call.

When using logging.exception(), the exception info is automatically included. Passing exc explicitly is redundant.

🔎 Proposed fix
     except Exception as exc:
-        logger.exception("Database setup failed for job %s: %s", job.id, exc)
+        logger.exception("Database setup failed for job %s", job.id)
         job.meta["status"] = "failed"
         job.meta["error"] = f"Database setup failed: {exc}"
         job.save_meta()
         raise

93-97: Use logging.exception() for full stack trace in error handling.

Per project conventions, use logging.exception() instead of logging.error() inside except blocks to automatically capture the full stack trace.

🔎 Proposed fix
             except Exception as exc:
-                logger.error("Processing %s failed: %s", filename, exc)
+                logger.exception("Processing %s failed", filename)
                 errors.append(f"{filename}: {exc}")
                 job.meta["errors"] = errors
                 job.save_meta()

Based on learnings, prefer logging.exception() inside except blocks to automatically log the full stack trace.

backends/advanced/src/advanced_omi_backend/services/obsidian_service.py (4)

108-114: Redundant validation after get_model_config which already raises.

The get_model_config utility (per the relevant code snippets) already raises ValueError if the config is not found. These additional checks are redundant and will never trigger.

🔎 Proposed fix
         # Get model configurations using shared utility
         llm_config = get_model_config(config_data, "llm")
-        if not llm_config:
-            raise ValueError("Configuration for 'defaults.llm' not found in config.yml")

         embed_config = get_model_config(config_data, "embedding")
-        if not embed_config:
-            raise ValueError("Configuration for 'defaults.embedding' not found in config.yml")

283-293: Fix logging and add strict=True to zip() for safety.

  1. logging.exception() already includes the exception - no need to append {e}
  2. zip() without strict=True can silently drop items if list lengths mismatch
🔎 Proposed fix
         except Exception as e:
-            logger.exception(f"Embedding generation failed for {note_data['path']}: {e}")
+            logger.exception(f"Embedding generation failed for {note_data['path']}")
             return []

         chunk_payloads: List[ChunkPayload] = []
-        for orig_text, vector in zip(original_chunks, vectors):
+        for orig_text, vector in zip(original_chunks, vectors, strict=True):

406-451: Use logging.exception() in except blocks for full stack traces.

Per project conventions, prefer logging.exception() inside except blocks to automatically log the full stack trace. The exception chaining with from exc/from e is correct.

🔎 Proposed fix
         except Exception as exc:
-            logger.error("Obsidian search embedding failed: %s", exc)
+            logger.exception("Obsidian search embedding failed")
             raise ObsidianSearchError("embedding", str(exc)) from exc
         except Exception as e:
-            logger.error(f"Obsidian search failed: {e}")
+            logger.exception("Obsidian search failed")
             raise ObsidianSearchError("database", str(e)) from e

Based on learnings, prefer logging.exception() inside except blocks.


381-384: Minor: Use !s conversion flag instead of str().

🔎 Proposed fix
                     except Exception as e:
                         logger.exception(f"Processing {file} failed")
-                        errors.append(f"{file}: {str(e)}")
+                        errors.append(f"{file}: {e!s}")
backends/advanced/src/advanced_omi_backend/routers/modules/obsidian_routes.py (3)

46-48: Use logging.exception() and chain the exception.

Per project conventions, use logging.exception() for automatic stack traces and chain exceptions when re-raising.

🔎 Proposed fix
     except Exception as e:
-        logger.error(f"Ingestion failed: {e}")
-        raise HTTPException(status_code=500, detail=str(e))
+        logger.exception("Ingestion failed")
+        raise HTTPException(status_code=500, detail=str(e)) from e

Based on learnings, prefer logging.exception() and exception chaining.


78-93: Improve exception handling with proper chaining and logging.

Multiple exception handlers need logging.exception() and exception chaining per project conventions.

🔎 Proposed fix
         try:
             zip_file_handle = open(zip_path, 'wb')
             zip_file_handle.write(file_content)
         except IOError as e:
-            logger.error(f"Error writing zip file {zip_path}: {e}")
-            raise HTTPException(status_code=500, detail=f"Failed to save uploaded zip: {e}")
+            logger.exception(f"Error writing zip file {zip_path}")
+            raise HTTPException(status_code=500, detail=f"Failed to save uploaded zip: {e}") from e
         
         # Extract zip file using utility function
         try:
             extract_zip(zip_path, extract_dir)
         except zipfile.BadZipFile as e:
-            logger.exception(f"Invalid zip file: {e}")
-            raise HTTPException(status_code=400, detail=f"Invalid zip file: {e}")
+            logger.exception("Invalid zip file")
+            raise HTTPException(status_code=400, detail=f"Invalid zip file: {e}") from e
         except ZipExtractionError as e:
-            logger.error(f"Error extracting zip file: {e}")
-            raise HTTPException(status_code=500, detail=f"Failed to extract zip file: {e}")
+            logger.exception("Error extracting zip file")
+            raise HTTPException(status_code=500, detail=f"Failed to extract zip file: {e}") from e

Based on learnings, prefer logging.exception() and exception chaining.


151-166: Add exception chaining when raising HTTPException.

🔎 Proposed fix
         except Exception as e:
-            logger.exception(f"Failed to start job {job_id}: {e}")
-            raise HTTPException(status_code=500, detail=f"Failed to start job: {e}")
+            logger.exception(f"Failed to start job {job_id}")
+            raise HTTPException(status_code=500, detail=f"Failed to start job: {e}") from e
             
     # Check if already in RQ
     try:
         job = Job.fetch(job_id, connection=redis_conn)
         status = job.get_status()
         if status in ("queued", "started", "deferred", "scheduled"):
              raise HTTPException(status_code=400, detail=f"Job already {status}")
         
         # If finished/failed, we could potentially restart? But for now let's say it's done.
         raise HTTPException(status_code=400, detail=f"Job is in state: {status}")
         
     except NoSuchJobError:
-        raise HTTPException(status_code=404, detail="Job not found")
+        raise HTTPException(status_code=404, detail="Job not found") from None

Based on learnings, chain exceptions. Use from None for NoSuchJobError since the 404 response intentionally suppresses the original context.

backends/advanced/src/advanced_omi_backend/services/memory/config.py (2)

101-102: Use explicit Optional type annotation.

PEP 484 prohibits implicit Optional. Use Optional[str] or str | None explicitly.

🔎 Proposed fix
 def create_mycelia_config(
-    api_url: str = "http://localhost:8080", api_key: str = None, timeout: int = 30, **kwargs
+    api_url: str = "http://localhost:8080", api_key: Optional[str] = None, timeout: int = 30, **kwargs
 ) -> Dict[str, Any]:

311-315: Use bare raise to preserve the original traceback.

Using raise e resets the traceback to this line. Bare raise preserves the full original traceback.

🔎 Proposed fix
     except Exception as e:
         memory_logger.exception(
             f"Failed to get embedding dimensions from registry for model '{embedding_model}'"
         )
-        raise e
+        raise
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 79390c3 and 2001baa.

⛔ Files ignored due to path filters (2)
  • backends/advanced/uv.lock is excluded by !**/*.lock
  • tests/test_assets/obsidian_dataview_example_vault.zip is excluded by !**/*.zip
📒 Files selected for processing (29)
  • app/app/components/ObsidianIngest.tsx
  • app/app/index.tsx
  • backends/advanced/docker-compose.yml
  • backends/advanced/pyproject.toml
  • backends/advanced/src/advanced_omi_backend/chat_service.py
  • backends/advanced/src/advanced_omi_backend/controllers/system_controller.py
  • backends/advanced/src/advanced_omi_backend/llm_client.py
  • backends/advanced/src/advanced_omi_backend/routers/api_router.py
  • backends/advanced/src/advanced_omi_backend/routers/modules/__init__.py
  • backends/advanced/src/advanced_omi_backend/routers/modules/chat_routes.py
  • backends/advanced/src/advanced_omi_backend/routers/modules/health_routes.py
  • backends/advanced/src/advanced_omi_backend/routers/modules/obsidian_routes.py
  • backends/advanced/src/advanced_omi_backend/routers/modules/system_routes.py
  • backends/advanced/src/advanced_omi_backend/services/memory/config.py
  • backends/advanced/src/advanced_omi_backend/services/memory/providers/llm_providers.py
  • backends/advanced/src/advanced_omi_backend/services/neo4j_client.py
  • backends/advanced/src/advanced_omi_backend/services/obsidian_service.py
  • backends/advanced/src/advanced_omi_backend/utils/config_utils.py
  • backends/advanced/src/advanced_omi_backend/utils/file_utils.py
  • backends/advanced/src/advanced_omi_backend/utils/model_utils.py
  • backends/advanced/src/advanced_omi_backend/workers/obsidian_jobs.py
  • backends/advanced/tests/test_obsidian_service.py
  • backends/advanced/webui/src/components/MemorySettings.tsx
  • backends/advanced/webui/src/pages/Chat.tsx
  • backends/advanced/webui/src/pages/Upload.tsx
  • backends/advanced/webui/src/services/api.ts
  • services.py
  • status.py
  • wizard.py
💤 Files with no reviewable changes (1)
  • backends/advanced/src/advanced_omi_backend/controllers/system_controller.py
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.py: Use Black formatter with 100-character line length for Python code
Use isort for Python import organization
ALL imports must be at the top of the file after the docstring - never import modules in the middle of functions or files
Group imports in Python files: standard library, third-party, then local imports
Use lazy imports sparingly and only when absolutely necessary for circular import issues in Python
Always raise errors in Python, never silently ignore - use explicit error handling with proper exceptions rather than silent failures
Avoid defensive hasattr() checks in Python - research and understand input/response or class structure instead

Files:

  • services.py
  • backends/advanced/src/advanced_omi_backend/utils/file_utils.py
  • backends/advanced/src/advanced_omi_backend/routers/modules/__init__.py
  • backends/advanced/src/advanced_omi_backend/utils/config_utils.py
  • backends/advanced/src/advanced_omi_backend/utils/model_utils.py
  • backends/advanced/src/advanced_omi_backend/routers/api_router.py
  • backends/advanced/src/advanced_omi_backend/services/obsidian_service.py
  • backends/advanced/src/advanced_omi_backend/llm_client.py
  • backends/advanced/src/advanced_omi_backend/chat_service.py
  • backends/advanced/tests/test_obsidian_service.py
  • backends/advanced/src/advanced_omi_backend/routers/modules/health_routes.py
  • backends/advanced/src/advanced_omi_backend/routers/modules/obsidian_routes.py
  • backends/advanced/src/advanced_omi_backend/routers/modules/chat_routes.py
  • backends/advanced/src/advanced_omi_backend/services/memory/config.py
  • backends/advanced/src/advanced_omi_backend/services/memory/providers/llm_providers.py
  • backends/advanced/src/advanced_omi_backend/workers/obsidian_jobs.py
  • status.py
  • backends/advanced/src/advanced_omi_backend/routers/modules/system_routes.py
  • wizard.py
  • backends/advanced/src/advanced_omi_backend/services/neo4j_client.py
app/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use TypeScript following standard React Native conventions for mobile app development

Files:

  • app/app/index.tsx
  • app/app/components/ObsidianIngest.tsx
🧠 Learnings (1)
📚 Learning: 2025-12-08T23:52:34.959Z
Learnt from: AnkushMalaker
Repo: chronicler-ai/chronicle PR: 178
File: backends/advanced/src/advanced_omi_backend/services/memory/providers/mycelia.py:218-223
Timestamp: 2025-12-08T23:52:34.959Z
Learning: In Python code (chronicle project), prefer logging.exception() inside except blocks to automatically log the full stack trace. When re-raising exceptions, always chain with 'raise ... from e' to preserve the original context; use 'raise ... from None' only if you explicitly want to suppress the context. This improves debuggability across Python files.

Applied to files:

  • services.py
  • backends/advanced/src/advanced_omi_backend/utils/file_utils.py
  • backends/advanced/src/advanced_omi_backend/routers/modules/__init__.py
  • backends/advanced/src/advanced_omi_backend/utils/config_utils.py
  • backends/advanced/src/advanced_omi_backend/utils/model_utils.py
  • backends/advanced/src/advanced_omi_backend/routers/api_router.py
  • backends/advanced/src/advanced_omi_backend/services/obsidian_service.py
  • backends/advanced/src/advanced_omi_backend/llm_client.py
  • backends/advanced/src/advanced_omi_backend/chat_service.py
  • backends/advanced/tests/test_obsidian_service.py
  • backends/advanced/src/advanced_omi_backend/routers/modules/health_routes.py
  • backends/advanced/src/advanced_omi_backend/routers/modules/obsidian_routes.py
  • backends/advanced/src/advanced_omi_backend/routers/modules/chat_routes.py
  • backends/advanced/src/advanced_omi_backend/services/memory/config.py
  • backends/advanced/src/advanced_omi_backend/services/memory/providers/llm_providers.py
  • backends/advanced/src/advanced_omi_backend/workers/obsidian_jobs.py
  • status.py
  • backends/advanced/src/advanced_omi_backend/routers/modules/system_routes.py
  • wizard.py
  • backends/advanced/src/advanced_omi_backend/services/neo4j_client.py
🧬 Code graph analysis (11)
app/app/index.tsx (1)
app/app/components/ObsidianIngest.tsx (1)
  • ObsidianIngest (10-91)
backends/advanced/src/advanced_omi_backend/services/obsidian_service.py (5)
backends/advanced/src/advanced_omi_backend/services/memory/providers/llm_providers.py (2)
  • generate_openai_embeddings (75-91)
  • chunk_text_with_spacy (102-155)
backends/advanced/src/advanced_omi_backend/services/memory/config.py (1)
  • load_config_yml (67-83)
backends/advanced/src/advanced_omi_backend/utils/model_utils.py (1)
  • get_model_config (11-45)
backends/advanced/src/advanced_omi_backend/utils/config_utils.py (1)
  • resolve_value (7-20)
backends/advanced/src/advanced_omi_backend/services/neo4j_client.py (5)
  • Neo4jClient (7-32)
  • close (26-29)
  • reset (31-32)
  • session (20-24)
  • session (42-43)
backends/advanced/src/advanced_omi_backend/llm_client.py (3)
backends/advanced/src/advanced_omi_backend/services/memory/config.py (1)
  • load_config_yml (67-83)
backends/advanced/init.py (1)
  • load_config_yml (129-143)
backends/advanced/src/advanced_omi_backend/utils/config_utils.py (1)
  • resolve_value (7-20)
backends/advanced/webui/src/pages/Chat.tsx (1)
backends/advanced/webui/src/services/api.ts (1)
  • chatApi (250-289)
backends/advanced/src/advanced_omi_backend/chat_service.py (4)
backends/advanced/src/advanced_omi_backend/services/memory/base.py (1)
  • MemoryEntry (26-63)
backends/advanced/src/advanced_omi_backend/services/obsidian_service.py (3)
  • get_obsidian_service (460-469)
  • ObsidianSearchError (56-61)
  • search_obsidian (387-453)
backends/advanced/src/advanced_omi_backend/models/user.py (1)
  • user_id (71-73)
backends/advanced/src/advanced_omi_backend/routers/modules/chat_routes.py (1)
  • get_session_messages (240-281)
backends/advanced/tests/test_obsidian_service.py (1)
backends/advanced/src/advanced_omi_backend/services/obsidian_service.py (5)
  • ObsidianSearchError (56-61)
  • search_obsidian (387-453)
  • setup_database (165-184)
  • chunking_and_embedding (246-294)
  • ingest_note_and_chunks (296-345)
backends/advanced/webui/src/components/MemorySettings.tsx (1)
backends/advanced/webui/src/contexts/AuthContext.tsx (1)
  • useAuth (115-121)
backends/advanced/webui/src/pages/Upload.tsx (1)
backends/advanced/webui/src/services/api.ts (1)
  • obsidianApi (230-247)
backends/advanced/src/advanced_omi_backend/services/memory/config.py (4)
backends/advanced/src/advanced_omi_backend/model_registry.py (1)
  • get_models_registry (338-353)
backends/advanced/src/advanced_omi_backend/utils/config_utils.py (1)
  • resolve_value (7-20)
backends/advanced/src/advanced_omi_backend/models/conversation.py (1)
  • MemoryProvider (29-34)
backends/advanced/init.py (1)
  • load_config_yml (129-143)
backends/advanced/src/advanced_omi_backend/routers/modules/system_routes.py (1)
backends/advanced/src/advanced_omi_backend/controllers/system_controller.py (2)
  • get_memory_config_raw (257-277)
  • update_memory_config_raw (280-315)
backends/advanced/src/advanced_omi_backend/services/neo4j_client.py (1)
backends/advanced/src/advanced_omi_backend/services/obsidian_service.py (1)
  • close (157-159)
🪛 Ruff (0.14.10)
backends/advanced/src/advanced_omi_backend/utils/file_utils.py

65-65: Consider moving this statement to an else block

(TRY300)


68-68: Use logging.exception instead of logging.error

Replace with exception

(TRY400)


72-72: Use logging.exception instead of logging.error

Replace with exception

(TRY400)


76-76: Use logging.exception instead of logging.error

Replace with exception

(TRY400)


80-80: Use logging.exception instead of logging.error

Replace with exception

(TRY400)

backends/advanced/src/advanced_omi_backend/utils/model_utils.py

39-39: Avoid specifying long messages outside the exception class

(TRY003)


45-45: Avoid specifying long messages outside the exception class

(TRY003)

backends/advanced/src/advanced_omi_backend/services/obsidian_service.py

110-110: Avoid specifying long messages outside the exception class

(TRY003)


114-114: Avoid specifying long messages outside the exception class

(TRY003)


138-138: Avoid specifying long messages outside the exception class

(TRY003)


284-284: Redundant exception object included in logging.exception call

(TRY401)


288-288: zip() without an explicit strict= parameter

Add explicit value for parameter strict=

(B905)


318-318: Probable use of insecure hash functions in hashlib: md5

(S324)


363-363: Avoid specifying long messages outside the exception class

(TRY003)


383-383: Use explicit conversion flag

Replace with conversion flag

(RUF010)


407-407: Use logging.exception instead of logging.error

Replace with exception

(TRY400)


450-450: Use logging.exception instead of logging.error

Replace with exception

(TRY400)

backends/advanced/src/advanced_omi_backend/chat_service.py

337-341: Use logging.exception instead of logging.error

Replace with exception

(TRY400)


344-344: Use logging.exception instead of logging.error

Replace with exception

(TRY400)


345-345: Use raise without specifying exception name

Remove exception name

(TRY201)

backends/advanced/src/advanced_omi_backend/routers/modules/health_routes.py

97-97: Undefined name _load_root_config

(F821)


104-104: Undefined name _resolve_value

(F821)


105-105: Undefined name _resolve_value

(F821)


108-108: Use raise without specifying exception name

Remove exception name

(TRY201)

backends/advanced/src/advanced_omi_backend/routers/modules/obsidian_routes.py

34-34: Unused function argument: current_user

(ARG001)


34-34: Do not perform function call Depends in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable

(B008)


45-45: Consider moving this statement to an else block

(TRY300)


46-46: Do not catch blind exception: Exception

(BLE001)


47-47: Use logging.exception instead of logging.error

Replace with exception

(TRY400)


48-48: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)


53-53: Do not perform function call File in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable

(B008)


54-54: Unused function argument: current_user

(ARG001)


54-54: Do not perform function call Depends in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable

(B008)


82-82: Use logging.exception instead of logging.error

Replace with exception

(TRY400)


83-83: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)


89-89: Redundant exception object included in logging.exception call

(TRY401)


90-90: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)


92-92: Use logging.exception instead of logging.error

Replace with exception

(TRY400)


93-93: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)


112-112: Redundant exception object included in logging.exception call

(TRY401)


113-113: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)


119-119: Do not catch blind exception: Exception

(BLE001)


126-126: Unused function argument: current_user

(ARG001)


126-126: Do not perform function call Depends in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable

(B008)


150-150: Consider moving this statement to an else block

(TRY300)


152-152: Redundant exception object included in logging.exception call

(TRY401)


153-153: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)


166-166: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)


170-170: Unused function argument: current_user

(ARG001)


170-170: Do not perform function call Depends in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable

(B008)


221-221: Do not use bare except

(E722)


222-222: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)


223-223: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)

backends/advanced/src/advanced_omi_backend/services/memory/config.py

83-83: Avoid specifying long messages outside the exception class

(TRY003)


102-102: PEP 484 prohibits implicit Optional

Convert to T | None

(RUF013)


315-315: Use raise without specifying exception name

Remove exception name

(TRY201)

backends/advanced/src/advanced_omi_backend/services/memory/providers/llm_providers.py

284-284: Use logging.exception instead of logging.error

Replace with exception

(TRY400)

backends/advanced/src/advanced_omi_backend/workers/obsidian_jobs.py

20-20: Loop control variable root not used within loop body

Rename unused root to _root

(B007)


29-29: Unused function argument: job_id

(ARG001)


29-29: Unused function argument: redis_client

(ARG001)


47-47: Redundant exception object included in logging.exception call

(TRY401)


93-93: Do not catch blind exception: Exception

(BLE001)


94-94: Use logging.exception instead of logging.error

Replace with exception

(TRY400)

status.py

60-60: Local variable dotenv_values referenced before assignment

(F823)

backends/advanced/src/advanced_omi_backend/routers/modules/system_routes.py

88-88: Unused function argument: current_user

(ARG001)


88-88: Do not perform function call Depends in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable

(B008)


95-95: Unused function argument: current_user

(ARG001)


95-95: Do not perform function call Depends in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable

(B008)


103-103: Unused function argument: current_user

(ARG001)


103-103: Do not perform function call Depends in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable

(B008)

wizard.py

400-400: f-string without any placeholders

Remove extraneous f prefix

(F541)


408-408: f-string without any placeholders

Remove extraneous f prefix

(F541)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: robot-tests
🔇 Additional comments (37)
backends/advanced/pyproject.toml (2)

13-13: LGTM! New dependencies for Obsidian/Neo4j integration.

The neo4j>=5.0.0,<6.0.0 and httpx>=0.28.0,<1.0.0 dependencies are properly version-constrained and align with the new Obsidian ingestion and Neo4j graph storage features.

Also applies to: 21-21


59-59: PR #3250 async fix is merged into main. The commit "Improve async handling in AsyncMemory class for better performance (#3250)" (dated 2025-08-12) is present in the main branch, along with subsequent AsyncMemory improvements. The async-client-unbound-var-fix branch no longer exists, confirming the fix has been integrated. The dependency change is safe.

backends/advanced/webui/src/components/MemorySettings.tsx (2)

134-136: LGTM! Correct placement of admin check after hooks.

The early return is properly placed after all hook calls (useState, useEffect, useAuth), which complies with React's Rules of Hooks.


34-42: Good improvement: Granular error handling for different HTTP status codes.

Distinguishing between 401 (unauthorized), 404/405 (missing endpoints), and other errors provides clearer feedback to administrators.

backends/advanced/webui/src/pages/Upload.tsx (1)

190-212: LGTM! Polling logic with proper cleanup.

The useEffect correctly clears the interval on unmount or when dependencies change. The polling stops appropriately when status is 'completed' or 'failed'.

backends/advanced/src/advanced_omi_backend/routers/modules/system_routes.py (1)

86-90: LGTM! Updated docstrings clarify config.yml usage.

The docstring updates accurately reflect that configuration is managed via config.yml.

backends/advanced/src/advanced_omi_backend/chat_service.py (2)

287-287: LGTM! Return type updated to List[MemoryEntry] with correct attribute access.

The change from List[Dict] to List[MemoryEntry] is correctly reflected in attribute access patterns (.id, .content instead of .get()).

Also applies to: 310-310, 319-319


324-335: Obsidian integration correctly retrieves and formats context.

The integration properly handles the search result structure and formats entries into the context with appropriate logging.

backends/advanced/src/advanced_omi_backend/services/neo4j_client.py (2)

7-33: LGTM! Clean lazy initialization pattern for Neo4j driver.

The driver is created on first use and properly closed/reset. The close() method handles the None case correctly.


45-53: Note: run() eagerly consumes results, which may not suit all use cases.

The comment at lines 48-49 correctly documents this limitation. For queries returning large result sets, callers should use session() directly. This is a good design with clear documentation.

app/app/index.tsx (1)

31-31: LGTM! Clean integration of Obsidian ingestion UI.

The import and conditional rendering of the ObsidianIngest component follows the existing patterns in the file. Properly gated by authentication status and receives the necessary props (backendUrl and jwtToken) for API communication.

Also applies to: 542-548

backends/advanced/src/advanced_omi_backend/routers/api_router.py (1)

18-18: LGTM! Obsidian router properly integrated.

The obsidian_router import and registration follow the established pattern for other routers in this module. Import is correctly placed at the top with other router imports, and the include_router call maintains consistency with the existing structure.

Also applies to: 38-38

backends/advanced/webui/src/pages/Chat.tsx (2)

47-47: LGTM! State initialization follows React conventions.

The boolean state for controlling Obsidian memory inclusion is properly initialized with a sensible default (false).


519-531: LGTM! Clean checkbox implementation for Obsidian memory.

The checkbox UI properly binds to the state variable and provides clear labeling for users. The implementation follows React patterns and integrates well with the existing input area layout.

services.py (1)

77-86: LGTM! Obsidian profile activation logic is sound.

The conditional profile activation for Neo4j/Obsidian integration follows the same pattern as the HTTPS profile handling. The placeholder detection correctly handles both hyphen and underscore variants.

backends/advanced/src/advanced_omi_backend/routers/modules/__init__.py (1)

23-23: LGTM! Module exports properly updated.

The obsidian_router import and all export follow the established pattern and maintain alphabetical ordering with other router modules.

Also applies to: 36-36

wizard.py (1)

390-397: LGTM! Obsidian configuration detection logic is sound.

The code properly detects Neo4j/Obsidian configuration by checking the .env file and validating that NEO4J_HOST is set to a non-placeholder value. The logic correctly gates on successful advanced backend setup.

backends/advanced/src/advanced_omi_backend/utils/config_utils.py (1)

1-20: LGTM! Clean and well-designed utility function.

The resolve_value function correctly implements environment variable resolution with default value support. The logic handles edge cases appropriately (e.g., multiple :- occurrences via split(":-", 1)), and the implementation follows Python best practices with proper type hints and documentation.

backends/advanced/src/advanced_omi_backend/llm_client.py (2)

59-62: LGTM! Config-driven initialization aligns with new architecture.

The removal of environment variable fallbacks in favor of explicit parameter passing aligns with the registry/config.yml-based configuration approach. The comment clearly documents this design decision, and the subsequent validation (line 63) ensures all required parameters are provided.


12-15: Remove unused imports on lines 14-15.

The imports _load_root_config and _resolve_value are not used anywhere in the file. Remove them per coding guidelines.

backends/advanced/src/advanced_omi_backend/utils/model_utils.py (1)

1-46: LGTM!

Clean utility function with proper error handling. The descriptive error messages (flagged by TRY003) are appropriate here for debugging configuration issues—creating custom exception classes would be over-engineering for this simple use case.

backends/advanced/src/advanced_omi_backend/routers/modules/chat_routes.py (2)

33-34: LGTM!

Clean addition of the optional include_obsidian_memory field with a sensible default of False, ensuring backward compatibility.


310-315: LGTM!

The new parameter is correctly propagated to the chat service's streaming response generator.

backends/advanced/src/advanced_omi_backend/services/memory/providers/llm_providers.py (1)

75-91: LGTM!

Well-structured async helper function that centralizes embedding generation with Langfuse tracing support. This enables reuse across the codebase (e.g., ObsidianService).

status.py (1)

48-67: LGTM!

Good logic for detecting Obsidian profile eligibility by checking for a valid NEO4J_HOST value (excluding placeholder strings). The multi-profile support allows combining https and obsidian profiles correctly.

backends/advanced/tests/test_obsidian_service.py (3)

1-57: LGTM!

Well-structured test setup with comprehensive mocking of external dependencies (config, embeddings, Neo4j, environment). The use of addCleanup ensures proper teardown.


58-105: LGTM!

Thorough test of the search flow—verifies embedding generation, Cypher query execution with correct parameters, and result formatting including tags and links.


166-189: LGTM!

Good coverage of error paths. Tests correctly verify that ObsidianSearchError is raised with appropriate stage values ('embedding' vs 'database') for different failure scenarios.

backends/advanced/docker-compose.yml (1)

178-199: LGTM on Neo4j service configuration.

Good setup with:

  • APOC plugins enabled with proper security allowlists
  • Reasonable memory limits (512m–2G heap)
  • Data persistence via volumes
  • Conditional startup via obsidian profile
app/app/components/ObsidianIngest.tsx (1)

17-59: LGTM!

Clean implementation with proper validation, URL normalization for WebSocket URLs, authentication handling, and appropriate user feedback via Alerts. The loading state management is correct.

backends/advanced/src/advanced_omi_backend/workers/obsidian_jobs.py (2)

28-42: LGTM on job structure and meta tracking.

Good implementation with proper job meta initialization and persistence. The job_id and redis_client parameters are likely required by the @async_job decorator contract, so the unused argument warnings are false positives.


74-80: Good cancellation support.

Nice pattern for checking job cancellation status mid-processing, allowing graceful termination of long-running vault ingestion jobs.

backends/advanced/webui/src/services/api.ts (2)

230-247: LGTM! Clean API implementation following existing patterns.

The obsidianApi object correctly mirrors the file upload pattern from uploadApi, with appropriate timeout (5 minutes) for large vault uploads and proper progress tracking. The endpoint structure aligns with the backend routes.


271-278: LGTM! Optional parameter handling is correct.

The includeObsidianMemory parameter is properly handled as optional, only adding it to the request body when truthy.

backends/advanced/src/advanced_omi_backend/services/obsidian_service.py (1)

317-318: MD5 usage is acceptable here for non-security chunk ID generation.

The static analysis flags MD5 as insecure, but this is a false positive - MD5 is being used for deterministic chunk identification (path + index), not for cryptographic security. This pattern is appropriate for content-addressable storage keys.

backends/advanced/src/advanced_omi_backend/services/memory/config.py (2)

67-83: LGTM! Clean config loading with proper fallback paths.

The function correctly handles multiple config locations (Docker container, relative paths, current directory) and provides a helpful error message listing all searched paths when not found.


115-147: LGTM! Well-structured configuration factory functions.

Both create_openai_config and create_qdrant_config follow good patterns with clear defaults and appropriate use of keyword-only arguments.

Comment on lines 41 to 42
neo4j-mem0:
condition: service_started
Copy link
Contributor

@coderabbitai coderabbitai bot Dec 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# First, check the file exists and read the relevant sections
if [ -f "backends/advanced/docker-compose.yml" ]; then
  echo "=== Lines 35-50 (around depends_on) ==="
  sed -n '35,50p' backends/advanced/docker-compose.yml | cat -n
  
  echo -e "\n=== Lines 170-210 (around neo4j-mem0 definition) ==="
  sed -n '170,210p' backends/advanced/docker-compose.yml | cat -n
  
  echo -e "\n=== Full depends_on references ==="
  rg -n "depends_on" backends/advanced/docker-compose.yml -A 4 -B 1
else
  echo "File not found"
fi

Repository: chronicler-ai/chronicle

Length of output: 2970


🌐 Web query:

Docker Compose profiles with depends_on - how does it handle dependencies on profiled services

💡 Result:

Short answer

  • Docker Compose only includes services whose profiles are active (services without profiles are always included). If a service depends_on another service that's excluded by profiles, the model is invalid and Compose may error. [1][2]
  • If you explicitly target a profiled service on the command line, Compose auto-enables that service's profile (so its own depends_on entries that are included will be started). Compose does NOT automatically enable profiles required by its dependencies — those dependencies must be either unprofiled, share the same profile, or have their profile enabled explicitly. [1][2]

Practical rules

  • Keep core deps unprofiled, or
  • Put dependent services and their dependencies in the same profile, or
  • Enable needed profiles via --profile or COMPOSE_PROFILES when you run up. [1][2]

Sources
[1] Docker Docs — Using profiles with Compose.
[2] Docker Compose file reference — profiles (Compose reference).


Unconditional dependency on profiled service will cause startup failure.

The chronicle-backend service depends unconditionally on neo4j-mem0, but neo4j-mem0 is only started when the obsidian profile is active. Docker Compose does not automatically enable profiles required by a service's dependencies, so running docker compose up without --profile obsidian will fail because the dependency is not satisfied.

Options to fix:

  1. Add profiles: [obsidian] to chronicle-backend so both services share the same profile, or
  2. Remove neo4j-mem0 from the profiles list to make it always available, or
  3. Require users to explicitly enable the profile via --profile obsidian or COMPOSE_PROFILES=obsidian.
🤖 Prompt for AI Agents
In backends/advanced/docker-compose.yml around lines 41-42, chronicle-backend
currently lists neo4j-mem0 as a dependency but neo4j-mem0 is only started under
the obsidian profile, causing startup failures when the profile is not enabled;
fix by making the dependency available under the same profile—add profiles:
[obsidian] to the chronicle-backend service so both services share the obsidian
profile (alternatively, remove neo4j-mem0 from profiles to make it always
available or update docs to require running with --profile
obsidian/COMPOSE_PROFILES=obsidian).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coderabbitai Require users to explicitly enable the profile via --profile obsidian or COMPOSE_PROFILES=obsidian.
yeah third one is what I want. So? how do i make it work with the ./wizard.sh and init flows?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check wizard.py for Obsidian-related logic
echo "=== wizard.py Obsidian detection ==="
rg -n "obsidian|NEO4J" wizard.py -C 5 -i

echo -e "\n=== services.py profile handling ==="
rg -n "obsidian|profile|NEO4J" services.py -C 5 -i

echo -e "\n=== status.py profile handling ==="
rg -n "obsidian|profile|NEO4J" status.py -C 5 -i

echo -e "\n=== Check if .env.example mentions NEO4J ==="
fd -t f "\.env" backends/advanced/ --exec rg -l "NEO4J" {}

Length of output: 5985


🏁 Script executed:

#!/bin/bash
# Check the .env.template for NEO4J configuration
echo "=== backends/advanced/.env.template NEO4J section ==="
rg -n "NEO4J" backends/advanced/.env.template -C 3

echo -e "\n=== Check if there's documentation about Obsidian setup ==="
fd -t f "README" backends/advanced/ --exec cat {}

Length of output: 54674


@AnkushMalaker Good news - the infrastructure is already in place! Your scripts already auto-detect and enable the obsidian profile. Here's how it works:

Current Workflow (Already Implemented ✅)

  1. User runs wizard/init:

    ./wizard.sh
  2. User configures NEO4J settings in .env:

    NEO4J_HOST=neo4j-mem0
    NEO4J_USER=neo4j
    NEO4J_PASSWORD=your_password
  3. services.py auto-detects and enables profile:

    • When starting backend, it checks if NEO4J_HOST is set and not a placeholder
    • Automatically adds --profile obsidian to the docker compose command
    • Both chronicle-backend and neo4j-mem0 start together
  4. wizard.py shows confirmation:

    • Detects Obsidian config after setup
    • Prints: "📚 Obsidian Integration Detected"

The One Issue: Direct Docker Compose Usage

The only problem is if someone runs docker compose up directly (bypassing your scripts), they'll hit the error because of the unconditional depends_on.

Solution: Make neo4j-mem0 Dependency Conditional

Update the depends_on section in docker-compose.yml:

depends_on:
  qdrant:
    condition: service_started
  mongo:
    condition: service_healthy
  redis:
    condition: service_healthy
  # Remove neo4j-mem0 from here - it's optional and controlled by profile

Then add a note in your documentation or startup scripts that neo4j-mem0 will only start when:

  • NEO4J_HOST is configured in .env
  • The obsidian profile is enabled (automatically by services.py)

Alternative: Keep Current Setup + Documentation

If you want to keep the unconditional dependency, just document that users must use your scripts:

# ✅ Correct way (uses services.py which handles profiles)
./wizard.sh
# or
python services.py start backend

# ❌ Don't do this (will fail if profile not enabled)
docker compose up

Verification

Your system already works! Test it:


🏁 Script executed:

#!/bin/bash
# Show that services.py already handles the profile
echo "=== services.py obsidian profile handling ==="
rg -n "Enable obsidian profile" backends/advanced/services.py -C 3

echo -e "\n=== Check .env.template has NEO4J defaults ==="
cat backends/advanced/.env.template | rg "NEO4J" -A 1 -B 1

echo -e "\n=== Verify wizard.py shows obsidian detection message ==="
rg -n "Obsidian Integration Detected" wizard.py -C 2

Length of output: 612


🏁 Script executed:

#!/bin/bash
# Check services.py at root level
echo "=== Find services.py location ==="
fd -t f "services.py" | head -5

echo -e "\n=== services.py obsidian profile handling ==="
rg -n "Enable obsidian profile" services.py -C 3

echo -e "\n=== Show complete profile handling in services.py ==="
rg -n "obsidian" services.py -C 5 -i

Length of output: 1607


Perfect! Now I can see the complete picture. Your system already works correctly! 🎉

Summary: How It Already Works### The Workflow That's Already Implemented:

  1. User runs wizard:

    ./wizard.sh  # or ./init.sh
  2. User configures NEO4J in .env:

    • During setup or manually edit backends/advanced/.env
    • Sets NEO4J_HOST=neo4j-mem0
  3. services.py auto-enables obsidian profile:

    • Lines 78-86 detect NEO4J_HOST is set
    • Automatically add --profile obsidian to docker compose command
    • Both chronicle-backend AND neo4j-mem0 start together ✅
  4. wizard.py confirms to user:

    • Lines 406-410 show: "📚 Obsidian Integration Detected"
    • Tells user Neo4j will start automatically

The Problem & Solution

Problem: The unconditional depends_on: neo4j-mem0 in docker-compose.yml will cause failures if someone runs docker compose up directly (bypassing your services.py script).

Recommended Solution: Remove neo4j-mem0 from the unconditional depends_on list:

# In backends/advanced/docker-compose.yml
depends_on:
  qdrant:
    condition: service_started
  mongo:
    condition: service_healthy
  redis:
    condition: service_healthy
  # neo4j-mem0:  <-- REMOVE THIS
  #   condition: service_started

Why This Works:

  1. Through scripts (recommended path):

    • User runs ./wizard.sh → configures .envservices.py automatically adds --profile obsidian
    • Both services start together because the profile pulls in neo4j-mem0
  2. Direct docker compose (edge case):

    • If someone runs docker compose up directly WITHOUT the profile:
      • chronicle-backend starts normally
      • neo4j-mem0 doesn't start (because profile not enabled)
      • No error! Backend just runs without Obsidian features
  3. With NEO4J configured:

    • User runs python services.py start backend
    • Script detects NEO4J_HOST → adds --profile obsidian
    • Both services start correctly

Documentation Update

Add this to your docs or README:

## Obsidian Integration

The Obsidian/Neo4j integration is **automatically enabled** when you:

1. Set `NEO4J_HOST` in `backends/advanced/.env`
2. Start services via the wizard or `python services.py start backend`

**✅ Recommended (handles profiles automatically):**
```bash
./wizard.sh                          # Initial setup
python services.py start backend     # Start backend

# Or use shortcuts
./services.sh start advanced         # If you have service shortcuts

⚠️ Direct docker compose usage:

# If you must use docker compose directly:
cd backends/advanced
docker compose --profile obsidian up -d

# Or set environment variable:
COMPOSE_PROFILES=obsidian docker compose up -d

The wizard and services scripts automatically detect your Obsidian configuration and enable the profile for you.


## Summary

**You don't need to change anything in your scripts!** Your wizard.sh and init flows already handle this correctly via `services.py`.

The only change needed is:
1. **Remove** the unconditional `depends_on: neo4j-mem0` from docker-compose.yml (it's redundant since the profile handles the relationship)
2. **Document** that users should use your scripts (not raw docker compose)

Your infrastructure is solid! 🚀

<!-- This is an auto-generated reply by CodeRabbit -->

Comment on lines 95 to 108
# Load model config once for display fields
try:
_cfg = _load_root_config() or {}
_defaults = _cfg.get("defaults", {}) or {}
_models = _cfg.get("models", []) or []
_llm_name = _defaults.get("llm")
_stt_name = _defaults.get("stt")
_llm_def = next((m for m in _models if m.get("name") == _llm_name), None)
_llm_provider = (_llm_def.get("model_provider") if _llm_def else None) or "openai"
_llm_model = str(_resolve_value(_llm_def.get("model_name", ""))) if _llm_def else None
_llm_base_url = str(_resolve_value(_llm_def.get("model_url", ""))) if _llm_def else None
except Exception as e:
_llm_provider, _llm_model, _llm_base_url, _stt_name = "openai", None, None, None
raise e
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: Undefined functions _load_root_config and _resolve_value will cause runtime NameError.

These functions are called but never defined or imported. The /health endpoint will fail with NameError when accessed.

Additionally, the exception handling is inconsistent: it sets fallback values but then immediately re-raises the exception, so the fallback values are never used.

🔎 Suggested fix options

Option 1: Import the missing functions if they exist elsewhere:

+from advanced_omi_backend.services.memory.config import _load_root_config, _resolve_value

Option 2: If fallback behavior is intended, remove the re-raise:

     except Exception as e:
         _llm_provider, _llm_model, _llm_base_url, _stt_name = "openai", None, None, None
-        raise e
+        logger.warning(f"Failed to load model config, using defaults: {e}")

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 Ruff (0.14.10)

97-97: Undefined name _load_root_config

(F821)


104-104: Undefined name _resolve_value

(F821)


105-105: Undefined name _resolve_value

(F821)


108-108: Use raise without specifying exception name

Remove exception name

(TRY201)

🤖 Prompt for AI Agents
In backends/advanced/src/advanced_omi_backend/routers/modules/health_routes.py
around lines 95 to 108, the code calls _load_root_config and _resolve_value but
those functions are not defined or imported (causing NameError at runtime) and
the except block sets fallback values then re-raises the exception (making
fallbacks useless); fix by importing or defining _load_root_config and
_resolve_value at the top of the module (or replace calls with the correct
functions from their source), and if fallbacks are intended remove the raise in
the except block so the fallback values are used (or alternatively keep the
raise but remove the fallback assignments) to make behavior consistent.

Comment on lines +221 to +223
except:
raise HTTPException(status_code=500, detail="Failed to get job status")
raise HTTPException(status_code=404, detail="Job not found")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Replace bare except with specific exception type.

Bare except catches all exceptions including KeyboardInterrupt and SystemExit, making debugging difficult. Catch the specific exception you expect.

🔎 Proposed fix
             try:
                 job_data = json.loads(pending_data)
                 return {
                     "job_id": job_id,
                     "status": "ready",
                     "total": job_data.get("total", 0),
                     "processed": 0,
                     "percent": 0,
                     "errors": [],
                     "vault_path": job_data.get("vault_path")
                 }
-            except:
-                raise HTTPException(status_code=500, detail="Failed to get job status")
-        raise HTTPException(status_code=404, detail="Job not found")
+            except json.JSONDecodeError as e:
+                raise HTTPException(status_code=500, detail="Failed to get job status") from e
+        raise HTTPException(status_code=404, detail="Job not found") from None
🧰 Tools
🪛 Ruff (0.14.10)

221-221: Do not use bare except

(E722)


222-222: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)


223-223: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)

🤖 Prompt for AI Agents
In backends/advanced/src/advanced_omi_backend/routers/modules/obsidian_routes.py
around lines 221 to 223, the code uses a bare except which should be replaced
with a specific exception handler; identify the exception(s) that can be raised
by the job lookup (e.g., KeyError, LookupError, or the client-specific
exception), catch those explicitly (e.g., except KeyError as e or except
ClientError as e), and propagate a 500 HTTPException including the captured
exception message for diagnostics; avoid catching
BaseException/SystemExit/KeyboardInterrupt and ensure any unexpected exceptions
bubble up or are logged separately.


// Send message and handle streaming response
const response = await chatApi.sendMessage(messageText, sessionId)
const response = await chatApi.sendMessage(messageText, sessionId, includeObsidian)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, let's check the sendMessage function definition and calls
rg -n -A 3 'sendMessage.*includeObsidian' --type=ts

Repository: chronicler-ai/chronicle

Length of output: 832


🏁 Script executed:

# Also check the Chat.tsx file around line 203
cat -n backends/advanced/webui/src/pages/Chat.tsx | sed -n '200,210p'

Repository: chronicler-ai/chronicle

Length of output: 527


🏁 Script executed:

# Check the API definition in api.ts around lines 249-288
cat -n backends/advanced/webui/src/services/api.ts | sed -n '245,290p'

Repository: chronicler-ai/chronicle

Length of output: 2134


🏁 Script executed:

# Search for the definition of includeObsidian in Chat.tsx
rg -n 'includeObsidian' backends/advanced/webui/src/pages/Chat.tsx

Repository: chronicler-ai/chronicle

Length of output: 457


Align variable name with API parameter for code clarity.

The variable includeObsidian passed at Chat.tsx:203 does not match the API parameter name includeObsidianMemory defined in api.ts:271. While positional arguments work at runtime, rename the variable to includeObsidianMemory to maintain naming consistency and avoid confusion about what "Obsidian" refers to in this context.

🤖 Prompt for AI Agents
In backends/advanced/webui/src/pages/Chat.tsx around line 203, the call passes
includeObsidian to chatApi.sendMessage while the API parameter is named
includeObsidianMemory; rename the local variable (and its declarations/usages)
from includeObsidian to includeObsidianMemory so the argument name matches the
API parameter for clarity, update any references (state, props, handlers) in
this file to the new name, and ensure imports/exports or prop types are updated
accordingly to avoid type/compile errors.

@github-actions
Copy link

⚠️ Robot Framework Test Results

Status: ❌ Some tests failed

Metric Count
✅ Passed 82
❌ Failed 9
📊 Total 91

📊 View Reports

GitHub Pages (Live Reports):

Download Artifacts:


View full workflow run

- Removed the deprecated `validate_memory_config_raw` endpoint and replaced it with a new endpoint that accepts plain text for validation.
- Updated the existing `validate_memory_config` endpoint to clarify that it now accepts JSON input.
- Adjusted the API call in the frontend to point to the new validation endpoint.
- Updated the health check function to load model configuration from the models registry instead of the root config.
- Improved error handling by logging warnings when model configuration loading fails.
@github-actions
Copy link

⚠️ Robot Framework Test Results

Status: ❌ Some tests failed

Metric Count
✅ Passed 83
❌ Failed 8
📊 Total 91

📊 View Reports

GitHub Pages (Live Reports):

Download Artifacts:


View full workflow run

@github-actions
Copy link

🎉 Robot Framework Test Results

Status: ✅ All tests passed!

Metric Count
✅ Passed 91
❌ Failed 0
📊 Total 91

📊 View Reports

GitHub Pages (Live Reports):

Download Artifacts:


View full workflow run

@AnkushMalaker
Copy link
Collaborator Author

Merging with commits from #222

@AnkushMalaker AnkushMalaker merged commit dafe563 into dev Dec 24, 2025
1 of 2 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Jan 2, 2026
AnkushMalaker added a commit that referenced this pull request Jan 3, 2026
* audio upload extension with gdrive credentials

* FIX: API parameters

* UPDATE: tmp files cleanup n code refactored as per review

* REFACTOR: minor refactor as per review

* REFACTOR: minor update as per review

* UPDATE: gdrive sync logic

* REFACTOR: code update as per gdrive and update credential client

* REFACTOR: validation updated - as per review from CR

* UPDATE: code has been refactore for UUID for diffrent audio upload sources

* REFACTOR: updated code as per review

* Update documentation and configuration to reflect the transition from 'friend-backend' to 'chronicle-backend' across various files, including setup instructions, Docker configurations, and service logs.

* Update test script to use docker-compose-test.yml for all test-related operations

* Added standard MIT license

* Fix/cleanup model (#219)

* refactor memory

* add config

* docstring

* more cleanup

* code quality

* code quality

* unused return

* DOTTED GET

* Refactor Docker and CI configurations

- Removed the creation of `memory_config.yaml` from the CI workflow to streamline the process.
- Updated Docker Compose files to mount `config.yml` for model registry and memory settings in both services.
- Added new dependencies for Google API clients in `uv.lock` to support upcoming features.

* Update configuration files for model providers and Docker setup

- Changed LLM, embedding, and STT providers in `config.yml` to OpenAI and Deepgram.
- Removed read-only flag from `config.yml` in Docker Compose files to allow UI configuration saving.
- Updated memory configuration endpoint to accept plain text for YAML input.

* Update transcription job handling to format speaker IDs

- Changed variable name from `speaker_name` to `speaker_id` for clarity.
- Added logic to convert integer speaker IDs from Deepgram to string format for consistent speaker labeling.

* Remove loading of backend .env file in test environment setup

- Eliminated the code that loads the .env file from the backends/advanced directory, simplifying the environment configuration for tests.

* Enhance configuration management and setup wizard

- Updated README to reflect the new setup wizard process.
- Added functionality to load and save `config.yml` in the setup wizard, including default configurations for LLM and memory providers.
- Improved user feedback during configuration updates, including success messages for configuration file updates.
- Enabled backup of existing `config.yml` before saving changes.

* Enhance HTTPS configuration in setup wizard

- Added functionality to check for existing SERVER_IP in the environment file and prompt the user to reuse or enter a new IP for SSL certificates.
- Improved user prompts for server IP/domain input during HTTPS setup.
- Updated default behavior to use existing IP or localhost based on user input.
- Changed RECORD_ONLY_ENROLLED_SPEAKERS setting in the .env template to false for broader access.

* Add source parameter to audio file writing in websocket controller

- Included a new `source` parameter with the value "websocket" in the `_process_batch_audio_complete` function to enhance audio file context tracking.

---------

Co-authored-by: 0xrushi <6279035+0xrushi@users.noreply.github.com>

* fix/broken-tests (#230)

* refactor memory

* add config

* docstring

* more cleanup

* code quality

* code quality

* unused return

* DOTTED GET

* Refactor Docker and CI configurations

- Removed the creation of `memory_config.yaml` from the CI workflow to streamline the process.
- Updated Docker Compose files to mount `config.yml` for model registry and memory settings in both services.
- Added new dependencies for Google API clients in `uv.lock` to support upcoming features.

* Update configuration files for model providers and Docker setup

- Changed LLM, embedding, and STT providers in `config.yml` to OpenAI and Deepgram.
- Removed read-only flag from `config.yml` in Docker Compose files to allow UI configuration saving.
- Updated memory configuration endpoint to accept plain text for YAML input.

* Update transcription job handling to format speaker IDs

- Changed variable name from `speaker_name` to `speaker_id` for clarity.
- Added logic to convert integer speaker IDs from Deepgram to string format for consistent speaker labeling.

* Remove loading of backend .env file in test environment setup

- Eliminated the code that loads the .env file from the backends/advanced directory, simplifying the environment configuration for tests.

* Enhance configuration management and setup wizard

- Updated README to reflect the new setup wizard process.
- Added functionality to load and save `config.yml` in the setup wizard, including default configurations for LLM and memory providers.
- Improved user feedback during configuration updates, including success messages for configuration file updates.
- Enabled backup of existing `config.yml` before saving changes.

* Enhance HTTPS configuration in setup wizard

- Added functionality to check for existing SERVER_IP in the environment file and prompt the user to reuse or enter a new IP for SSL certificates.
- Improved user prompts for server IP/domain input during HTTPS setup.
- Updated default behavior to use existing IP or localhost based on user input.
- Changed RECORD_ONLY_ENROLLED_SPEAKERS setting in the .env template to false for broader access.

* Add source parameter to audio file writing in websocket controller

- Included a new `source` parameter with the value "websocket" in the `_process_batch_audio_complete` function to enhance audio file context tracking.

* Refactor error handling in system controller and update memory config routes

- Replaced ValueError with HTTPException for better error handling in `save_diarization_settings` and `validate_memory_config` functions.
- Introduced a new Pydantic model, `MemoryConfigRequest`, for validating memory configuration requests in the system routes.
- Updated the `validate_memory_config` endpoint to accept the new request model, improving input handling and validation.

---------

Co-authored-by: 0xrushi <6279035+0xrushi@users.noreply.github.com>

* Feat/add obsidian 3 (#233)

* obsidian support

* neo4j comment

* cleanup code

* unused line

* unused line

* Fix MemoryEntry object usage in chat service

* comment

* feat(obsidian): add obsidian memory search integration to chat

* unit test

* use rq

* neo4j service

* typefix

* test fix

* cleanup

* cleanup

* version changes

* profile

* remove unused imports

* Refactor memory configuration validation endpoints

- Removed the deprecated `validate_memory_config_raw` endpoint and replaced it with a new endpoint that accepts plain text for validation.
- Updated the existing `validate_memory_config` endpoint to clarify that it now accepts JSON input.
- Adjusted the API call in the frontend to point to the new validation endpoint.

* Refactor health check model configuration loading

- Updated the health check function to load model configuration from the models registry instead of the root config.
- Improved error handling by logging warnings when model configuration loading fails.

---------

Co-authored-by: 0xrushi <6279035+0xrushi@users.noreply.github.com>

* Update .gitignore to exclude all files in app/ios and app/android directories (#238)

* fix: Copy full source code in speaker-recognition Dockerfile (#243)

Adds COPY src/ src/ step after dependency installation to ensure
all source files are available in the Docker image. This improves
build caching while ensuring complete source code is present.

* Enhance configuration management and add new setup scripts (#235)

* Enhance configuration management and add new setup scripts

- Updated .gitignore to include config.yml and its template.
- Added config.yml.template for default configuration settings.
- Introduced restart.sh script for service management.
- Enhanced services.py to load config.yml and check for Obsidian/Neo4j integration.
- Updated wizard.py to prompt for Obsidian/Neo4j configuration during setup and create config.yml from template if it doesn't exist.

* Refactor transcription providers and enhance configuration management

- Updated Docker Compose files to include the new Neo4j service configuration.
- Added support for Obsidian/Neo4j integration in the setup process.
- Refactored transcription providers to utilize a registry-driven approach for Deepgram and Parakeet.
- Enhanced error handling and logging in transcription processes.
- Improved environment variable management in test scripts to prioritize command-line overrides.
- Removed deprecated Parakeet provider implementation and streamlined audio stream workers.

* Update configuration management and enhance file structure, add test-matrix (#237)

* Update configuration management and enhance file structure

- Refactored configuration file paths to use a dedicated `config/` directory, including updates to `config.yml` and its template.
- Modified service scripts to load the new configuration path for `config.yml`.
- Enhanced `.gitignore` to include the new configuration files and templates.
- Updated documentation to reflect changes in configuration file locations and usage.
- Improved setup scripts to ensure proper creation and management of configuration files.
- Added new test configurations for various provider combinations to streamline testing processes.

* Add test requirements and clean up imports in wizard.py

- Introduced a new `test-requirements.txt` file to manage testing dependencies.
- Removed redundant import of `shutil` in `wizard.py` to improve code clarity.

* Add ConfigManager for unified configuration management

- Introduced a new `config_manager.py` module to handle reading and writing configurations from `config.yml` and `.env` files, ensuring backward compatibility.
- Refactored `ChronicleSetup` in `backends/advanced/init.py` to utilize `ConfigManager` for loading and updating configurations, simplifying the setup process.
- Removed redundant methods for loading and saving `config.yml` directly in `ChronicleSetup`, as these are now managed by `ConfigManager`.
- Enhanced user feedback during configuration updates, including success messages for changes made to configuration files.

* Refactor transcription provider configuration and enhance setup process

- Updated `.env.template` to clarify speech-to-text configuration and removed deprecated options for Mistral.
- Modified `docker-compose.yml` to streamline environment variable management by removing unused Mistral keys.
- Enhanced `ChronicleSetup` in `init.py` to provide clearer user feedback and updated the transcription provider selection process to rely on `config.yml`.
- Improved error handling in the websocket controller to determine the transcription provider from the model registry instead of environment variables.
- Updated health check routes to reflect the new method of retrieving the transcription provider from `config.yml`.
- Adjusted `config.yml.template` to include comments on transcription provider options for better user guidance.

* Enhance ConfigManager with deep merge functionality

- Updated the `update_memory_config` method to perform a deep merge of updates into the memory configuration, ensuring nested dictionaries are merged correctly.
- Added a new `_deep_merge` method to handle recursive merging of dictionaries, improving configuration management capabilities.

* Refactor run-test.sh and enhance memory extraction tests

- Removed deprecated environment variable handling for TRANSCRIPTION_PROVIDER in `run-test.sh`, streamlining the configuration process.
- Introduced a new `run-custom.sh` script for executing Robot tests with custom configurations, improving test flexibility.
- Enhanced memory extraction tests in `audio_keywords.robot` and `memory_keywords.robot` to include detailed assertions and result handling.
- Updated `queue_keywords.robot` to fail fast if a job is in a 'failed' state when expecting 'completed', improving error handling.
- Refactored `test_env.py` to load environment variables with correct precedence, ensuring better configuration management.

* unify tests to robot test, add some more clean up

* Update health check configuration in docker-compose-test.yml (#241)

- Increased the number of retries from 5 to 10 for improved resilience during service readiness checks.
- Extended the start period from 30s to 60s to allow more time for services to initialize before health checks commence.

* Add step to create test configuration file in robot-tests.yml

- Introduced a new step in the GitHub Actions workflow to copy the test configuration file from tests/configs/deepgram-openai.yml to a new config/config.yml.
- Added logging to confirm the creation of the test config file, improving visibility during the test setup process.

* remove cache step since not required

* coderabbit comments

* Refactor ConfigManager error handling for configuration file loading

- Updated the ConfigManager to raise RuntimeError exceptions when the configuration file is not found or is invalid, improving error visibility and user guidance.
- Removed fallback behavior that previously returned the current directory, ensuring users are explicitly informed about missing or invalid configuration files.

* Refactor _find_repo_root method in ConfigManager

- Updated the _find_repo_root method to locate the repository root using the __file__ location instead of searching for config/config.yml, simplifying the logic and improving reliability.
- Removed the previous error handling that raised a RuntimeError if the configuration file was not found, as the new approach assumes config_manager.py is always at the repo root.

* Enhance speaker recognition service integration and error handling (#245)

* Enhance speaker recognition service integration and error handling

- Updated `docker-compose-test.yml` to enable speaker recognition in the test environment and added a new `speaker-service-test` service for testing purposes.
- Refactored `run-test.sh` to improve the execution of Robot Framework tests from the repository root.
- Enhanced error handling in `speaker_recognition_client.py` to return detailed error messages for connection issues.
- Improved error logging in `speaker_jobs.py` to handle and report errors from the speaker recognition service more effectively.
- Updated `Dockerfile` to copy the full source code after dependencies are cached, ensuring all necessary files are included in the image.

* Remove integration tests workflow and enhance robot tests with HF_TOKEN verification

- Deleted the `integration-tests.yml` workflow file to streamline CI processes.
- Updated `robot-tests.yml` to include verification for the new `HF_TOKEN` secret, ensuring all required secrets are checked before running tests.

* Fix key access in system admin tests to use string indexing for speakers data

* Refactor Robot Framework tests and enhance error handling in memory services

- Removed the creation of the test environment file from the GitHub Actions workflow to streamline setup.
- Updated the Robot Framework tests to utilize a unified test script for improved consistency.
- Enhanced error messages in the MemoryService class to provide more context on connection failures for LLM and vector store providers.
- Added critical checks for API key presence in the OpenAIProvider class to ensure valid credentials are provided before proceeding.
- Adjusted various test setup scripts to use a centralized BACKEND_DIR variable for better maintainability and clarity.

* Refactor test container cleanup in run-robot-tests.sh

- Updated the script to dynamically construct container names from docker-compose services, improving maintainability and reducing hardcoded values.
- Enhanced the cleanup process for stuck test containers by utilizing the COMPOSE_PROJECT_NAME variable.

* Enhance run-robot-tests.sh for improved logging and cleanup

- Set absolute paths for consistent directory references to simplify navigation.
- Capture container logs, status, and resource usage for better debugging.
- Refactor cleanup process to utilize dynamic backend directory references, improving maintainability.
- Ensure proper navigation back to the tests directory after operations.

* Add speaker recognition configuration and update test script defaults

- Introduced speaker recognition settings in config.yml.template, allowing for easy enable/disable and service URL configuration.
- Updated run-robot-tests.sh to use a test-specific configuration file that disables speaker recognition for improved CI performance.
- Modified deepgram-openai.yml to disable speaker recognition during CI tests to enhance execution speed.

* Refactor speaker recognition configuration management

- Updated docker-compose-test.yml to clarify speaker recognition settings, now controlled via config.yml for improved CI performance.
- Enhanced model_registry.py to include a dedicated speaker_recognition field for better configuration handling.
- Modified speaker_recognition_client.py to load configuration from config.yml, allowing for dynamic enabling/disabling of the speaker recognition service based on the configuration.

* Add minimum worker count verification to infrastructure tests

- Introduced a new keyword to verify that the minimum number of workers are registered, enhancing the robustness of health checks.
- Updated the worker count validation test to include a wait mechanism for worker registration, improving test reliability.
- Clarified comments regarding expected worker counts to reflect the distinction between RQ and audio stream workers.

* Update configuration management and enhance model handling

- Added OBSIDIAN_ENABLED configuration to ChronicleSetup for improved feature toggling.
- Introduced speaker_recognition configuration handling in model_registry.py to streamline model loading.
- Refactored imports in deepgram.py to improve clarity and reduce redundancy.

* Refactor configuration management in wizard and ChronicleSetup (#246)

* Refactor configuration management in wizard and ChronicleSetup

- Updated wizard.py to read Obsidian/Neo4j configuration from config.yml, enhancing flexibility and error handling.
- Refactored ChronicleSetup to utilize ConfigManager for loading and verifying config.yml, ensuring a single source of truth.
- Improved user feedback for missing configuration files and streamlined the setup process for memory and transcription providers.

* Fix string formatting for error message in ChronicleSetup

---------

Co-authored-by: 01PrathamS <pratham21btai35@karnavatiuniversity.edu.in>
Co-authored-by: Stu Alexandere <thestumonkey@gmail.com>
Co-authored-by: Stuart Alexander <stu@theawesome.co.uk>
Co-authored-by: 0xrushi <6279035+0xrushi@users.noreply.github.com>
AnkushMalaker added a commit that referenced this pull request Jan 6, 2026
* audio upload extension with gdrive credentials

* FIX: API parameters

* UPDATE: tmp files cleanup n code refactored as per review

* REFACTOR: minor refactor as per review

* REFACTOR: minor update as per review

* UPDATE: gdrive sync logic

* REFACTOR: code update as per gdrive and update credential client

* REFACTOR: validation updated - as per review from CR

* UPDATE: code has been refactore for UUID for diffrent audio upload sources

* REFACTOR: updated code as per review

* Update documentation and configuration to reflect the transition from 'friend-backend' to 'chronicle-backend' across various files, including setup instructions, Docker configurations, and service logs.

* Update test script to use docker-compose-test.yml for all test-related operations

* Added standard MIT license

* Fix/cleanup model (#219)

* refactor memory

* add config

* docstring

* more cleanup

* code quality

* code quality

* unused return

* DOTTED GET

* Refactor Docker and CI configurations

- Removed the creation of `memory_config.yaml` from the CI workflow to streamline the process.
- Updated Docker Compose files to mount `config.yml` for model registry and memory settings in both services.
- Added new dependencies for Google API clients in `uv.lock` to support upcoming features.

* Update configuration files for model providers and Docker setup

- Changed LLM, embedding, and STT providers in `config.yml` to OpenAI and Deepgram.
- Removed read-only flag from `config.yml` in Docker Compose files to allow UI configuration saving.
- Updated memory configuration endpoint to accept plain text for YAML input.

* Update transcription job handling to format speaker IDs

- Changed variable name from `speaker_name` to `speaker_id` for clarity.
- Added logic to convert integer speaker IDs from Deepgram to string format for consistent speaker labeling.

* Remove loading of backend .env file in test environment setup

- Eliminated the code that loads the .env file from the backends/advanced directory, simplifying the environment configuration for tests.

* Enhance configuration management and setup wizard

- Updated README to reflect the new setup wizard process.
- Added functionality to load and save `config.yml` in the setup wizard, including default configurations for LLM and memory providers.
- Improved user feedback during configuration updates, including success messages for configuration file updates.
- Enabled backup of existing `config.yml` before saving changes.

* Enhance HTTPS configuration in setup wizard

- Added functionality to check for existing SERVER_IP in the environment file and prompt the user to reuse or enter a new IP for SSL certificates.
- Improved user prompts for server IP/domain input during HTTPS setup.
- Updated default behavior to use existing IP or localhost based on user input.
- Changed RECORD_ONLY_ENROLLED_SPEAKERS setting in the .env template to false for broader access.

* Add source parameter to audio file writing in websocket controller

- Included a new `source` parameter with the value "websocket" in the `_process_batch_audio_complete` function to enhance audio file context tracking.

---------

Co-authored-by: 0xrushi <6279035+0xrushi@users.noreply.github.com>

* fix/broken-tests (#230)

* refactor memory

* add config

* docstring

* more cleanup

* code quality

* code quality

* unused return

* DOTTED GET

* Refactor Docker and CI configurations

- Removed the creation of `memory_config.yaml` from the CI workflow to streamline the process.
- Updated Docker Compose files to mount `config.yml` for model registry and memory settings in both services.
- Added new dependencies for Google API clients in `uv.lock` to support upcoming features.

* Update configuration files for model providers and Docker setup

- Changed LLM, embedding, and STT providers in `config.yml` to OpenAI and Deepgram.
- Removed read-only flag from `config.yml` in Docker Compose files to allow UI configuration saving.
- Updated memory configuration endpoint to accept plain text for YAML input.

* Update transcription job handling to format speaker IDs

- Changed variable name from `speaker_name` to `speaker_id` for clarity.
- Added logic to convert integer speaker IDs from Deepgram to string format for consistent speaker labeling.

* Remove loading of backend .env file in test environment setup

- Eliminated the code that loads the .env file from the backends/advanced directory, simplifying the environment configuration for tests.

* Enhance configuration management and setup wizard

- Updated README to reflect the new setup wizard process.
- Added functionality to load and save `config.yml` in the setup wizard, including default configurations for LLM and memory providers.
- Improved user feedback during configuration updates, including success messages for configuration file updates.
- Enabled backup of existing `config.yml` before saving changes.

* Enhance HTTPS configuration in setup wizard

- Added functionality to check for existing SERVER_IP in the environment file and prompt the user to reuse or enter a new IP for SSL certificates.
- Improved user prompts for server IP/domain input during HTTPS setup.
- Updated default behavior to use existing IP or localhost based on user input.
- Changed RECORD_ONLY_ENROLLED_SPEAKERS setting in the .env template to false for broader access.

* Add source parameter to audio file writing in websocket controller

- Included a new `source` parameter with the value "websocket" in the `_process_batch_audio_complete` function to enhance audio file context tracking.

* Refactor error handling in system controller and update memory config routes

- Replaced ValueError with HTTPException for better error handling in `save_diarization_settings` and `validate_memory_config` functions.
- Introduced a new Pydantic model, `MemoryConfigRequest`, for validating memory configuration requests in the system routes.
- Updated the `validate_memory_config` endpoint to accept the new request model, improving input handling and validation.

---------

Co-authored-by: 0xrushi <6279035+0xrushi@users.noreply.github.com>

* Feat/add obsidian 3 (#233)

* obsidian support

* neo4j comment

* cleanup code

* unused line

* unused line

* Fix MemoryEntry object usage in chat service

* comment

* feat(obsidian): add obsidian memory search integration to chat

* unit test

* use rq

* neo4j service

* typefix

* test fix

* cleanup

* cleanup

* version changes

* profile

* remove unused imports

* Refactor memory configuration validation endpoints

- Removed the deprecated `validate_memory_config_raw` endpoint and replaced it with a new endpoint that accepts plain text for validation.
- Updated the existing `validate_memory_config` endpoint to clarify that it now accepts JSON input.
- Adjusted the API call in the frontend to point to the new validation endpoint.

* Refactor health check model configuration loading

- Updated the health check function to load model configuration from the models registry instead of the root config.
- Improved error handling by logging warnings when model configuration loading fails.

---------

Co-authored-by: 0xrushi <6279035+0xrushi@users.noreply.github.com>

* Update .gitignore to exclude all files in app/ios and app/android directories (#238)

* fix: Copy full source code in speaker-recognition Dockerfile (#243)

Adds COPY src/ src/ step after dependency installation to ensure
all source files are available in the Docker image. This improves
build caching while ensuring complete source code is present.

* Enhance configuration management and add new setup scripts (#235)

* Enhance configuration management and add new setup scripts

- Updated .gitignore to include config.yml and its template.
- Added config.yml.template for default configuration settings.
- Introduced restart.sh script for service management.
- Enhanced services.py to load config.yml and check for Obsidian/Neo4j integration.
- Updated wizard.py to prompt for Obsidian/Neo4j configuration during setup and create config.yml from template if it doesn't exist.

* Refactor transcription providers and enhance configuration management

- Updated Docker Compose files to include the new Neo4j service configuration.
- Added support for Obsidian/Neo4j integration in the setup process.
- Refactored transcription providers to utilize a registry-driven approach for Deepgram and Parakeet.
- Enhanced error handling and logging in transcription processes.
- Improved environment variable management in test scripts to prioritize command-line overrides.
- Removed deprecated Parakeet provider implementation and streamlined audio stream workers.

* Update configuration management and enhance file structure, add test-matrix (#237)

* Update configuration management and enhance file structure

- Refactored configuration file paths to use a dedicated `config/` directory, including updates to `config.yml` and its template.
- Modified service scripts to load the new configuration path for `config.yml`.
- Enhanced `.gitignore` to include the new configuration files and templates.
- Updated documentation to reflect changes in configuration file locations and usage.
- Improved setup scripts to ensure proper creation and management of configuration files.
- Added new test configurations for various provider combinations to streamline testing processes.

* Add test requirements and clean up imports in wizard.py

- Introduced a new `test-requirements.txt` file to manage testing dependencies.
- Removed redundant import of `shutil` in `wizard.py` to improve code clarity.

* Add ConfigManager for unified configuration management

- Introduced a new `config_manager.py` module to handle reading and writing configurations from `config.yml` and `.env` files, ensuring backward compatibility.
- Refactored `ChronicleSetup` in `backends/advanced/init.py` to utilize `ConfigManager` for loading and updating configurations, simplifying the setup process.
- Removed redundant methods for loading and saving `config.yml` directly in `ChronicleSetup`, as these are now managed by `ConfigManager`.
- Enhanced user feedback during configuration updates, including success messages for changes made to configuration files.

* Refactor transcription provider configuration and enhance setup process

- Updated `.env.template` to clarify speech-to-text configuration and removed deprecated options for Mistral.
- Modified `docker-compose.yml` to streamline environment variable management by removing unused Mistral keys.
- Enhanced `ChronicleSetup` in `init.py` to provide clearer user feedback and updated the transcription provider selection process to rely on `config.yml`.
- Improved error handling in the websocket controller to determine the transcription provider from the model registry instead of environment variables.
- Updated health check routes to reflect the new method of retrieving the transcription provider from `config.yml`.
- Adjusted `config.yml.template` to include comments on transcription provider options for better user guidance.

* Enhance ConfigManager with deep merge functionality

- Updated the `update_memory_config` method to perform a deep merge of updates into the memory configuration, ensuring nested dictionaries are merged correctly.
- Added a new `_deep_merge` method to handle recursive merging of dictionaries, improving configuration management capabilities.

* Refactor run-test.sh and enhance memory extraction tests

- Removed deprecated environment variable handling for TRANSCRIPTION_PROVIDER in `run-test.sh`, streamlining the configuration process.
- Introduced a new `run-custom.sh` script for executing Robot tests with custom configurations, improving test flexibility.
- Enhanced memory extraction tests in `audio_keywords.robot` and `memory_keywords.robot` to include detailed assertions and result handling.
- Updated `queue_keywords.robot` to fail fast if a job is in a 'failed' state when expecting 'completed', improving error handling.
- Refactored `test_env.py` to load environment variables with correct precedence, ensuring better configuration management.

* unify tests to robot test, add some more clean up

* Update health check configuration in docker-compose-test.yml (#241)

- Increased the number of retries from 5 to 10 for improved resilience during service readiness checks.
- Extended the start period from 30s to 60s to allow more time for services to initialize before health checks commence.

* Add step to create test configuration file in robot-tests.yml

- Introduced a new step in the GitHub Actions workflow to copy the test configuration file from tests/configs/deepgram-openai.yml to a new config/config.yml.
- Added logging to confirm the creation of the test config file, improving visibility during the test setup process.

* remove cache step since not required

* coderabbit comments

* Refactor ConfigManager error handling for configuration file loading

- Updated the ConfigManager to raise RuntimeError exceptions when the configuration file is not found or is invalid, improving error visibility and user guidance.
- Removed fallback behavior that previously returned the current directory, ensuring users are explicitly informed about missing or invalid configuration files.

* Refactor _find_repo_root method in ConfigManager

- Updated the _find_repo_root method to locate the repository root using the __file__ location instead of searching for config/config.yml, simplifying the logic and improving reliability.
- Removed the previous error handling that raised a RuntimeError if the configuration file was not found, as the new approach assumes config_manager.py is always at the repo root.

* Enhance speaker recognition service integration and error handling (#245)

* Enhance speaker recognition service integration and error handling

- Updated `docker-compose-test.yml` to enable speaker recognition in the test environment and added a new `speaker-service-test` service for testing purposes.
- Refactored `run-test.sh` to improve the execution of Robot Framework tests from the repository root.
- Enhanced error handling in `speaker_recognition_client.py` to return detailed error messages for connection issues.
- Improved error logging in `speaker_jobs.py` to handle and report errors from the speaker recognition service more effectively.
- Updated `Dockerfile` to copy the full source code after dependencies are cached, ensuring all necessary files are included in the image.

* Remove integration tests workflow and enhance robot tests with HF_TOKEN verification

- Deleted the `integration-tests.yml` workflow file to streamline CI processes.
- Updated `robot-tests.yml` to include verification for the new `HF_TOKEN` secret, ensuring all required secrets are checked before running tests.

* Fix key access in system admin tests to use string indexing for speakers data

* Refactor Robot Framework tests and enhance error handling in memory services

- Removed the creation of the test environment file from the GitHub Actions workflow to streamline setup.
- Updated the Robot Framework tests to utilize a unified test script for improved consistency.
- Enhanced error messages in the MemoryService class to provide more context on connection failures for LLM and vector store providers.
- Added critical checks for API key presence in the OpenAIProvider class to ensure valid credentials are provided before proceeding.
- Adjusted various test setup scripts to use a centralized BACKEND_DIR variable for better maintainability and clarity.

* Refactor test container cleanup in run-robot-tests.sh

- Updated the script to dynamically construct container names from docker-compose services, improving maintainability and reducing hardcoded values.
- Enhanced the cleanup process for stuck test containers by utilizing the COMPOSE_PROJECT_NAME variable.

* Enhance run-robot-tests.sh for improved logging and cleanup

- Set absolute paths for consistent directory references to simplify navigation.
- Capture container logs, status, and resource usage for better debugging.
- Refactor cleanup process to utilize dynamic backend directory references, improving maintainability.
- Ensure proper navigation back to the tests directory after operations.

* Add speaker recognition configuration and update test script defaults

- Introduced speaker recognition settings in config.yml.template, allowing for easy enable/disable and service URL configuration.
- Updated run-robot-tests.sh to use a test-specific configuration file that disables speaker recognition for improved CI performance.
- Modified deepgram-openai.yml to disable speaker recognition during CI tests to enhance execution speed.

* Refactor speaker recognition configuration management

- Updated docker-compose-test.yml to clarify speaker recognition settings, now controlled via config.yml for improved CI performance.
- Enhanced model_registry.py to include a dedicated speaker_recognition field for better configuration handling.
- Modified speaker_recognition_client.py to load configuration from config.yml, allowing for dynamic enabling/disabling of the speaker recognition service based on the configuration.

* Add minimum worker count verification to infrastructure tests

- Introduced a new keyword to verify that the minimum number of workers are registered, enhancing the robustness of health checks.
- Updated the worker count validation test to include a wait mechanism for worker registration, improving test reliability.
- Clarified comments regarding expected worker counts to reflect the distinction between RQ and audio stream workers.

* Update configuration management and enhance model handling

- Added OBSIDIAN_ENABLED configuration to ChronicleSetup for improved feature toggling.
- Introduced speaker_recognition configuration handling in model_registry.py to streamline model loading.
- Refactored imports in deepgram.py to improve clarity and reduce redundancy.

* Refactor configuration management in wizard and ChronicleSetup (#246)

* Refactor configuration management in wizard and ChronicleSetup

- Updated wizard.py to read Obsidian/Neo4j configuration from config.yml, enhancing flexibility and error handling.
- Refactored ChronicleSetup to utilize ConfigManager for loading and verifying config.yml, ensuring a single source of truth.
- Improved user feedback for missing configuration files and streamlined the setup process for memory and transcription providers.

* Fix string formatting for error message in ChronicleSetup

* added JWT issuers for audience auth for service interop and shared us… (#250)

* added JWT issuers for audience auth for service interop and shared user accounts

* amended default value in line wioth code

---------

Co-authored-by: 01PrathamS <pratham21btai35@karnavatiuniversity.edu.in>
Co-authored-by: Stu Alexandere <thestumonkey@gmail.com>
Co-authored-by: Stuart Alexander <stu@theawesome.co.uk>
Co-authored-by: 0xrushi <6279035+0xrushi@users.noreply.github.com>
AnkushMalaker added a commit that referenced this pull request Feb 19, 2026
* audio upload extension with gdrive credentials

* FIX: API parameters

* UPDATE: tmp files cleanup n code refactored as per review

* REFACTOR: minor refactor as per review

* REFACTOR: minor update as per review

* UPDATE: gdrive sync logic

* REFACTOR: code update as per gdrive and update credential client

* REFACTOR: validation updated - as per review from CR

* UPDATE: code has been refactore for UUID for diffrent audio upload sources

* REFACTOR: updated code as per review

* Update documentation and configuration to reflect the transition from 'friend-backend' to 'chronicle-backend' across various files, including setup instructions, Docker configurations, and service logs.

* Update test script to use docker-compose-test.yml for all test-related operations

* Added standard MIT license

* Fix/cleanup model (#219)

* refactor memory

* add config

* docstring

* more cleanup

* code quality

* code quality

* unused return

* DOTTED GET

* Refactor Docker and CI configurations

- Removed the creation of `memory_config.yaml` from the CI workflow to streamline the process.
- Updated Docker Compose files to mount `config.yml` for model registry and memory settings in both services.
- Added new dependencies for Google API clients in `uv.lock` to support upcoming features.

* Update configuration files for model providers and Docker setup

- Changed LLM, embedding, and STT providers in `config.yml` to OpenAI and Deepgram.
- Removed read-only flag from `config.yml` in Docker Compose files to allow UI configuration saving.
- Updated memory configuration endpoint to accept plain text for YAML input.

* Update transcription job handling to format speaker IDs

- Changed variable name from `speaker_name` to `speaker_id` for clarity.
- Added logic to convert integer speaker IDs from Deepgram to string format for consistent speaker labeling.

* Remove loading of backend .env file in test environment setup

- Eliminated the code that loads the .env file from the backends/advanced directory, simplifying the environment configuration for tests.

* Enhance configuration management and setup wizard

- Updated README to reflect the new setup wizard process.
- Added functionality to load and save `config.yml` in the setup wizard, including default configurations for LLM and memory providers.
- Improved user feedback during configuration updates, including success messages for configuration file updates.
- Enabled backup of existing `config.yml` before saving changes.

* Enhance HTTPS configuration in setup wizard

- Added functionality to check for existing SERVER_IP in the environment file and prompt the user to reuse or enter a new IP for SSL certificates.
- Improved user prompts for server IP/domain input during HTTPS setup.
- Updated default behavior to use existing IP or localhost based on user input.
- Changed RECORD_ONLY_ENROLLED_SPEAKERS setting in the .env template to false for broader access.

* Add source parameter to audio file writing in websocket controller

- Included a new `source` parameter with the value "websocket" in the `_process_batch_audio_complete` function to enhance audio file context tracking.

---------

Co-authored-by: 0xrushi <6279035+0xrushi@users.noreply.github.com>

* fix/broken-tests (#230)

* refactor memory

* add config

* docstring

* more cleanup

* code quality

* code quality

* unused return

* DOTTED GET

* Refactor Docker and CI configurations

- Removed the creation of `memory_config.yaml` from the CI workflow to streamline the process.
- Updated Docker Compose files to mount `config.yml` for model registry and memory settings in both services.
- Added new dependencies for Google API clients in `uv.lock` to support upcoming features.

* Update configuration files for model providers and Docker setup

- Changed LLM, embedding, and STT providers in `config.yml` to OpenAI and Deepgram.
- Removed read-only flag from `config.yml` in Docker Compose files to allow UI configuration saving.
- Updated memory configuration endpoint to accept plain text for YAML input.

* Update transcription job handling to format speaker IDs

- Changed variable name from `speaker_name` to `speaker_id` for clarity.
- Added logic to convert integer speaker IDs from Deepgram to string format for consistent speaker labeling.

* Remove loading of backend .env file in test environment setup

- Eliminated the code that loads the .env file from the backends/advanced directory, simplifying the environment configuration for tests.

* Enhance configuration management and setup wizard

- Updated README to reflect the new setup wizard process.
- Added functionality to load and save `config.yml` in the setup wizard, including default configurations for LLM and memory providers.
- Improved user feedback during configuration updates, including success messages for configuration file updates.
- Enabled backup of existing `config.yml` before saving changes.

* Enhance HTTPS configuration in setup wizard

- Added functionality to check for existing SERVER_IP in the environment file and prompt the user to reuse or enter a new IP for SSL certificates.
- Improved user prompts for server IP/domain input during HTTPS setup.
- Updated default behavior to use existing IP or localhost based on user input.
- Changed RECORD_ONLY_ENROLLED_SPEAKERS setting in the .env template to false for broader access.

* Add source parameter to audio file writing in websocket controller

- Included a new `source` parameter with the value "websocket" in the `_process_batch_audio_complete` function to enhance audio file context tracking.

* Refactor error handling in system controller and update memory config routes

- Replaced ValueError with HTTPException for better error handling in `save_diarization_settings` and `validate_memory_config` functions.
- Introduced a new Pydantic model, `MemoryConfigRequest`, for validating memory configuration requests in the system routes.
- Updated the `validate_memory_config` endpoint to accept the new request model, improving input handling and validation.

---------

Co-authored-by: 0xrushi <6279035+0xrushi@users.noreply.github.com>

* Feat/add obsidian 3 (#233)

* obsidian support

* neo4j comment

* cleanup code

* unused line

* unused line

* Fix MemoryEntry object usage in chat service

* comment

* feat(obsidian): add obsidian memory search integration to chat

* unit test

* use rq

* neo4j service

* typefix

* test fix

* cleanup

* cleanup

* version changes

* profile

* remove unused imports

* Refactor memory configuration validation endpoints

- Removed the deprecated `validate_memory_config_raw` endpoint and replaced it with a new endpoint that accepts plain text for validation.
- Updated the existing `validate_memory_config` endpoint to clarify that it now accepts JSON input.
- Adjusted the API call in the frontend to point to the new validation endpoint.

* Refactor health check model configuration loading

- Updated the health check function to load model configuration from the models registry instead of the root config.
- Improved error handling by logging warnings when model configuration loading fails.

---------

Co-authored-by: 0xrushi <6279035+0xrushi@users.noreply.github.com>

* Update .gitignore to exclude all files in app/ios and app/android directories (#238)

* fix: Copy full source code in speaker-recognition Dockerfile (#243)

Adds COPY src/ src/ step after dependency installation to ensure
all source files are available in the Docker image. This improves
build caching while ensuring complete source code is present.

* Enhance configuration management and add new setup scripts (#235)

* Enhance configuration management and add new setup scripts

- Updated .gitignore to include config.yml and its template.
- Added config.yml.template for default configuration settings.
- Introduced restart.sh script for service management.
- Enhanced services.py to load config.yml and check for Obsidian/Neo4j integration.
- Updated wizard.py to prompt for Obsidian/Neo4j configuration during setup and create config.yml from template if it doesn't exist.

* Refactor transcription providers and enhance configuration management

- Updated Docker Compose files to include the new Neo4j service configuration.
- Added support for Obsidian/Neo4j integration in the setup process.
- Refactored transcription providers to utilize a registry-driven approach for Deepgram and Parakeet.
- Enhanced error handling and logging in transcription processes.
- Improved environment variable management in test scripts to prioritize command-line overrides.
- Removed deprecated Parakeet provider implementation and streamlined audio stream workers.

* Update configuration management and enhance file structure, add test-matrix (#237)

* Update configuration management and enhance file structure

- Refactored configuration file paths to use a dedicated `config/` directory, including updates to `config.yml` and its template.
- Modified service scripts to load the new configuration path for `config.yml`.
- Enhanced `.gitignore` to include the new configuration files and templates.
- Updated documentation to reflect changes in configuration file locations and usage.
- Improved setup scripts to ensure proper creation and management of configuration files.
- Added new test configurations for various provider combinations to streamline testing processes.

* Add test requirements and clean up imports in wizard.py

- Introduced a new `test-requirements.txt` file to manage testing dependencies.
- Removed redundant import of `shutil` in `wizard.py` to improve code clarity.

* Add ConfigManager for unified configuration management

- Introduced a new `config_manager.py` module to handle reading and writing configurations from `config.yml` and `.env` files, ensuring backward compatibility.
- Refactored `ChronicleSetup` in `backends/advanced/init.py` to utilize `ConfigManager` for loading and updating configurations, simplifying the setup process.
- Removed redundant methods for loading and saving `config.yml` directly in `ChronicleSetup`, as these are now managed by `ConfigManager`.
- Enhanced user feedback during configuration updates, including success messages for changes made to configuration files.

* Refactor transcription provider configuration and enhance setup process

- Updated `.env.template` to clarify speech-to-text configuration and removed deprecated options for Mistral.
- Modified `docker-compose.yml` to streamline environment variable management by removing unused Mistral keys.
- Enhanced `ChronicleSetup` in `init.py` to provide clearer user feedback and updated the transcription provider selection process to rely on `config.yml`.
- Improved error handling in the websocket controller to determine the transcription provider from the model registry instead of environment variables.
- Updated health check routes to reflect the new method of retrieving the transcription provider from `config.yml`.
- Adjusted `config.yml.template` to include comments on transcription provider options for better user guidance.

* Enhance ConfigManager with deep merge functionality

- Updated the `update_memory_config` method to perform a deep merge of updates into the memory configuration, ensuring nested dictionaries are merged correctly.
- Added a new `_deep_merge` method to handle recursive merging of dictionaries, improving configuration management capabilities.

* Refactor run-test.sh and enhance memory extraction tests

- Removed deprecated environment variable handling for TRANSCRIPTION_PROVIDER in `run-test.sh`, streamlining the configuration process.
- Introduced a new `run-custom.sh` script for executing Robot tests with custom configurations, improving test flexibility.
- Enhanced memory extraction tests in `audio_keywords.robot` and `memory_keywords.robot` to include detailed assertions and result handling.
- Updated `queue_keywords.robot` to fail fast if a job is in a 'failed' state when expecting 'completed', improving error handling.
- Refactored `test_env.py` to load environment variables with correct precedence, ensuring better configuration management.

* unify tests to robot test, add some more clean up

* Update health check configuration in docker-compose-test.yml (#241)

- Increased the number of retries from 5 to 10 for improved resilience during service readiness checks.
- Extended the start period from 30s to 60s to allow more time for services to initialize before health checks commence.

* Add step to create test configuration file in robot-tests.yml

- Introduced a new step in the GitHub Actions workflow to copy the test configuration file from tests/configs/deepgram-openai.yml to a new config/config.yml.
- Added logging to confirm the creation of the test config file, improving visibility during the test setup process.

* remove cache step since not required

* coderabbit comments

* Refactor ConfigManager error handling for configuration file loading

- Updated the ConfigManager to raise RuntimeError exceptions when the configuration file is not found or is invalid, improving error visibility and user guidance.
- Removed fallback behavior that previously returned the current directory, ensuring users are explicitly informed about missing or invalid configuration files.

* Refactor _find_repo_root method in ConfigManager

- Updated the _find_repo_root method to locate the repository root using the __file__ location instead of searching for config/config.yml, simplifying the logic and improving reliability.
- Removed the previous error handling that raised a RuntimeError if the configuration file was not found, as the new approach assumes config_manager.py is always at the repo root.

* Enhance speaker recognition service integration and error handling (#245)

* Enhance speaker recognition service integration and error handling

- Updated `docker-compose-test.yml` to enable speaker recognition in the test environment and added a new `speaker-service-test` service for testing purposes.
- Refactored `run-test.sh` to improve the execution of Robot Framework tests from the repository root.
- Enhanced error handling in `speaker_recognition_client.py` to return detailed error messages for connection issues.
- Improved error logging in `speaker_jobs.py` to handle and report errors from the speaker recognition service more effectively.
- Updated `Dockerfile` to copy the full source code after dependencies are cached, ensuring all necessary files are included in the image.

* Remove integration tests workflow and enhance robot tests with HF_TOKEN verification

- Deleted the `integration-tests.yml` workflow file to streamline CI processes.
- Updated `robot-tests.yml` to include verification for the new `HF_TOKEN` secret, ensuring all required secrets are checked before running tests.

* Fix key access in system admin tests to use string indexing for speakers data

* Refactor Robot Framework tests and enhance error handling in memory services

- Removed the creation of the test environment file from the GitHub Actions workflow to streamline setup.
- Updated the Robot Framework tests to utilize a unified test script for improved consistency.
- Enhanced error messages in the MemoryService class to provide more context on connection failures for LLM and vector store providers.
- Added critical checks for API key presence in the OpenAIProvider class to ensure valid credentials are provided before proceeding.
- Adjusted various test setup scripts to use a centralized BACKEND_DIR variable for better maintainability and clarity.

* Refactor test container cleanup in run-robot-tests.sh

- Updated the script to dynamically construct container names from docker-compose services, improving maintainability and reducing hardcoded values.
- Enhanced the cleanup process for stuck test containers by utilizing the COMPOSE_PROJECT_NAME variable.

* Enhance run-robot-tests.sh for improved logging and cleanup

- Set absolute paths for consistent directory references to simplify navigation.
- Capture container logs, status, and resource usage for better debugging.
- Refactor cleanup process to utilize dynamic backend directory references, improving maintainability.
- Ensure proper navigation back to the tests directory after operations.

* Add speaker recognition configuration and update test script defaults

- Introduced speaker recognition settings in config.yml.template, allowing for easy enable/disable and service URL configuration.
- Updated run-robot-tests.sh to use a test-specific configuration file that disables speaker recognition for improved CI performance.
- Modified deepgram-openai.yml to disable speaker recognition during CI tests to enhance execution speed.

* Refactor speaker recognition configuration management

- Updated docker-compose-test.yml to clarify speaker recognition settings, now controlled via config.yml for improved CI performance.
- Enhanced model_registry.py to include a dedicated speaker_recognition field for better configuration handling.
- Modified speaker_recognition_client.py to load configuration from config.yml, allowing for dynamic enabling/disabling of the speaker recognition service based on the configuration.

* Add minimum worker count verification to infrastructure tests

- Introduced a new keyword to verify that the minimum number of workers are registered, enhancing the robustness of health checks.
- Updated the worker count validation test to include a wait mechanism for worker registration, improving test reliability.
- Clarified comments regarding expected worker counts to reflect the distinction between RQ and audio stream workers.

* Update configuration management and enhance model handling

- Added OBSIDIAN_ENABLED configuration to ChronicleSetup for improved feature toggling.
- Introduced speaker_recognition configuration handling in model_registry.py to streamline model loading.
- Refactored imports in deepgram.py to improve clarity and reduce redundancy.

* Refactor configuration management in wizard and ChronicleSetup (#246)

* Refactor configuration management in wizard and ChronicleSetup

- Updated wizard.py to read Obsidian/Neo4j configuration from config.yml, enhancing flexibility and error handling.
- Refactored ChronicleSetup to utilize ConfigManager for loading and verifying config.yml, ensuring a single source of truth.
- Improved user feedback for missing configuration files and streamlined the setup process for memory and transcription providers.

* Fix string formatting for error message in ChronicleSetup

* added JWT issuers for audience auth for service interop and shared us… (#250)

* added JWT issuers for audience auth for service interop and shared user accounts

* amended default value in line wioth code

* Feat/edit chat system prompt (#247)

* Refactor configuration management in wizard and ChronicleSetup

- Updated wizard.py to read Obsidian/Neo4j configuration from config.yml, enhancing flexibility and error handling.
- Refactored ChronicleSetup to utilize ConfigManager for loading and verifying config.yml, ensuring a single source of truth.
- Improved user feedback for missing configuration files and streamlined the setup process for memory and transcription providers.

* Fix string formatting for error message in ChronicleSetup

* Enhance chat configuration management and UI integration

- Updated `services.py` to allow service restart with an option to recreate containers, addressing WSL2 bind mount issues.
- Added new chat configuration management functions in `system_controller.py` for loading, saving, and validating chat prompts.
- Introduced `ChatSettings` component in the web UI for admin users to manage chat configurations easily.
- Updated API service methods in `api.ts` to support chat configuration endpoints.
- Integrated chat settings into the system management page for better accessibility.

* Refactor backend shutdown process and enhance chat service configuration logging

- Updated `start.sh` to improve shutdown handling by explicitly killing the backend process if running.
- Modified `chat_service.py` to enhance logging for loading chat system prompts, providing clearer feedback on configuration usage.
- Added a new `chat` field in `model_registry.py` for better chat service configuration management.
- Updated vector store query parameters in `vector_stores.py` for improved clarity and functionality.
- Enhanced the chat component in the web UI to conditionally auto-scroll based on message sending status.

* Return JSONResponse instead of raw result

* Refactor headers creation in system admin tests

* Make config.yml writable for admin updates

* Docs consolidation (#257)

* Enhance setup documentation and convenience scripts

- Updated the interactive setup wizard instructions to recommend using the convenience script `./wizard.sh` for easier configuration.
- Added detailed instructions for uploading and processing existing audio files via the API, including example commands for single and multiple file uploads.
- Introduced a new section on HAVPE relay configuration for ESP32 audio streaming, providing environment variable setup and command examples.
- Clarified the distributed deployment setup, including GPU and backend separation instructions, and added benefits of using Tailscale for networking.
- Removed outdated `getting-started.md` and `SETUP_SCRIPTS.md` files to streamline documentation and avoid redundancy.

* Update setup instructions and enhance service management scripts

- Replaced direct command instructions with convenience scripts (`./wizard.sh` and `./start.sh`) for easier setup and service management.
- Added detailed usage of convenience scripts for checking service status, restarting, and stopping services.
- Clarified the distinction between convenience scripts and direct command usage for improved user guidance.

* Update speaker recognition models and documentation

- Changed the speaker diarization model from `pyannote/speaker-diarization-3.1` to `pyannote/speaker-diarization-community-1` across multiple files for consistency.
- Updated README files to reflect the new model and its usage instructions, ensuring users have the correct links and information for setup.
- Enhanced clarity in configuration settings related to speaker recognition.

* Docs consolidation (#258)

* Enhance setup documentation and convenience scripts

- Updated the interactive setup wizard instructions to recommend using the convenience script `./wizard.sh` for easier configuration.
- Added detailed instructions for uploading and processing existing audio files via the API, including example commands for single and multiple file uploads.
- Introduced a new section on HAVPE relay configuration for ESP32 audio streaming, providing environment variable setup and command examples.
- Clarified the distributed deployment setup, including GPU and backend separation instructions, and added benefits of using Tailscale for networking.
- Removed outdated `getting-started.md` and `SETUP_SCRIPTS.md` files to streamline documentation and avoid redundancy.

* Update setup instructions and enhance service management scripts

- Replaced direct command instructions with convenience scripts (`./wizard.sh` and `./start.sh`) for easier setup and service management.
- Added detailed usage of convenience scripts for checking service status, restarting, and stopping services.
- Clarified the distinction between convenience scripts and direct command usage for improved user guidance.

* Update speaker recognition models and documentation

- Changed the speaker diarization model from `pyannote/speaker-diarization-3.1` to `pyannote/speaker-diarization-community-1` across multiple files for consistency.
- Updated README files to reflect the new model and its usage instructions, ensuring users have the correct links and information for setup.
- Enhanced clarity in configuration settings related to speaker recognition.

* Enhance transcription provider selection and update HTTPS documentation

- Added a new function in `wizard.py` to prompt users for their preferred transcription provider, allowing options for Deepgram, Parakeet ASR, or none.
- Updated the service setup logic to automatically include ASR services if Parakeet is selected.
- Introduced a new documentation file on SSL certificates and HTTPS setup, detailing the importance of HTTPS for secure connections and microphone access.
- Removed outdated HTTPS setup documentation from `backends/advanced/Docs/HTTPS_SETUP.md` to streamline resources.

* Remove HTTPS setup scripts and related configurations

- Deleted `init-https.sh`, `setup-https.sh`, and `nginx.conf.template` as part of the transition to a new HTTPS setup process.
- Updated `README.md` to reflect the new automatic HTTPS configuration via the setup wizard.
- Adjusted `init.py` to remove references to the deleted HTTPS scripts and ensure proper handling of Caddyfile generation for SSL.
- Streamlined documentation to clarify the new approach for HTTPS setup and configuration management.

* Update quickstart.md (#268)

* v0.2 (#279)

* Refactor configuration management in wizard and ChronicleSetup

- Updated wizard.py to read Obsidian/Neo4j configuration from config.yml, enhancing flexibility and error handling.
- Refactored ChronicleSetup to utilize ConfigManager for loading and verifying config.yml, ensuring a single source of truth.
- Improved user feedback for missing configuration files and streamlined the setup process for memory and transcription providers.

* Fix string formatting for error message in ChronicleSetup

* Enhance chat configuration management and UI integration

- Updated `services.py` to allow service restart with an option to recreate containers, addressing WSL2 bind mount issues.
- Added new chat configuration management functions in `system_controller.py` for loading, saving, and validating chat prompts.
- Introduced `ChatSettings` component in the web UI for admin users to manage chat configurations easily.
- Updated API service methods in `api.ts` to support chat configuration endpoints.
- Integrated chat settings into the system management page for better accessibility.

* Refactor backend shutdown process and enhance chat service configuration logging

- Updated `start.sh` to improve shutdown handling by explicitly killing the backend process if running.
- Modified `chat_service.py` to enhance logging for loading chat system prompts, providing clearer feedback on configuration usage.
- Added a new `chat` field in `model_registry.py` for better chat service configuration management.
- Updated vector store query parameters in `vector_stores.py` for improved clarity and functionality.
- Enhanced the chat component in the web UI to conditionally auto-scroll based on message sending status.

* Implement plugin system for enhanced functionality and configuration management

- Introduced a new plugin architecture to allow for extensibility in the Chronicle application.
- Added Home Assistant plugin for controlling devices via natural language commands triggered by wake words.
- Implemented plugin configuration management endpoints in the API for loading, saving, and validating plugin settings.
- Enhanced the web UI with a dedicated Plugins page for managing plugin configurations.
- Updated Docker Compose files to include Tailscale integration for remote service access.
- Refactored existing services to support plugin interactions during conversation and memory processing.
- Improved error handling and logging for plugin initialization and execution processes.

* Enhance configuration management and plugin system integration

- Updated .gitignore to include plugins.yml for security reasons.
- Modified start.sh to allow passing additional arguments during service startup.
- Refactored wizard.py to support new HF_TOKEN configuration prompts and improved handling of wake words in plugin settings.
- Introduced a new setup_hf_token_if_needed function to streamline Hugging Face token management.
- Enhanced the GitHub Actions workflow to create plugins.yml from a template, ensuring proper configuration setup.
- Added detailed comments and documentation in the plugins.yml.template for better user guidance on Home Assistant integration.

* Implement Redis integration for client-user mapping and enhance wake word processing

- Added asynchronous Redis support in ClientManager for tracking client-user relationships.
- Introduced `initialize_redis_for_client_manager` to set up Redis for cross-container mapping.
- Updated `create_client_state` to use asynchronous tracking for client-user relationships.
- Enhanced wake word processing in PluginRouter with normalization and command extraction.
- Refactored DeepgramStreamingConsumer to utilize async Redis lookups for user ID retrieval.
- Set TTL on Redis streams during client state cleanup for better resource management.

* Refactor Deepgram worker management and enhance text normalization

- Disabled the batch Deepgram worker in favor of the streaming worker to prevent race conditions.
- Updated text normalization in wake word processing to replace punctuation with spaces, preserving word boundaries.
- Enhanced regex pattern for wake word matching to allow optional punctuation and whitespace after the last part.
- Improved logging in DeepgramStreamingConsumer for better visibility of message processing and error handling.

* Add original prompt retrieval and restoration in chat configuration test

- Implemented retrieval of the original chat prompt before saving a custom prompt to ensure test isolation.
- Added restoration of the original prompt after the test to prevent interference with subsequent tests.
- Enhanced the test documentation for clarity on the purpose of these changes.

* Refactor test execution and enhance documentation for integration tests

- Simplified test execution commands in CLAUDE.md and quickstart.md for better usability.
- Added instructions for running tests from the project root and clarified the process for executing the complete Robot Framework test suite.
- Introduced a new Docker service for the Deepgram streaming worker in docker-compose-test.yml to improve testing capabilities.
- Updated system_admin_tests.robot to use a defined default prompt for restoration, enhancing test reliability and clarity.

* Enhance test environment cleanup and improve Deepgram worker management

- Updated `run-test.sh` and `run-robot-tests.sh` to improve cleanup processes, including handling permission issues with Docker.
- Introduced a new function `mark_session_complete` in `session_controller.py` to ensure atomic updates for session completion status.
- Refactored WebSocket and conversation job handling to utilize the new session completion function, enhancing reliability.
- Updated `start-workers.sh` to enable the batch Deepgram worker alongside the streaming worker for improved transcription capabilities.
- Enhanced test scripts to verify the status of Deepgram workers and ensure proper cleanup of test containers.

* Refactor worker management and introduce orchestrator for improved process handling

- Replaced the bash-based `start-workers.sh` script with a Python-based worker orchestrator for better process management and health monitoring.
- Updated `docker-compose.yml` to configure the new orchestrator and adjust worker definitions, including the addition of audio persistence and stream workers.
- Enhanced the Dockerfile to remove the old startup script and ensure the orchestrator is executable.
- Introduced new modules for orchestrator configuration, health monitoring, process management, and worker registry to streamline worker lifecycle management.
- Improved environment variable handling for worker configuration and health checks.

* oops

* oops2

* Remove legacy test runner script and update worker orchestration

- Deleted the `run-test.sh` script, which was used for local test execution.
- Updated Docker configurations to replace the `start-workers.sh` script with `worker_orchestrator.py` for improved worker management.
- Enhanced health monitoring and process management in the orchestrator to ensure better reliability and logging.
- Adjusted deployment configurations to reflect the new orchestrator setup.

* Add bulk restart mechanism for RQ worker registration loss

- Introduced a new method `_handle_registration_loss` to manage RQ worker registration loss, replicating the behavior of the previous bash script.
- Implemented a cooldown period to prevent frequent restarts during network issues.
- Added logging for bulk restart actions and their outcomes to enhance monitoring and debugging capabilities.
- Created a `_restart_all_rq_workers` method to facilitate the bulk restart of RQ workers, ensuring they re-register with Redis upon startup.

* Enhance plugin architecture with event-driven system and test integration

- Introduced a new Test Event Plugin to log all plugin events to an SQLite database for integration testing.
- Updated the plugin system to utilize event subscriptions instead of access levels, allowing for more flexible event handling.
- Refactored the PluginRouter to dispatch events based on subscriptions, improving the event-driven architecture.
- Enhanced Docker configurations to support development and testing environments with appropriate dependencies.
- Added comprehensive integration tests to verify the functionality of the event dispatch system and plugin interactions.
- Updated documentation and test configurations to reflect the new event-based plugin structure.

* Enhance Docker configurations and startup script for test mode

- Updated `docker-compose-test.yml` to include a test command for services, enabling a dedicated test mode.
- Modified `start.sh` to support a `--test` flag, allowing the FastAPI backend to run with test-specific configurations.
- Adjusted worker commands to utilize the `--group test` option in test mode for improved orchestration and management.

* Refactor test scripts for improved reliability and clarity

- Updated `run-robot-tests.sh` to enhance the verification of the Deepgram batch worker process, ensuring non-numeric characters are removed from the check.
- Modified `plugin_tests.robot` to use a more explicit method for checking the length of subscriptions and added a skip condition for unavailable audio files.
- Adjusted `plugin_event_tests.robot` to load the test audio file from a variable, improving test data management.
- Refactored `plugin_keywords.robot` to utilize clearer length checks for subscriptions and event parts, enhancing readability and maintainability.

* remove mistral deadcode; notebooks untouched

* Refactor audio streaming endpoints and improve documentation

- Updated WebSocket endpoints to use a unified format with codec parameters (`/ws?codec=pcm` and `/ws?codec=opus`) for audio streaming, replacing the previous `/ws_pcm` and `/ws_omi` endpoints.
- Enhanced documentation to reflect the new endpoint structure and clarify audio processing capabilities.
- Removed deprecated audio cropping functionality and related configurations to streamline the audio processing workflow.
- Updated various components and scripts to align with the new endpoint structure, ensuring consistent usage across the application.

* Enhance testing infrastructure and API routes for plugin events

- Updated `docker-compose-test.yml` to introduce low speech detection thresholds for testing, improving the accuracy of speech detection during tests.
- Added new test-only API routes in `test_routes.py` for clearing and retrieving plugin events, ensuring a clean state between tests.
- Refactored existing test scripts to utilize the new API endpoints for event management, enhancing test reliability and clarity.
- Improved logging and error handling in various components to facilitate debugging during test execution.
- Adjusted environment variable handling in test setup scripts to streamline configuration and improve flexibility.

* Add audio pipeline architecture documentation and improve audio persistence worker configuration

- Introduced a comprehensive documentation file detailing the audio pipeline architecture, covering data flow, processing stages, and key components.
- Enhanced the audio persistence worker setup by implementing multiple concurrent workers to improve audio processing efficiency.
- Adjusted sleep intervals in the audio streaming persistence job for better responsiveness and event loop yielding.
- Updated test script to run the full suite of integration tests from the specified directory, ensuring thorough testing coverage.

* Add test container setup and teardown scripts

- Introduced `setup-test-containers.sh` for streamlined startup of test containers, including health checks and environment variable loading.
- Added `teardown-test-containers.sh` for simplified container shutdown, with options to remove volumes.
- Enhanced user feedback with color-coded messages for better visibility during test setup and teardown processes.

* Update worker count validation and websocket disconnect tests

- Adjusted worker count expectations in the Worker Count Validation Test to reflect an increase from 7 to 9 workers, accounting for additional audio persistence workers.
- Enhanced the WebSocket Disconnect Conversation End Reason Test by adding steps to maintain audio streaming during disconnection, ensuring accurate simulation of network dropout scenarios.
- Improved comments for clarity and added critical notes regarding inactivity timeout handling.

* Refactor audio storage to MongoDB chunks and enhance cleanup settings management

- Replaced the legacy AudioFile model with AudioChunkDocument for storing audio data in MongoDB, optimizing storage and retrieval.
- Introduced CleanupSettings dataclass for managing soft-deletion configurations, including auto-cleanup and retention days.
- Added admin API routes for retrieving and saving cleanup settings, ensuring better control over data retention policies.
- Updated audio processing workflows to utilize MongoDB chunks, removing dependencies on disk-based audio files.
- Enhanced tests to validate the new audio chunk storage and cleanup functionalities, ensuring robust integration with existing systems.

* Refactor audio processing to utilize MongoDB chunks and enhance job handling

- Removed audio file path parameters from various functions, transitioning to audio data retrieval from MongoDB chunks.
- Updated the `start_post_conversation_jobs` function to reflect changes in audio handling, ensuring jobs reconstruct audio from database chunks.
- Enhanced the `transcribe_full_audio_job` and `recognise_speakers_job` to process audio directly from memory, eliminating the need for temporary files.
- Improved error handling and logging for audio data retrieval, ensuring better feedback during processing.
- Added a new utility function for converting PCM data to WAV format in memory, streamlining audio format handling.

* Refactor speaker recognition client to use in-memory audio data

- Updated methods to accept audio data as bytes instead of file paths, enhancing performance by eliminating disk I/O.
- Improved logging to reflect in-memory audio processing, providing better insights during speaker identification and diarization.
- Streamlined audio data handling in the `diarize_identify_match` and `diarize_and_identify` methods, ensuring consistency across the client.
- Removed temporary file handling, simplifying the audio processing workflow and reducing potential file system errors.

* Add mock providers and update testing workflows for API-independent execution

- Introduced `MockLLMProvider` and `MockTranscriptionProvider` to facilitate testing without external API dependencies, allowing for consistent and controlled test environments.
- Created `run-no-api-tests.sh` script to execute tests that do not require API keys, ensuring separation of API-dependent and independent tests.
- Updated Robot Framework test configurations to utilize mock services, enhancing test reliability and reducing external dependencies.
- Modified existing test workflows to include new configurations and ensure proper handling of results for tests excluding API keys.
- Added `mock-services.yml` configuration to disable external API services while maintaining core functionality for testing purposes.
- Enhanced documentation to reflect the new tagging system for tests requiring API keys, improving clarity on test execution requirements.

* Enhance testing documentation and workflows for API key separation

- Updated CLAUDE.md to clarify test execution modes, emphasizing the separation of tests requiring API keys from those that do not.
- Expanded the testing guidelines in TESTING_GUIDELINES.md to detail the organization of tests based on API dependencies, including tagging conventions and execution paths.
- Improved mock-services.yml to include dummy configurations for LLM and embedding services, ensuring tests can run without actual API calls.
- Added comprehensive documentation on GitHub workflows for different test scenarios, enhancing clarity for contributors and maintainers.

* Update test configurations and documentation for API key management

- Modified `plugins.yml.template` to implement event subscriptions for the Home Assistant plugin, enhancing its event-driven capabilities.
- Revised `README.md` to clarify test execution processes, emphasizing the distinction between tests requiring API keys and those that do not.
- Updated `mock-services.yml` to streamline mock configurations, ensuring compatibility with the new testing workflows.
- Added `requires-api-keys` tags to relevant test cases across various test files, improving organization and clarity regarding API dependencies.
- Enhanced documentation for test scripts and configurations, providing clearer guidance for contributors on executing tests based on API key requirements.

* Add optional service profile to Docker Compose test configuration

* Refactor audio processing and job handling for transcription workflows

- Updated `upload_and_process_audio_files` and `start_post_conversation_jobs` to enqueue transcription jobs separately for file uploads, ensuring accurate processing order.
- Enhanced logging to provide clearer insights into job enqueuing and processing stages.
- Removed batch transcription from the post-conversation job chain for streaming audio, utilizing the streaming transcript directly.
- Introduced word-level timestamps in the `Conversation` model to improve transcript detail and accuracy.
- Updated tests to reflect changes in job handling and ensure proper verification of post-conversation processing.

* Remove unnecessary network aliases from speaker service in Docker Compose configuration

* Add network aliases for speaker service in Docker Compose configuration

* Refactor Conversation model to use string for provider field

- Updated the `Conversation` model to replace the `TranscriptProvider` enum with a string type for the `provider` field, allowing for greater flexibility in provider names.
- Adjusted related job functions to accommodate this change, simplifying provider handling in the transcription workflow.

* Enhance configuration and model handling for waveform data

- Updated Docker Compose files to mount the entire config directory, allowing for better management of configuration files.
- Introduced a new `WaveformData` model to store pre-computed waveform visualization data, improving UI performance by enabling waveform display without real-time decoding.
- Enhanced the `app_factory` and `job` models to include the new `WaveformData` model, ensuring proper initialization and data handling.
- Implemented waveform generation logic in a new worker module, allowing for on-demand waveform creation from audio chunks.
- Added API endpoints for retrieving and generating waveform data, improving the overall audio processing capabilities.
- Updated tests to cover new functionality and ensure robustness in waveform data handling.

* Add SDK testing scripts for authentication, conversation retrieval, and audio upload

- Introduced three new test scripts: `sdk_test_auth.py`, `sdk_test_conversations.py`, and `sdk_test_upload.py`.
- Each script tests different functionalities of the SDK, including authentication, conversation retrieval, and audio file uploads.
- The scripts utilize the `ChronicleClient` to perform operations and print results for verification.
- Enhanced testing capabilities for the SDK, ensuring robust validation of core features.

* Enhance audio processing and conversation handling for large files

- Added configuration options for speaker recognition chunking in `.env.template`, allowing for better management of large audio files.
- Updated `get_conversations` function to include an `include_deleted` parameter for filtering conversations based on their deletion status.
- Enhanced `finalize_session` method in `AudioStreamProducer` to send an end marker to Redis, ensuring proper session closure.
- Introduced `reconstruct_audio_segments` function to yield audio segments with overlap for efficient processing of lengthy conversations.
- Implemented merging of overlapping speaker segments to improve accuracy in speaker recognition.
- Added integration tests for WebSocket streaming transcription to validate the end_marker functionality and overall transcription flow.

* archive

* Implement annotation system and enhance audio processing capabilities

- Introduced a new annotation model to support user edits and AI-powered suggestions for memories and transcripts.
- Added annotation routes for CRUD operations, enabling the creation and management of annotations via the API.
- Enhanced the audio processing workflow to support fetching audio segments from the backend, improving speaker recognition accuracy.
- Updated the speaker recognition client to handle conversation-based audio fetching, allowing for better management of large audio files.
- Implemented a cron job for generating AI suggestions on potential errors in transcripts and memories, improving user experience and content accuracy.
- Enhanced the web UI to support inline editing of transcript segments and memory content, providing a more interactive user experience.
- Updated configuration files to support new features and improve overall system flexibility.

* Implement OmegaConf-based configuration management for backend settings

- Introduced a new configuration loader using OmegaConf for unified management of backend settings.
- Updated existing configuration functions to leverage the new loader, enhancing flexibility and maintainability.
- Added support for environment variable interpolation in configuration files.
- Refactored various components to retrieve settings from the new configuration system, improving consistency across the application.
- Updated requirements to include OmegaConf as a dependency.
- Enhanced documentation and comments for clarity on configuration management.

* Refactor .env.template and remove unused diarization configuration

- Updated the .env.template to clarify its purpose for secret values and streamline setup instructions.
- Removed the deprecated diarization_config.json.template file, as it is no longer needed.
- Added new environment variables for Langfuse and Tailscale integration to enhance observability and remote service access.

* Implement legacy environment variable syntax support in configuration loader

- Added custom OmegaConf resolvers to handle legacy ${VAR:-default} syntax for backward compatibility.
- Introduced a preprocessing function to convert legacy syntax in YAML files to OmegaConf-compatible format.
- Updated the load_config function to utilize the new preprocessing for loading defaults and user configurations.
- Enhanced documentation for clarity on the new legacy syntax handling.

* Add plugins configuration path retrieval and refactor usage

- Introduced a new function `get_plugins_yml_path` to centralize the retrieval of the plugins.yml file path.
- Updated `system_controller.py` and `plugin_service.py` to use the new function for improved maintainability and consistency in accessing the plugins configuration.
- Enhanced code clarity by removing hardcoded paths and utilizing the centralized configuration method.

* Unify plugin terminology and fix memory job dependencies

Plugin terminology: subscriptions→events, trigger→condition
Memory jobs: no longer blocked by disabled speaker recognition

* Update Docker Compose configuration and enhance system routes

- Updated Docker Compose files to mount the entire config directory, consolidating configuration management.
- Refactored the `save_diarization_settings` function to improve clarity and maintainability by renaming it to `save_diarization_settings_controller`.
- Enhanced the System component in the web UI to include configuration diagnostics, providing better visibility into system health and issues.

* circular import

* Refactor testing infrastructure and enhance container management

- Updated the testing documentation to reflect a new Makefile-based approach for running tests and managing containers.
- Introduced new scripts for container management, including starting, stopping, restarting, and cleaning containers while preserving logs.
- Added a cleanup script to handle data ownership and permissions correctly.
- Implemented a logging system that saves container logs automatically before cleanup.
- Enhanced the README with detailed instructions for running tests and managing the test environment.

* Add Email Summarizer Plugin and SMTP Email Service

- Introduced the Email Summarizer Plugin that automatically sends email summaries upon conversation completion.
- Implemented SMTP Email Service for sending emails, supporting HTML and plain text formats with TLS/SSL encryption.
- Added configuration options for SMTP settings in the .env.template and plugins.yml.template.
- Created comprehensive documentation for plugin development and usage, including a new plugin generation script.
- Enhanced testing coverage for the Email Summarizer Plugin and SMTP Email Service to ensure reliability and functionality.

* Refactor plugin management and introduce Email Summarizer setup

- Removed the static PLUGINS dictionary and replaced it with a dynamic discovery mechanism for plugins.
- Implemented a new setup process for plugins, allowing for configuration via individual setup scripts.
- Added the Email Summarizer plugin with a dedicated setup script for SMTP configuration.
- Enhanced the main setup flow to support community plugins and their configuration.
- Cleaned up unused functions related to plugin configuration and streamlined the overall plugin setup process.

* Enhance plugin configuration and documentation

- Updated the .env.template to include new configuration options for the Home Assistant and Email Summarizer plugins, including server URLs, tokens, and additional settings.
- Refactored Docker Compose files to correctly mount plugin configuration paths.
- Introduced comprehensive documentation for plugin configuration architecture, detailing the separation of concerns for orchestration, settings, and secrets.
- Added individual configuration files for the Home Assistant and Email Summarizer plugins, ensuring proper management of non-secret settings and environment variable references.
- Improved the plugin loading process to merge configurations from multiple sources, enhancing flexibility and maintainability.

* Refactor plugin setup process to allow interactive user input

- Updated the plugin setup script to run interactively, enabling plugins to prompt for user input during configuration.
- Removed output capturing to facilitate real-time interaction and improved error messaging to include exit codes for better debugging.

* Add shared setup utilities for interactive configuration

- Introduced `setup_utils.py` containing functions for reading environment variables, prompting user input, and masking sensitive values.
- Refactored existing code in `wizard.py` and `init.py` to utilize these shared utilities, improving code reuse and maintainability.
- Updated documentation to include usage examples for the new utilities in plugin setup scripts, enhancing developer experience and clarity.

* Enhance plugin security architecture and configuration management

- Introduced a three-file separation for plugin configuration to improve security:
  - `backends/advanced/.env` for secrets (gitignored)
  - `config/plugins.yml` for orchestration with environment variable references
  - `plugins/{plugin_id}/config.yml` for non-secret defaults
- Updated documentation to emphasize the importance of using `${ENV_VAR}` syntax for sensitive data and provided examples of correct usage.
- Enhanced the Email Summarizer plugin setup process to automatically update `config/plugins.yml` with environment variable references, ensuring secrets are not hardcoded.
- Added new fields to the User model for notification email management and improved error logging in user-related functions.
- Refactored audio chunk utilities to use a consistent method for fetching conversation metadata.

* Refactor backend components for improved functionality and stability

- Added a new parameter `transcript_version_id` to the `open_conversation_job` function to support streaming transcript versioning.
- Enhanced error handling in `check_enrolled_speakers_job` and `recognise_speakers_job` to allow conversations to proceed even when the speaker service is unavailable, improving resilience.
- Updated `send_to_adv.py` to support dynamic WebSocket and HTTP protocols based on environment settings, enhancing configuration flexibility.
- Introduced a background task in `send_to_adv.py` to handle incoming messages from the backend, ensuring connection stability and logging interim results.

* Refactor plugin setup timing to enhance configuration flow

* Refactor save_diarization_settings_controller to improve validation and error handling

- Updated the controller to filter out invalid settings instead of raising an error for each unknown key, allowing for more flexible input.
- Added a check to reject requests with no valid settings provided, enhancing robustness.
- Adjusted logging to reflect the filtered settings being saved.

* Refactor audio processing and conversation management for improved deduplication and tracking

* Refactor audio and email handling for improved functionality and security

- Updated `mask_value` function to handle whitespace more effectively.
- Enhanced `create_plugin` to remove existing directories when using the `--force` option.
- Changed logging level from error to debug for existing admin user checks.
- Improved client ID generation logging for clarity.
- Removed unused fields from conversation creation.
- Added HTML escaping in email templates to prevent XSS attacks.
- Updated audio file download function to include user ID for better tracking.
- Adjusted WebSocket connection settings to respect SSL verification based on environment variables.

* Refactor audio upload functionality to remove unused parameters

- Removed `auto_generate_client` and `folder` parameters from audio upload functions to streamline the API.
- Updated related function calls and documentation to reflect these changes, enhancing clarity and reducing complexity.

* Refactor Email Summarizer plugin configuration for improved clarity and security

- Removed outdated migration instructions from `plugin-configuration.md` to streamline documentation.
- Enhanced `README.md` to clearly outline the three-file separation for plugin configuration, emphasizing the roles of `.env`, `config.yml`, and `plugins.yml`.
- Updated `setup.py` to reflect changes in orchestration settings, ensuring only relevant configurations are included in `config/plugins.yml`.
- Improved security messaging to highlight the importance of not committing secrets to version control.

* Update API key configuration in config.yml.template to use environment variable syntax for improved flexibility and security. This change standardizes the way API keys are referenced across different models and services. (#273)

Co-authored-by: roshan.john <roshanjohn1460@gmail.com>

* Refactor Redis job queue cleanup process for improved success tracking

- Replaced total job count with separate counters for successful and failed jobs during Redis queue cleanup.
- Enhanced logging to provide detailed feedback on the number of jobs cleared and any failures encountered.
- Improved error handling to ensure job counts are accurately reflected even when exceptions occur.

* fix tests

* Update CI workflows to use 'docker compose' for log retrieval and added container status check

- Replaced 'docker logs' commands with 'docker compose -f docker-compose-test.yml logs' for consistency across workflows.
- Added a check for running containers before saving logs to enhance debugging capabilities.

* test fixes

* FIX StreamingTranscriptionConsumer to support cumulative audio timestamp adjustments

- Added `audio_offset_seconds` to track cumulative audio duration for accurate timestamp adjustments across transcription sessions.
- Updated `store_final_result` method to adjust word and segment timestamps based on cumulative audio offset.
- Improved logging to reflect changes in audio offset after storing results.
- Modified Makefile and documentation to clarify test execution options, including new tags for slow and SDK tests, enhancing test organization and execution clarity.

* Enhance test container setup and improve error messages in integration tests

- Set `COMPOSE_PROJECT_NAME` for test containers to ensure consistent naming.
- Consolidated error messages in the `websocket_transcription_e2e_test.robot` file for clarity, improving readability and debugging.

* Improve WebSocket closing logic and enhance integration test teardown

- Added timeout handling for WebSocket closure in `AudioStreamClient` to prevent hanging and ensure clean disconnection.
- Updated integration tests to log the total chunks sent when closing audio streams, improving clarity on resource management during test teardown.

* Refactor job status handling to align with RQ standards

- Updated job status checks across various modules to use "started" and "finished" instead of "processing" and "completed" for consistency with RQ's naming conventions.
- Adjusted related logging and response messages to reflect the new status terminology.
- Simplified Docker Compose project name handling in test scripts to avoid conflicts and improve clarity in test environment setup.

* Update test configurations and improve audio inactivity handling

- Increased `SPEECH_INACTIVITY_THRESHOLD_SECONDS` to 20 seconds in `docker-compose-test.yml` for better audio duration handling during tests.
- Refactored session handling in `session_controller.py` to clarify client ID usage.
- Updated `conversation_utils.py` to track speech activity using audio timestamps, enhancing accuracy in inactivity detection.
- Simplified test scripts by removing unnecessary `COMPOSE_PROJECT_NAME` references, aligning with the new project naming convention.
- Adjusted integration tests to reflect changes in inactivity timeout and ensure proper handling of audio timestamps.

* Refactor audio processing and enhance error handling

- Updated `worker_orchestrator.py` to use `logger.exception` for improved error logging.
- Changed default MongoDB database name from "friend-lite" to "chronicle" in multiple files for consistency.
- Added a new method `close_stream_without_stop` in `audio_stream_client.py` to handle abrupt WebSocket disconnections.
- Enhanced audio validation in `audio_utils.py` to support automatic resampling of audio data if sample rates do not match.
- Improved logging in various modules to provide clearer insights during audio processing and event dispatching.

* Enhance Docker command handling and configuration management

- Updated `run_compose_command` to support separate build commands for services, including profile management for backend and speaker-recognition services.
- Improved error handling and output streaming during Docker command execution.
- Added `ensure_docker_network` function to verify and create the required Docker network before starting services.
- Refactored configuration files to utilize `oc.env` for environment variable management, ensuring better compatibility and flexibility across different environments.

* Enhance configuration loading to support custom config file paths

- Added support for the CONFIG_FILE environment variable to allow specifying custom configuration files for testing.
- Implemented logic to handle both absolute paths and relative filenames for the configuration file, improving flexibility in configuration management.

* Update test scripts to use TEST_CONFIG_FILE for configuration management

- Replaced CONFIG_FILE with TEST_CONFIG_FILE in both run-no-api-tests.sh and run-robot-tests.sh to standardize configuration file usage.
- Updated paths to point to mock and deepgram-openai configuration files inside the container, improving clarity and consistency in test setups.

* Refactor audio upload response handling and improve error reporting

- Updated `upload_and_process_audio_files` to return appropriate HTTP status codes based on upload results: 400 for all failures, 207 for partial successes, and 200 for complete success.
- Enhanced error messages in the audio upload tests to provide clearer feedback on upload failures, including specific error details for better debugging.
- Adjusted test scripts to ensure consistent handling of conversation IDs in job metadata, improving validation checks for job creation.

* Refactor audio processing and job handling to improve transcription management

- Updated `upload_and_process_audio_files` to check for transcription provider availability before enqueueing jobs, enhancing error handling and logging.
- Modified `start_post_conversation_jobs` to conditionally enqueue memory extraction jobs based on configuration, improving flexibility in job management.
- Enhanced event dispatch job dependencies to only include jobs that were actually enqueued, ensuring accurate job tracking.
- Added `is_transcription_available` function to check transcription provider status, improving modularity and clarity in the transcription workflow.

* Enhance integration tests for plugin events and improve error handling

- Updated integration tests to filter plugin events by conversation ID, ensuring accurate event tracking and reducing noise from fixture events.
- Improved error messages in event verification to include conversation ID context, enhancing clarity during test failures.
- Refactored audio upload handling to check for transcription job creation, allowing for more robust conversation polling and error reporting.
- Added new keyword to verify conversation end reasons, improving test coverage for conversation state validation.

* Enhance speaker recognition testing and audio processing

- Added mock speaker recognition client to facilitate testing without resource-intensive dependencies.
- Updated Docker Compose configurations to include mock speaker client for test environments.
- Refactored audio segment reconstruction to ensure precise clipping based on time boundaries.
- Improved error handling in transcription jobs and speaker recognition workflows to enhance robustness.
- Adjusted integration tests to utilize real-time pacing for audio chunk streaming, improving test accuracy.

* Refactor audio chunk retrieval and enhance logging in audio processing

- Introduced logging for audio chunk requests to improve traceability.
- Replaced manual audio chunk processing with a dedicated `reconstruct_audio_segment` function for better clarity and efficiency.
- Improved error handling during audio reconstruction to provide more informative responses in case of failures.
- Cleaned up imports and removed redundant code related to audio chunk calculations.

* Refactor mock speaker recognition client and improve testing structure

- Replaced direct import of mock client with a structured import from the new testing module.
- Introduced a dedicated `mock_speaker_client.py` to provide a mock implementation for speaker recognition, facilitating testing without heavy dependencies.
- Added an `__init__.py` file in the testing directory to organize testing utilities and mocks.

* Enhance conversation model to include word-level timestamps and improve transcript handling

- Added a new `words` field to the `Conversation` model for storing word-level timestamps.
- Updated methods to handle word data during transcript version creation, ensuring compatibility with speaker recognition.
- Refactored conversation job processing to utilize the new word structure, improving data integrity and access.
- Enhanced speaker recognition job to read words from the new standardized location, ensuring backward compatibility with legacy data.

* Implement speaker reprocessing feature and enhance timeout calculation

- Added a new endpoint to reprocess speaker identification for existing transcripts, creating a new version with re-identified speakers.
- Introduced a method to calculate proportional t…
AnkushMalaker added a commit that referenced this pull request Feb 19, 2026
* audio upload extension with gdrive credentials

* FIX: API parameters

* UPDATE: tmp files cleanup n code refactored as per review

* REFACTOR: minor refactor as per review

* REFACTOR: minor update as per review

* UPDATE: gdrive sync logic

* REFACTOR: code update as per gdrive and update credential client

* REFACTOR: validation updated - as per review from CR

* UPDATE: code has been refactore for UUID for diffrent audio upload sources

* REFACTOR: updated code as per review

* Update documentation and configuration to reflect the transition from 'friend-backend' to 'chronicle-backend' across various files, including setup instructions, Docker configurations, and service logs.

* Update test script to use docker-compose-test.yml for all test-related operations

* Added standard MIT license

* Fix/cleanup model (#219)

* refactor memory

* add config

* docstring

* more cleanup

* code quality

* code quality

* unused return

* DOTTED GET

* Refactor Docker and CI configurations

- Removed the creation of `memory_config.yaml` from the CI workflow to streamline the process.
- Updated Docker Compose files to mount `config.yml` for model registry and memory settings in both services.
- Added new dependencies for Google API clients in `uv.lock` to support upcoming features.

* Update configuration files for model providers and Docker setup

- Changed LLM, embedding, and STT providers in `config.yml` to OpenAI and Deepgram.
- Removed read-only flag from `config.yml` in Docker Compose files to allow UI configuration saving.
- Updated memory configuration endpoint to accept plain text for YAML input.

* Update transcription job handling to format speaker IDs

- Changed variable name from `speaker_name` to `speaker_id` for clarity.
- Added logic to convert integer speaker IDs from Deepgram to string format for consistent speaker labeling.

* Remove loading of backend .env file in test environment setup

- Eliminated the code that loads the .env file from the backends/advanced directory, simplifying the environment configuration for tests.

* Enhance configuration management and setup wizard

- Updated README to reflect the new setup wizard process.
- Added functionality to load and save `config.yml` in the setup wizard, including default configurations for LLM and memory providers.
- Improved user feedback during configuration updates, including success messages for configuration file updates.
- Enabled backup of existing `config.yml` before saving changes.

* Enhance HTTPS configuration in setup wizard

- Added functionality to check for existing SERVER_IP in the environment file and prompt the user to reuse or enter a new IP for SSL certificates.
- Improved user prompts for server IP/domain input during HTTPS setup.
- Updated default behavior to use existing IP or localhost based on user input.
- Changed RECORD_ONLY_ENROLLED_SPEAKERS setting in the .env template to false for broader access.

* Add source parameter to audio file writing in websocket controller

- Included a new `source` parameter with the value "websocket" in the `_process_batch_audio_complete` function to enhance audio file context tracking.

---------

Co-authored-by: 0xrushi <6279035+0xrushi@users.noreply.github.com>

* fix/broken-tests (#230)

* refactor memory

* add config

* docstring

* more cleanup

* code quality

* code quality

* unused return

* DOTTED GET

* Refactor Docker and CI configurations

- Removed the creation of `memory_config.yaml` from the CI workflow to streamline the process.
- Updated Docker Compose files to mount `config.yml` for model registry and memory settings in both services.
- Added new dependencies for Google API clients in `uv.lock` to support upcoming features.

* Update configuration files for model providers and Docker setup

- Changed LLM, embedding, and STT providers in `config.yml` to OpenAI and Deepgram.
- Removed read-only flag from `config.yml` in Docker Compose files to allow UI configuration saving.
- Updated memory configuration endpoint to accept plain text for YAML input.

* Update transcription job handling to format speaker IDs

- Changed variable name from `speaker_name` to `speaker_id` for clarity.
- Added logic to convert integer speaker IDs from Deepgram to string format for consistent speaker labeling.

* Remove loading of backend .env file in test environment setup

- Eliminated the code that loads the .env file from the backends/advanced directory, simplifying the environment configuration for tests.

* Enhance configuration management and setup wizard

- Updated README to reflect the new setup wizard process.
- Added functionality to load and save `config.yml` in the setup wizard, including default configurations for LLM and memory providers.
- Improved user feedback during configuration updates, including success messages for configuration file updates.
- Enabled backup of existing `config.yml` before saving changes.

* Enhance HTTPS configuration in setup wizard

- Added functionality to check for existing SERVER_IP in the environment file and prompt the user to reuse or enter a new IP for SSL certificates.
- Improved user prompts for server IP/domain input during HTTPS setup.
- Updated default behavior to use existing IP or localhost based on user input.
- Changed RECORD_ONLY_ENROLLED_SPEAKERS setting in the .env template to false for broader access.

* Add source parameter to audio file writing in websocket controller

- Included a new `source` parameter with the value "websocket" in the `_process_batch_audio_complete` function to enhance audio file context tracking.

* Refactor error handling in system controller and update memory config routes

- Replaced ValueError with HTTPException for better error handling in `save_diarization_settings` and `validate_memory_config` functions.
- Introduced a new Pydantic model, `MemoryConfigRequest`, for validating memory configuration requests in the system routes.
- Updated the `validate_memory_config` endpoint to accept the new request model, improving input handling and validation.

---------

Co-authored-by: 0xrushi <6279035+0xrushi@users.noreply.github.com>

* Feat/add obsidian 3 (#233)

* obsidian support

* neo4j comment

* cleanup code

* unused line

* unused line

* Fix MemoryEntry object usage in chat service

* comment

* feat(obsidian): add obsidian memory search integration to chat

* unit test

* use rq

* neo4j service

* typefix

* test fix

* cleanup

* cleanup

* version changes

* profile

* remove unused imports

* Refactor memory configuration validation endpoints

- Removed the deprecated `validate_memory_config_raw` endpoint and replaced it with a new endpoint that accepts plain text for validation.
- Updated the existing `validate_memory_config` endpoint to clarify that it now accepts JSON input.
- Adjusted the API call in the frontend to point to the new validation endpoint.

* Refactor health check model configuration loading

- Updated the health check function to load model configuration from the models registry instead of the root config.
- Improved error handling by logging warnings when model configuration loading fails.

---------

Co-authored-by: 0xrushi <6279035+0xrushi@users.noreply.github.com>

* Update .gitignore to exclude all files in app/ios and app/android directories (#238)

* fix: Copy full source code in speaker-recognition Dockerfile (#243)

Adds COPY src/ src/ step after dependency installation to ensure
all source files are available in the Docker image. This improves
build caching while ensuring complete source code is present.

* Enhance configuration management and add new setup scripts (#235)

* Enhance configuration management and add new setup scripts

- Updated .gitignore to include config.yml and its template.
- Added config.yml.template for default configuration settings.
- Introduced restart.sh script for service management.
- Enhanced services.py to load config.yml and check for Obsidian/Neo4j integration.
- Updated wizard.py to prompt for Obsidian/Neo4j configuration during setup and create config.yml from template if it doesn't exist.

* Refactor transcription providers and enhance configuration management

- Updated Docker Compose files to include the new Neo4j service configuration.
- Added support for Obsidian/Neo4j integration in the setup process.
- Refactored transcription providers to utilize a registry-driven approach for Deepgram and Parakeet.
- Enhanced error handling and logging in transcription processes.
- Improved environment variable management in test scripts to prioritize command-line overrides.
- Removed deprecated Parakeet provider implementation and streamlined audio stream workers.

* Update configuration management and enhance file structure, add test-matrix (#237)

* Update configuration management and enhance file structure

- Refactored configuration file paths to use a dedicated `config/` directory, including updates to `config.yml` and its template.
- Modified service scripts to load the new configuration path for `config.yml`.
- Enhanced `.gitignore` to include the new configuration files and templates.
- Updated documentation to reflect changes in configuration file locations and usage.
- Improved setup scripts to ensure proper creation and management of configuration files.
- Added new test configurations for various provider combinations to streamline testing processes.

* Add test requirements and clean up imports in wizard.py

- Introduced a new `test-requirements.txt` file to manage testing dependencies.
- Removed redundant import of `shutil` in `wizard.py` to improve code clarity.

* Add ConfigManager for unified configuration management

- Introduced a new `config_manager.py` module to handle reading and writing configurations from `config.yml` and `.env` files, ensuring backward compatibility.
- Refactored `ChronicleSetup` in `backends/advanced/init.py` to utilize `ConfigManager` for loading and updating configurations, simplifying the setup process.
- Removed redundant methods for loading and saving `config.yml` directly in `ChronicleSetup`, as these are now managed by `ConfigManager`.
- Enhanced user feedback during configuration updates, including success messages for changes made to configuration files.

* Refactor transcription provider configuration and enhance setup process

- Updated `.env.template` to clarify speech-to-text configuration and removed deprecated options for Mistral.
- Modified `docker-compose.yml` to streamline environment variable management by removing unused Mistral keys.
- Enhanced `ChronicleSetup` in `init.py` to provide clearer user feedback and updated the transcription provider selection process to rely on `config.yml`.
- Improved error handling in the websocket controller to determine the transcription provider from the model registry instead of environment variables.
- Updated health check routes to reflect the new method of retrieving the transcription provider from `config.yml`.
- Adjusted `config.yml.template` to include comments on transcription provider options for better user guidance.

* Enhance ConfigManager with deep merge functionality

- Updated the `update_memory_config` method to perform a deep merge of updates into the memory configuration, ensuring nested dictionaries are merged correctly.
- Added a new `_deep_merge` method to handle recursive merging of dictionaries, improving configuration management capabilities.

* Refactor run-test.sh and enhance memory extraction tests

- Removed deprecated environment variable handling for TRANSCRIPTION_PROVIDER in `run-test.sh`, streamlining the configuration process.
- Introduced a new `run-custom.sh` script for executing Robot tests with custom configurations, improving test flexibility.
- Enhanced memory extraction tests in `audio_keywords.robot` and `memory_keywords.robot` to include detailed assertions and result handling.
- Updated `queue_keywords.robot` to fail fast if a job is in a 'failed' state when expecting 'completed', improving error handling.
- Refactored `test_env.py` to load environment variables with correct precedence, ensuring better configuration management.

* unify tests to robot test, add some more clean up

* Update health check configuration in docker-compose-test.yml (#241)

- Increased the number of retries from 5 to 10 for improved resilience during service readiness checks.
- Extended the start period from 30s to 60s to allow more time for services to initialize before health checks commence.

* Add step to create test configuration file in robot-tests.yml

- Introduced a new step in the GitHub Actions workflow to copy the test configuration file from tests/configs/deepgram-openai.yml to a new config/config.yml.
- Added logging to confirm the creation of the test config file, improving visibility during the test setup process.

* remove cache step since not required

* coderabbit comments

* Refactor ConfigManager error handling for configuration file loading

- Updated the ConfigManager to raise RuntimeError exceptions when the configuration file is not found or is invalid, improving error visibility and user guidance.
- Removed fallback behavior that previously returned the current directory, ensuring users are explicitly informed about missing or invalid configuration files.

* Refactor _find_repo_root method in ConfigManager

- Updated the _find_repo_root method to locate the repository root using the __file__ location instead of searching for config/config.yml, simplifying the logic and improving reliability.
- Removed the previous error handling that raised a RuntimeError if the configuration file was not found, as the new approach assumes config_manager.py is always at the repo root.

* Enhance speaker recognition service integration and error handling (#245)

* Enhance speaker recognition service integration and error handling

- Updated `docker-compose-test.yml` to enable speaker recognition in the test environment and added a new `speaker-service-test` service for testing purposes.
- Refactored `run-test.sh` to improve the execution of Robot Framework tests from the repository root.
- Enhanced error handling in `speaker_recognition_client.py` to return detailed error messages for connection issues.
- Improved error logging in `speaker_jobs.py` to handle and report errors from the speaker recognition service more effectively.
- Updated `Dockerfile` to copy the full source code after dependencies are cached, ensuring all necessary files are included in the image.

* Remove integration tests workflow and enhance robot tests with HF_TOKEN verification

- Deleted the `integration-tests.yml` workflow file to streamline CI processes.
- Updated `robot-tests.yml` to include verification for the new `HF_TOKEN` secret, ensuring all required secrets are checked before running tests.

* Fix key access in system admin tests to use string indexing for speakers data

* Refactor Robot Framework tests and enhance error handling in memory services

- Removed the creation of the test environment file from the GitHub Actions workflow to streamline setup.
- Updated the Robot Framework tests to utilize a unified test script for improved consistency.
- Enhanced error messages in the MemoryService class to provide more context on connection failures for LLM and vector store providers.
- Added critical checks for API key presence in the OpenAIProvider class to ensure valid credentials are provided before proceeding.
- Adjusted various test setup scripts to use a centralized BACKEND_DIR variable for better maintainability and clarity.

* Refactor test container cleanup in run-robot-tests.sh

- Updated the script to dynamically construct container names from docker-compose services, improving maintainability and reducing hardcoded values.
- Enhanced the cleanup process for stuck test containers by utilizing the COMPOSE_PROJECT_NAME variable.

* Enhance run-robot-tests.sh for improved logging and cleanup

- Set absolute paths for consistent directory references to simplify navigation.
- Capture container logs, status, and resource usage for better debugging.
- Refactor cleanup process to utilize dynamic backend directory references, improving maintainability.
- Ensure proper navigation back to the tests directory after operations.

* Add speaker recognition configuration and update test script defaults

- Introduced speaker recognition settings in config.yml.template, allowing for easy enable/disable and service URL configuration.
- Updated run-robot-tests.sh to use a test-specific configuration file that disables speaker recognition for improved CI performance.
- Modified deepgram-openai.yml to disable speaker recognition during CI tests to enhance execution speed.

* Refactor speaker recognition configuration management

- Updated docker-compose-test.yml to clarify speaker recognition settings, now controlled via config.yml for improved CI performance.
- Enhanced model_registry.py to include a dedicated speaker_recognition field for better configuration handling.
- Modified speaker_recognition_client.py to load configuration from config.yml, allowing for dynamic enabling/disabling of the speaker recognition service based on the configuration.

* Add minimum worker count verification to infrastructure tests

- Introduced a new keyword to verify that the minimum number of workers are registered, enhancing the robustness of health checks.
- Updated the worker count validation test to include a wait mechanism for worker registration, improving test reliability.
- Clarified comments regarding expected worker counts to reflect the distinction between RQ and audio stream workers.

* Update configuration management and enhance model handling

- Added OBSIDIAN_ENABLED configuration to ChronicleSetup for improved feature toggling.
- Introduced speaker_recognition configuration handling in model_registry.py to streamline model loading.
- Refactored imports in deepgram.py to improve clarity and reduce redundancy.

* Refactor configuration management in wizard and ChronicleSetup (#246)

* Refactor configuration management in wizard and ChronicleSetup

- Updated wizard.py to read Obsidian/Neo4j configuration from config.yml, enhancing flexibility and error handling.
- Refactored ChronicleSetup to utilize ConfigManager for loading and verifying config.yml, ensuring a single source of truth.
- Improved user feedback for missing configuration files and streamlined the setup process for memory and transcription providers.

* Fix string formatting for error message in ChronicleSetup

* added JWT issuers for audience auth for service interop and shared us… (#250)

* added JWT issuers for audience auth for service interop and shared user accounts

* amended default value in line wioth code

* Feat/edit chat system prompt (#247)

* Refactor configuration management in wizard and ChronicleSetup

- Updated wizard.py to read Obsidian/Neo4j configuration from config.yml, enhancing flexibility and error handling.
- Refactored ChronicleSetup to utilize ConfigManager for loading and verifying config.yml, ensuring a single source of truth.
- Improved user feedback for missing configuration files and streamlined the setup process for memory and transcription providers.

* Fix string formatting for error message in ChronicleSetup

* Enhance chat configuration management and UI integration

- Updated `services.py` to allow service restart with an option to recreate containers, addressing WSL2 bind mount issues.
- Added new chat configuration management functions in `system_controller.py` for loading, saving, and validating chat prompts.
- Introduced `ChatSettings` component in the web UI for admin users to manage chat configurations easily.
- Updated API service methods in `api.ts` to support chat configuration endpoints.
- Integrated chat settings into the system management page for better accessibility.

* Refactor backend shutdown process and enhance chat service configuration logging

- Updated `start.sh` to improve shutdown handling by explicitly killing the backend process if running.
- Modified `chat_service.py` to enhance logging for loading chat system prompts, providing clearer feedback on configuration usage.
- Added a new `chat` field in `model_registry.py` for better chat service configuration management.
- Updated vector store query parameters in `vector_stores.py` for improved clarity and functionality.
- Enhanced the chat component in the web UI to conditionally auto-scroll based on message sending status.

* Return JSONResponse instead of raw result

* Refactor headers creation in system admin tests

* Make config.yml writable for admin updates

* Docs consolidation (#257)

* Enhance setup documentation and convenience scripts

- Updated the interactive setup wizard instructions to recommend using the convenience script `./wizard.sh` for easier configuration.
- Added detailed instructions for uploading and processing existing audio files via the API, including example commands for single and multiple file uploads.
- Introduced a new section on HAVPE relay configuration for ESP32 audio streaming, providing environment variable setup and command examples.
- Clarified the distributed deployment setup, including GPU and backend separation instructions, and added benefits of using Tailscale for networking.
- Removed outdated `getting-started.md` and `SETUP_SCRIPTS.md` files to streamline documentation and avoid redundancy.

* Update setup instructions and enhance service management scripts

- Replaced direct command instructions with convenience scripts (`./wizard.sh` and `./start.sh`) for easier setup and service management.
- Added detailed usage of convenience scripts for checking service status, restarting, and stopping services.
- Clarified the distinction between convenience scripts and direct command usage for improved user guidance.

* Update speaker recognition models and documentation

- Changed the speaker diarization model from `pyannote/speaker-diarization-3.1` to `pyannote/speaker-diarization-community-1` across multiple files for consistency.
- Updated README files to reflect the new model and its usage instructions, ensuring users have the correct links and information for setup.
- Enhanced clarity in configuration settings related to speaker recognition.

* Docs consolidation (#258)

* Enhance setup documentation and convenience scripts

- Updated the interactive setup wizard instructions to recommend using the convenience script `./wizard.sh` for easier configuration.
- Added detailed instructions for uploading and processing existing audio files via the API, including example commands for single and multiple file uploads.
- Introduced a new section on HAVPE relay configuration for ESP32 audio streaming, providing environment variable setup and command examples.
- Clarified the distributed deployment setup, including GPU and backend separation instructions, and added benefits of using Tailscale for networking.
- Removed outdated `getting-started.md` and `SETUP_SCRIPTS.md` files to streamline documentation and avoid redundancy.

* Update setup instructions and enhance service management scripts

- Replaced direct command instructions with convenience scripts (`./wizard.sh` and `./start.sh`) for easier setup and service management.
- Added detailed usage of convenience scripts for checking service status, restarting, and stopping services.
- Clarified the distinction between convenience scripts and direct command usage for improved user guidance.

* Update speaker recognition models and documentation

- Changed the speaker diarization model from `pyannote/speaker-diarization-3.1` to `pyannote/speaker-diarization-community-1` across multiple files for consistency.
- Updated README files to reflect the new model and its usage instructions, ensuring users have the correct links and information for setup.
- Enhanced clarity in configuration settings related to speaker recognition.

* Enhance transcription provider selection and update HTTPS documentation

- Added a new function in `wizard.py` to prompt users for their preferred transcription provider, allowing options for Deepgram, Parakeet ASR, or none.
- Updated the service setup logic to automatically include ASR services if Parakeet is selected.
- Introduced a new documentation file on SSL certificates and HTTPS setup, detailing the importance of HTTPS for secure connections and microphone access.
- Removed outdated HTTPS setup documentation from `backends/advanced/Docs/HTTPS_SETUP.md` to streamline resources.

* Remove HTTPS setup scripts and related configurations

- Deleted `init-https.sh`, `setup-https.sh`, and `nginx.conf.template` as part of the transition to a new HTTPS setup process.
- Updated `README.md` to reflect the new automatic HTTPS configuration via the setup wizard.
- Adjusted `init.py` to remove references to the deleted HTTPS scripts and ensure proper handling of Caddyfile generation for SSL.
- Streamlined documentation to clarify the new approach for HTTPS setup and configuration management.

* Update quickstart.md (#268)

* v0.2 (#279)

* Refactor configuration management in wizard and ChronicleSetup

- Updated wizard.py to read Obsidian/Neo4j configuration from config.yml, enhancing flexibility and error handling.
- Refactored ChronicleSetup to utilize ConfigManager for loading and verifying config.yml, ensuring a single source of truth.
- Improved user feedback for missing configuration files and streamlined the setup process for memory and transcription providers.

* Fix string formatting for error message in ChronicleSetup

* Enhance chat configuration management and UI integration

- Updated `services.py` to allow service restart with an option to recreate containers, addressing WSL2 bind mount issues.
- Added new chat configuration management functions in `system_controller.py` for loading, saving, and validating chat prompts.
- Introduced `ChatSettings` component in the web UI for admin users to manage chat configurations easily.
- Updated API service methods in `api.ts` to support chat configuration endpoints.
- Integrated chat settings into the system management page for better accessibility.

* Refactor backend shutdown process and enhance chat service configuration logging

- Updated `start.sh` to improve shutdown handling by explicitly killing the backend process if running.
- Modified `chat_service.py` to enhance logging for loading chat system prompts, providing clearer feedback on configuration usage.
- Added a new `chat` field in `model_registry.py` for better chat service configuration management.
- Updated vector store query parameters in `vector_stores.py` for improved clarity and functionality.
- Enhanced the chat component in the web UI to conditionally auto-scroll based on message sending status.

* Implement plugin system for enhanced functionality and configuration management

- Introduced a new plugin architecture to allow for extensibility in the Chronicle application.
- Added Home Assistant plugin for controlling devices via natural language commands triggered by wake words.
- Implemented plugin configuration management endpoints in the API for loading, saving, and validating plugin settings.
- Enhanced the web UI with a dedicated Plugins page for managing plugin configurations.
- Updated Docker Compose files to include Tailscale integration for remote service access.
- Refactored existing services to support plugin interactions during conversation and memory processing.
- Improved error handling and logging for plugin initialization and execution processes.

* Enhance configuration management and plugin system integration

- Updated .gitignore to include plugins.yml for security reasons.
- Modified start.sh to allow passing additional arguments during service startup.
- Refactored wizard.py to support new HF_TOKEN configuration prompts and improved handling of wake words in plugin settings.
- Introduced a new setup_hf_token_if_needed function to streamline Hugging Face token management.
- Enhanced the GitHub Actions workflow to create plugins.yml from a template, ensuring proper configuration setup.
- Added detailed comments and documentation in the plugins.yml.template for better user guidance on Home Assistant integration.

* Implement Redis integration for client-user mapping and enhance wake word processing

- Added asynchronous Redis support in ClientManager for tracking client-user relationships.
- Introduced `initialize_redis_for_client_manager` to set up Redis for cross-container mapping.
- Updated `create_client_state` to use asynchronous tracking for client-user relationships.
- Enhanced wake word processing in PluginRouter with normalization and command extraction.
- Refactored DeepgramStreamingConsumer to utilize async Redis lookups for user ID retrieval.
- Set TTL on Redis streams during client state cleanup for better resource management.

* Refactor Deepgram worker management and enhance text normalization

- Disabled the batch Deepgram worker in favor of the streaming worker to prevent race conditions.
- Updated text normalization in wake word processing to replace punctuation with spaces, preserving word boundaries.
- Enhanced regex pattern for wake word matching to allow optional punctuation and whitespace after the last part.
- Improved logging in DeepgramStreamingConsumer for better visibility of message processing and error handling.

* Add original prompt retrieval and restoration in chat configuration test

- Implemented retrieval of the original chat prompt before saving a custom prompt to ensure test isolation.
- Added restoration of the original prompt after the test to prevent interference with subsequent tests.
- Enhanced the test documentation for clarity on the purpose of these changes.

* Refactor test execution and enhance documentation for integration tests

- Simplified test execution commands in CLAUDE.md and quickstart.md for better usability.
- Added instructions for running tests from the project root and clarified the process for executing the complete Robot Framework test suite.
- Introduced a new Docker service for the Deepgram streaming worker in docker-compose-test.yml to improve testing capabilities.
- Updated system_admin_tests.robot to use a defined default prompt for restoration, enhancing test reliability and clarity.

* Enhance test environment cleanup and improve Deepgram worker management

- Updated `run-test.sh` and `run-robot-tests.sh` to improve cleanup processes, including handling permission issues with Docker.
- Introduced a new function `mark_session_complete` in `session_controller.py` to ensure atomic updates for session completion status.
- Refactored WebSocket and conversation job handling to utilize the new session completion function, enhancing reliability.
- Updated `start-workers.sh` to enable the batch Deepgram worker alongside the streaming worker for improved transcription capabilities.
- Enhanced test scripts to verify the status of Deepgram workers and ensure proper cleanup of test containers.

* Refactor worker management and introduce orchestrator for improved process handling

- Replaced the bash-based `start-workers.sh` script with a Python-based worker orchestrator for better process management and health monitoring.
- Updated `docker-compose.yml` to configure the new orchestrator and adjust worker definitions, including the addition of audio persistence and stream workers.
- Enhanced the Dockerfile to remove the old startup script and ensure the orchestrator is executable.
- Introduced new modules for orchestrator configuration, health monitoring, process management, and worker registry to streamline worker lifecycle management.
- Improved environment variable handling for worker configuration and health checks.

* oops

* oops2

* Remove legacy test runner script and update worker orchestration

- Deleted the `run-test.sh` script, which was used for local test execution.
- Updated Docker configurations to replace the `start-workers.sh` script with `worker_orchestrator.py` for improved worker management.
- Enhanced health monitoring and process management in the orchestrator to ensure better reliability and logging.
- Adjusted deployment configurations to reflect the new orchestrator setup.

* Add bulk restart mechanism for RQ worker registration loss

- Introduced a new method `_handle_registration_loss` to manage RQ worker registration loss, replicating the behavior of the previous bash script.
- Implemented a cooldown period to prevent frequent restarts during network issues.
- Added logging for bulk restart actions and their outcomes to enhance monitoring and debugging capabilities.
- Created a `_restart_all_rq_workers` method to facilitate the bulk restart of RQ workers, ensuring they re-register with Redis upon startup.

* Enhance plugin architecture with event-driven system and test integration

- Introduced a new Test Event Plugin to log all plugin events to an SQLite database for integration testing.
- Updated the plugin system to utilize event subscriptions instead of access levels, allowing for more flexible event handling.
- Refactored the PluginRouter to dispatch events based on subscriptions, improving the event-driven architecture.
- Enhanced Docker configurations to support development and testing environments with appropriate dependencies.
- Added comprehensive integration tests to verify the functionality of the event dispatch system and plugin interactions.
- Updated documentation and test configurations to reflect the new event-based plugin structure.

* Enhance Docker configurations and startup script for test mode

- Updated `docker-compose-test.yml` to include a test command for services, enabling a dedicated test mode.
- Modified `start.sh` to support a `--test` flag, allowing the FastAPI backend to run with test-specific configurations.
- Adjusted worker commands to utilize the `--group test` option in test mode for improved orchestration and management.

* Refactor test scripts for improved reliability and clarity

- Updated `run-robot-tests.sh` to enhance the verification of the Deepgram batch worker process, ensuring non-numeric characters are removed from the check.
- Modified `plugin_tests.robot` to use a more explicit method for checking the length of subscriptions and added a skip condition for unavailable audio files.
- Adjusted `plugin_event_tests.robot` to load the test audio file from a variable, improving test data management.
- Refactored `plugin_keywords.robot` to utilize clearer length checks for subscriptions and event parts, enhancing readability and maintainability.

* remove mistral deadcode; notebooks untouched

* Refactor audio streaming endpoints and improve documentation

- Updated WebSocket endpoints to use a unified format with codec parameters (`/ws?codec=pcm` and `/ws?codec=opus`) for audio streaming, replacing the previous `/ws_pcm` and `/ws_omi` endpoints.
- Enhanced documentation to reflect the new endpoint structure and clarify audio processing capabilities.
- Removed deprecated audio cropping functionality and related configurations to streamline the audio processing workflow.
- Updated various components and scripts to align with the new endpoint structure, ensuring consistent usage across the application.

* Enhance testing infrastructure and API routes for plugin events

- Updated `docker-compose-test.yml` to introduce low speech detection thresholds for testing, improving the accuracy of speech detection during tests.
- Added new test-only API routes in `test_routes.py` for clearing and retrieving plugin events, ensuring a clean state between tests.
- Refactored existing test scripts to utilize the new API endpoints for event management, enhancing test reliability and clarity.
- Improved logging and error handling in various components to facilitate debugging during test execution.
- Adjusted environment variable handling in test setup scripts to streamline configuration and improve flexibility.

* Add audio pipeline architecture documentation and improve audio persistence worker configuration

- Introduced a comprehensive documentation file detailing the audio pipeline architecture, covering data flow, processing stages, and key components.
- Enhanced the audio persistence worker setup by implementing multiple concurrent workers to improve audio processing efficiency.
- Adjusted sleep intervals in the audio streaming persistence job for better responsiveness and event loop yielding.
- Updated test script to run the full suite of integration tests from the specified directory, ensuring thorough testing coverage.

* Add test container setup and teardown scripts

- Introduced `setup-test-containers.sh` for streamlined startup of test containers, including health checks and environment variable loading.
- Added `teardown-test-containers.sh` for simplified container shutdown, with options to remove volumes.
- Enhanced user feedback with color-coded messages for better visibility during test setup and teardown processes.

* Update worker count validation and websocket disconnect tests

- Adjusted worker count expectations in the Worker Count Validation Test to reflect an increase from 7 to 9 workers, accounting for additional audio persistence workers.
- Enhanced the WebSocket Disconnect Conversation End Reason Test by adding steps to maintain audio streaming during disconnection, ensuring accurate simulation of network dropout scenarios.
- Improved comments for clarity and added critical notes regarding inactivity timeout handling.

* Refactor audio storage to MongoDB chunks and enhance cleanup settings management

- Replaced the legacy AudioFile model with AudioChunkDocument for storing audio data in MongoDB, optimizing storage and retrieval.
- Introduced CleanupSettings dataclass for managing soft-deletion configurations, including auto-cleanup and retention days.
- Added admin API routes for retrieving and saving cleanup settings, ensuring better control over data retention policies.
- Updated audio processing workflows to utilize MongoDB chunks, removing dependencies on disk-based audio files.
- Enhanced tests to validate the new audio chunk storage and cleanup functionalities, ensuring robust integration with existing systems.

* Refactor audio processing to utilize MongoDB chunks and enhance job handling

- Removed audio file path parameters from various functions, transitioning to audio data retrieval from MongoDB chunks.
- Updated the `start_post_conversation_jobs` function to reflect changes in audio handling, ensuring jobs reconstruct audio from database chunks.
- Enhanced the `transcribe_full_audio_job` and `recognise_speakers_job` to process audio directly from memory, eliminating the need for temporary files.
- Improved error handling and logging for audio data retrieval, ensuring better feedback during processing.
- Added a new utility function for converting PCM data to WAV format in memory, streamlining audio format handling.

* Refactor speaker recognition client to use in-memory audio data

- Updated methods to accept audio data as bytes instead of file paths, enhancing performance by eliminating disk I/O.
- Improved logging to reflect in-memory audio processing, providing better insights during speaker identification and diarization.
- Streamlined audio data handling in the `diarize_identify_match` and `diarize_and_identify` methods, ensuring consistency across the client.
- Removed temporary file handling, simplifying the audio processing workflow and reducing potential file system errors.

* Add mock providers and update testing workflows for API-independent execution

- Introduced `MockLLMProvider` and `MockTranscriptionProvider` to facilitate testing without external API dependencies, allowing for consistent and controlled test environments.
- Created `run-no-api-tests.sh` script to execute tests that do not require API keys, ensuring separation of API-dependent and independent tests.
- Updated Robot Framework test configurations to utilize mock services, enhancing test reliability and reducing external dependencies.
- Modified existing test workflows to include new configurations and ensure proper handling of results for tests excluding API keys.
- Added `mock-services.yml` configuration to disable external API services while maintaining core functionality for testing purposes.
- Enhanced documentation to reflect the new tagging system for tests requiring API keys, improving clarity on test execution requirements.

* Enhance testing documentation and workflows for API key separation

- Updated CLAUDE.md to clarify test execution modes, emphasizing the separation of tests requiring API keys from those that do not.
- Expanded the testing guidelines in TESTING_GUIDELINES.md to detail the organization of tests based on API dependencies, including tagging conventions and execution paths.
- Improved mock-services.yml to include dummy configurations for LLM and embedding services, ensuring tests can run without actual API calls.
- Added comprehensive documentation on GitHub workflows for different test scenarios, enhancing clarity for contributors and maintainers.

* Update test configurations and documentation for API key management

- Modified `plugins.yml.template` to implement event subscriptions for the Home Assistant plugin, enhancing its event-driven capabilities.
- Revised `README.md` to clarify test execution processes, emphasizing the distinction between tests requiring API keys and those that do not.
- Updated `mock-services.yml` to streamline mock configurations, ensuring compatibility with the new testing workflows.
- Added `requires-api-keys` tags to relevant test cases across various test files, improving organization and clarity regarding API dependencies.
- Enhanced documentation for test scripts and configurations, providing clearer guidance for contributors on executing tests based on API key requirements.

* Add optional service profile to Docker Compose test configuration

* Refactor audio processing and job handling for transcription workflows

- Updated `upload_and_process_audio_files` and `start_post_conversation_jobs` to enqueue transcription jobs separately for file uploads, ensuring accurate processing order.
- Enhanced logging to provide clearer insights into job enqueuing and processing stages.
- Removed batch transcription from the post-conversation job chain for streaming audio, utilizing the streaming transcript directly.
- Introduced word-level timestamps in the `Conversation` model to improve transcript detail and accuracy.
- Updated tests to reflect changes in job handling and ensure proper verification of post-conversation processing.

* Remove unnecessary network aliases from speaker service in Docker Compose configuration

* Add network aliases for speaker service in Docker Compose configuration

* Refactor Conversation model to use string for provider field

- Updated the `Conversation` model to replace the `TranscriptProvider` enum with a string type for the `provider` field, allowing for greater flexibility in provider names.
- Adjusted related job functions to accommodate this change, simplifying provider handling in the transcription workflow.

* Enhance configuration and model handling for waveform data

- Updated Docker Compose files to mount the entire config directory, allowing for better management of configuration files.
- Introduced a new `WaveformData` model to store pre-computed waveform visualization data, improving UI performance by enabling waveform display without real-time decoding.
- Enhanced the `app_factory` and `job` models to include the new `WaveformData` model, ensuring proper initialization and data handling.
- Implemented waveform generation logic in a new worker module, allowing for on-demand waveform creation from audio chunks.
- Added API endpoints for retrieving and generating waveform data, improving the overall audio processing capabilities.
- Updated tests to cover new functionality and ensure robustness in waveform data handling.

* Add SDK testing scripts for authentication, conversation retrieval, and audio upload

- Introduced three new test scripts: `sdk_test_auth.py`, `sdk_test_conversations.py`, and `sdk_test_upload.py`.
- Each script tests different functionalities of the SDK, including authentication, conversation retrieval, and audio file uploads.
- The scripts utilize the `ChronicleClient` to perform operations and print results for verification.
- Enhanced testing capabilities for the SDK, ensuring robust validation of core features.

* Enhance audio processing and conversation handling for large files

- Added configuration options for speaker recognition chunking in `.env.template`, allowing for better management of large audio files.
- Updated `get_conversations` function to include an `include_deleted` parameter for filtering conversations based on their deletion status.
- Enhanced `finalize_session` method in `AudioStreamProducer` to send an end marker to Redis, ensuring proper session closure.
- Introduced `reconstruct_audio_segments` function to yield audio segments with overlap for efficient processing of lengthy conversations.
- Implemented merging of overlapping speaker segments to improve accuracy in speaker recognition.
- Added integration tests for WebSocket streaming transcription to validate the end_marker functionality and overall transcription flow.

* archive

* Implement annotation system and enhance audio processing capabilities

- Introduced a new annotation model to support user edits and AI-powered suggestions for memories and transcripts.
- Added annotation routes for CRUD operations, enabling the creation and management of annotations via the API.
- Enhanced the audio processing workflow to support fetching audio segments from the backend, improving speaker recognition accuracy.
- Updated the speaker recognition client to handle conversation-based audio fetching, allowing for better management of large audio files.
- Implemented a cron job for generating AI suggestions on potential errors in transcripts and memories, improving user experience and content accuracy.
- Enhanced the web UI to support inline editing of transcript segments and memory content, providing a more interactive user experience.
- Updated configuration files to support new features and improve overall system flexibility.

* Implement OmegaConf-based configuration management for backend settings

- Introduced a new configuration loader using OmegaConf for unified management of backend settings.
- Updated existing configuration functions to leverage the new loader, enhancing flexibility and maintainability.
- Added support for environment variable interpolation in configuration files.
- Refactored various components to retrieve settings from the new configuration system, improving consistency across the application.
- Updated requirements to include OmegaConf as a dependency.
- Enhanced documentation and comments for clarity on configuration management.

* Refactor .env.template and remove unused diarization configuration

- Updated the .env.template to clarify its purpose for secret values and streamline setup instructions.
- Removed the deprecated diarization_config.json.template file, as it is no longer needed.
- Added new environment variables for Langfuse and Tailscale integration to enhance observability and remote service access.

* Implement legacy environment variable syntax support in configuration loader

- Added custom OmegaConf resolvers to handle legacy ${VAR:-default} syntax for backward compatibility.
- Introduced a preprocessing function to convert legacy syntax in YAML files to OmegaConf-compatible format.
- Updated the load_config function to utilize the new preprocessing for loading defaults and user configurations.
- Enhanced documentation for clarity on the new legacy syntax handling.

* Add plugins configuration path retrieval and refactor usage

- Introduced a new function `get_plugins_yml_path` to centralize the retrieval of the plugins.yml file path.
- Updated `system_controller.py` and `plugin_service.py` to use the new function for improved maintainability and consistency in accessing the plugins configuration.
- Enhanced code clarity by removing hardcoded paths and utilizing the centralized configuration method.

* Unify plugin terminology and fix memory job dependencies

Plugin terminology: subscriptions→events, trigger→condition
Memory jobs: no longer blocked by disabled speaker recognition

* Update Docker Compose configuration and enhance system routes

- Updated Docker Compose files to mount the entire config directory, consolidating configuration management.
- Refactored the `save_diarization_settings` function to improve clarity and maintainability by renaming it to `save_diarization_settings_controller`.
- Enhanced the System component in the web UI to include configuration diagnostics, providing better visibility into system health and issues.

* circular import

* Refactor testing infrastructure and enhance container management

- Updated the testing documentation to reflect a new Makefile-based approach for running tests and managing containers.
- Introduced new scripts for container management, including starting, stopping, restarting, and cleaning containers while preserving logs.
- Added a cleanup script to handle data ownership and permissions correctly.
- Implemented a logging system that saves container logs automatically before cleanup.
- Enhanced the README with detailed instructions for running tests and managing the test environment.

* Add Email Summarizer Plugin and SMTP Email Service

- Introduced the Email Summarizer Plugin that automatically sends email summaries upon conversation completion.
- Implemented SMTP Email Service for sending emails, supporting HTML and plain text formats with TLS/SSL encryption.
- Added configuration options for SMTP settings in the .env.template and plugins.yml.template.
- Created comprehensive documentation for plugin development and usage, including a new plugin generation script.
- Enhanced testing coverage for the Email Summarizer Plugin and SMTP Email Service to ensure reliability and functionality.

* Refactor plugin management and introduce Email Summarizer setup

- Removed the static PLUGINS dictionary and replaced it with a dynamic discovery mechanism for plugins.
- Implemented a new setup process for plugins, allowing for configuration via individual setup scripts.
- Added the Email Summarizer plugin with a dedicated setup script for SMTP configuration.
- Enhanced the main setup flow to support community plugins and their configuration.
- Cleaned up unused functions related to plugin configuration and streamlined the overall plugin setup process.

* Enhance plugin configuration and documentation

- Updated the .env.template to include new configuration options for the Home Assistant and Email Summarizer plugins, including server URLs, tokens, and additional settings.
- Refactored Docker Compose files to correctly mount plugin configuration paths.
- Introduced comprehensive documentation for plugin configuration architecture, detailing the separation of concerns for orchestration, settings, and secrets.
- Added individual configuration files for the Home Assistant and Email Summarizer plugins, ensuring proper management of non-secret settings and environment variable references.
- Improved the plugin loading process to merge configurations from multiple sources, enhancing flexibility and maintainability.

* Refactor plugin setup process to allow interactive user input

- Updated the plugin setup script to run interactively, enabling plugins to prompt for user input during configuration.
- Removed output capturing to facilitate real-time interaction and improved error messaging to include exit codes for better debugging.

* Add shared setup utilities for interactive configuration

- Introduced `setup_utils.py` containing functions for reading environment variables, prompting user input, and masking sensitive values.
- Refactored existing code in `wizard.py` and `init.py` to utilize these shared utilities, improving code reuse and maintainability.
- Updated documentation to include usage examples for the new utilities in plugin setup scripts, enhancing developer experience and clarity.

* Enhance plugin security architecture and configuration management

- Introduced a three-file separation for plugin configuration to improve security:
  - `backends/advanced/.env` for secrets (gitignored)
  - `config/plugins.yml` for orchestration with environment variable references
  - `plugins/{plugin_id}/config.yml` for non-secret defaults
- Updated documentation to emphasize the importance of using `${ENV_VAR}` syntax for sensitive data and provided examples of correct usage.
- Enhanced the Email Summarizer plugin setup process to automatically update `config/plugins.yml` with environment variable references, ensuring secrets are not hardcoded.
- Added new fields to the User model for notification email management and improved error logging in user-related functions.
- Refactored audio chunk utilities to use a consistent method for fetching conversation metadata.

* Refactor backend components for improved functionality and stability

- Added a new parameter `transcript_version_id` to the `open_conversation_job` function to support streaming transcript versioning.
- Enhanced error handling in `check_enrolled_speakers_job` and `recognise_speakers_job` to allow conversations to proceed even when the speaker service is unavailable, improving resilience.
- Updated `send_to_adv.py` to support dynamic WebSocket and HTTP protocols based on environment settings, enhancing configuration flexibility.
- Introduced a background task in `send_to_adv.py` to handle incoming messages from the backend, ensuring connection stability and logging interim results.

* Refactor plugin setup timing to enhance configuration flow

* Refactor save_diarization_settings_controller to improve validation and error handling

- Updated the controller to filter out invalid settings instead of raising an error for each unknown key, allowing for more flexible input.
- Added a check to reject requests with no valid settings provided, enhancing robustness.
- Adjusted logging to reflect the filtered settings being saved.

* Refactor audio processing and conversation management for improved deduplication and tracking

* Refactor audio and email handling for improved functionality and security

- Updated `mask_value` function to handle whitespace more effectively.
- Enhanced `create_plugin` to remove existing directories when using the `--force` option.
- Changed logging level from error to debug for existing admin user checks.
- Improved client ID generation logging for clarity.
- Removed unused fields from conversation creation.
- Added HTML escaping in email templates to prevent XSS attacks.
- Updated audio file download function to include user ID for better tracking.
- Adjusted WebSocket connection settings to respect SSL verification based on environment variables.

* Refactor audio upload functionality to remove unused parameters

- Removed `auto_generate_client` and `folder` parameters from audio upload functions to streamline the API.
- Updated related function calls and documentation to reflect these changes, enhancing clarity and reducing complexity.

* Refactor Email Summarizer plugin configuration for improved clarity and security

- Removed outdated migration instructions from `plugin-configuration.md` to streamline documentation.
- Enhanced `README.md` to clearly outline the three-file separation for plugin configuration, emphasizing the roles of `.env`, `config.yml`, and `plugins.yml`.
- Updated `setup.py` to reflect changes in orchestration settings, ensuring only relevant configurations are included in `config/plugins.yml`.
- Improved security messaging to highlight the importance of not committing secrets to version control.

* Update API key configuration in config.yml.template to use environment variable syntax for improved flexibility and security. This change standardizes the way API keys are referenced across different models and services. (#273)

Co-authored-by: roshan.john <roshanjohn1460@gmail.com>

* Refactor Redis job queue cleanup process for improved success tracking

- Replaced total job count with separate counters for successful and failed jobs during Redis queue cleanup.
- Enhanced logging to provide detailed feedback on the number of jobs cleared and any failures encountered.
- Improved error handling to ensure job counts are accurately reflected even when exceptions occur.

* fix tests

* Update CI workflows to use 'docker compose' for log retrieval and added container status check

- Replaced 'docker logs' commands with 'docker compose -f docker-compose-test.yml logs' for consistency across workflows.
- Added a check for running containers before saving logs to enhance debugging capabilities.

* test fixes

* FIX StreamingTranscriptionConsumer to support cumulative audio timestamp adjustments

- Added `audio_offset_seconds` to track cumulative audio duration for accurate timestamp adjustments across transcription sessions.
- Updated `store_final_result` method to adjust word and segment timestamps based on cumulative audio offset.
- Improved logging to reflect changes in audio offset after storing results.
- Modified Makefile and documentation to clarify test execution options, including new tags for slow and SDK tests, enhancing test organization and execution clarity.

* Enhance test container setup and improve error messages in integration tests

- Set `COMPOSE_PROJECT_NAME` for test containers to ensure consistent naming.
- Consolidated error messages in the `websocket_transcription_e2e_test.robot` file for clarity, improving readability and debugging.

* Improve WebSocket closing logic and enhance integration test teardown

- Added timeout handling for WebSocket closure in `AudioStreamClient` to prevent hanging and ensure clean disconnection.
- Updated integration tests to log the total chunks sent when closing audio streams, improving clarity on resource management during test teardown.

* Refactor job status handling to align with RQ standards

- Updated job status checks across various modules to use "started" and "finished" instead of "processing" and "completed" for consistency with RQ's naming conventions.
- Adjusted related logging and response messages to reflect the new status terminology.
- Simplified Docker Compose project name handling in test scripts to avoid conflicts and improve clarity in test environment setup.

* Update test configurations and improve audio inactivity handling

- Increased `SPEECH_INACTIVITY_THRESHOLD_SECONDS` to 20 seconds in `docker-compose-test.yml` for better audio duration handling during tests.
- Refactored session handling in `session_controller.py` to clarify client ID usage.
- Updated `conversation_utils.py` to track speech activity using audio timestamps, enhancing accuracy in inactivity detection.
- Simplified test scripts by removing unnecessary `COMPOSE_PROJECT_NAME` references, aligning with the new project naming convention.
- Adjusted integration tests to reflect changes in inactivity timeout and ensure proper handling of audio timestamps.

* Refactor audio processing and enhance error handling

- Updated `worker_orchestrator.py` to use `logger.exception` for improved error logging.
- Changed default MongoDB database name from "friend-lite" to "chronicle" in multiple files for consistency.
- Added a new method `close_stream_without_stop` in `audio_stream_client.py` to handle abrupt WebSocket disconnections.
- Enhanced audio validation in `audio_utils.py` to support automatic resampling of audio data if sample rates do not match.
- Improved logging in various modules to provide clearer insights during audio processing and event dispatching.

* Enhance Docker command handling and configuration management

- Updated `run_compose_command` to support separate build commands for services, including profile management for backend and speaker-recognition services.
- Improved error handling and output streaming during Docker command execution.
- Added `ensure_docker_network` function to verify and create the required Docker network before starting services.
- Refactored configuration files to utilize `oc.env` for environment variable management, ensuring better compatibility and flexibility across different environments.

* Enhance configuration loading to support custom config file paths

- Added support for the CONFIG_FILE environment variable to allow specifying custom configuration files for testing.
- Implemented logic to handle both absolute paths and relative filenames for the configuration file, improving flexibility in configuration management.

* Update test scripts to use TEST_CONFIG_FILE for configuration management

- Replaced CONFIG_FILE with TEST_CONFIG_FILE in both run-no-api-tests.sh and run-robot-tests.sh to standardize configuration file usage.
- Updated paths to point to mock and deepgram-openai configuration files inside the container, improving clarity and consistency in test setups.

* Refactor audio upload response handling and improve error reporting

- Updated `upload_and_process_audio_files` to return appropriate HTTP status codes based on upload results: 400 for all failures, 207 for partial successes, and 200 for complete success.
- Enhanced error messages in the audio upload tests to provide clearer feedback on upload failures, including specific error details for better debugging.
- Adjusted test scripts to ensure consistent handling of conversation IDs in job metadata, improving validation checks for job creation.

* Refactor audio processing and job handling to improve transcription management

- Updated `upload_and_process_audio_files` to check for transcription provider availability before enqueueing jobs, enhancing error handling and logging.
- Modified `start_post_conversation_jobs` to conditionally enqueue memory extraction jobs based on configuration, improving flexibility in job management.
- Enhanced event dispatch job dependencies to only include jobs that were actually enqueued, ensuring accurate job tracking.
- Added `is_transcription_available` function to check transcription provider status, improving modularity and clarity in the transcription workflow.

* Enhance integration tests for plugin events and improve error handling

- Updated integration tests to filter plugin events by conversation ID, ensuring accurate event tracking and reducing noise from fixture events.
- Improved error messages in event verification to include conversation ID context, enhancing clarity during test failures.
- Refactored audio upload handling to check for transcription job creation, allowing for more robust conversation polling and error reporting.
- Added new keyword to verify conversation end reasons, improving test coverage for conversation state validation.

* Enhance speaker recognition testing and audio processing

- Added mock speaker recognition client to facilitate testing without resource-intensive dependencies.
- Updated Docker Compose configurations to include mock speaker client for test environments.
- Refactored audio segment reconstruction to ensure precise clipping based on time boundaries.
- Improved error handling in transcription jobs and speaker recognition workflows to enhance robustness.
- Adjusted integration tests to utilize real-time pacing for audio chunk streaming, improving test accuracy.

* Refactor audio chunk retrieval and enhance logging in audio processing

- Introduced logging for audio chunk requests to improve traceability.
- Replaced manual audio chunk processing with a dedicated `reconstruct_audio_segment` function for better clarity and efficiency.
- Improved error handling during audio reconstruction to provide more informative responses in case of failures.
- Cleaned up imports and removed redundant code related to audio chunk calculations.

* Refactor mock speaker recognition client and improve testing structure

- Replaced direct import of mock client with a structured import from the new testing module.
- Introduced a dedicated `mock_speaker_client.py` to provide a mock implementation for speaker recognition, facilitating testing without heavy dependencies.
- Added an `__init__.py` file in the testing directory to organize testing utilities and mocks.

* Enhance conversation model to include word-level timestamps and improve transcript handling

- Added a new `words` field to the `Conversation` model for storing word-level timestamps.
- Updated methods to handle word data during transcript version creation, ensuring compatibility with speaker recognition.
- Refactored conversation job processing to utilize the new word structure, improving data integrity and access.
- Enhanced speaker recognition job to read words from the new standardized location, ensuring backward compatibility with legacy data.

* Implement speaker reprocessing feature and enhance timeout calculation

- Added a new endpoint to reprocess speaker identification for existing transcripts, creating a new version with re-identified speakers.
- Introduced a method…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants