🔍 Code Extractor

Browse Components

Showing 20 of 796 components

  • function get_document_info

    Retrieves indexing status and metadata for a document, including whether it's indexed, its document ID, chunk count, and reindexing status.

    File: /tf/active/vicechatdev/docchat/app.py | Lines: 479-514

    document-management indexing metadata vector-database chromadb
  • function build_document_tree_recursive

    Recursively builds a complete hierarchical tree structure of documents and folders from a target directory path, filtering for supported file types and skipping hidden/cache directories.

    File: /tf/active/vicechatdev/docchat/app.py | Lines: 404-476

    file-system directory-traversal recursive document-management tree-structure
  • function build_document_tree_lazy

    Builds a single-level document tree structure for lazy loading, scanning only immediate children of a target directory without recursively loading subdirectories.

    File: /tf/active/vicechatdev/docchat/app.py | Lines: 325-401

    file-system directory-tree lazy-loading document-management file-browser
  • function save_config_to_file

    Persists current application configuration values from the config module to a .env file, maintaining existing entries and formatting multi-value fields appropriately.

    File: /tf/active/vicechatdev/docchat/app.py | Lines: 284-322

    configuration persistence file-io environment-variables dotenv
  • function update_session_settings

    Updates the settings (model, mode, options) for an existing chat session and persists the changes to disk.

    File: /tf/active/vicechatdev/docchat/app.py | Lines: 274-281

    session-management settings persistence thread-safe chat
  • function add_message_to_session

    Adds a message to a chat session with thread-safe locking, storing role, content, timestamp, and optional metadata/references, then persists the session to disk.

    File: /tf/active/vicechatdev/docchat/app.py | Lines: 243-261

    chat session-management thread-safe messaging persistence
  • function get_or_create_session

    Retrieves an existing chat session by ID or creates a new one if it doesn't exist, with thread-safe access and persistent storage support.

    File: /tf/active/vicechatdev/docchat/app.py | Lines: 223-240

    session-management chat thread-safe persistence caching
  • function cleanup_old_tasks

    Removes tasks from the active_tasks dictionary that are older than 1 hour (3600 seconds) based on their creation timestamp.

    File: /tf/active/vicechatdev/docchat/app.py | Lines: 208-220

    cleanup maintenance task-management thread-safe memory-management
  • function complete_task

    Updates the status of a task to 'completed' in a thread-safe manner, storing the result and completion timestamp.

    File: /tf/active/vicechatdev/docchat/app.py | Lines: 184-190

    task-management threading concurrency state-management thread-safe
  • function update_task_progress

    Thread-safe function that updates the progress and timestamp of an active task identified by task_id in a shared dictionary.

    File: /tf/active/vicechatdev/docchat/app.py | Lines: 176-181

    task-management progress-tracking thread-safe concurrency locking
  • function create_task

    Creates and registers a new background task in a thread-safe manner by initializing its metadata in a shared dictionary with status tracking, progress information, and timestamps.

    File: /tf/active/vicechatdev/docchat/app.py | Lines: 163-173

    task-management background-tasks thread-safe concurrency task-tracking
  • function load_all_sessions

    Loads all chat session data from JSON files stored in a sessions directory into memory on application startup.

    File: /tf/active/vicechatdev/docchat/app.py | Lines: 149-160

    session-management persistence initialization disk-io thread-safe
  • function load_session_from_disk

    Loads a session from disk storage by reading a JSON file identified by session_id, deserializing the data, and converting timestamp strings back to datetime objects.

    File: /tf/active/vicechatdev/docchat/app.py | Lines: 133-146

    session-management persistence file-io deserialization json
  • function save_session_to_disk

    Persists a chat session to disk by serializing session data to a JSON file, converting datetime objects to ISO format strings.

    File: /tf/active/vicechatdev/docchat/app.py | Lines: 117-130

    persistence serialization session-management file-io json
  • function is_admin_user

    Checks if the currently authenticated user has administrator privileges by comparing their email against a hardcoded list of admin emails.

    File: /tf/active/vicechatdev/docchat/app.py | Lines: 107-113

    authentication authorization rbac admin access-control
  • function get_current_user_id

    Retrieves the current logged-in user's ID from the Flask session, returning 'anonymous' if authentication is disabled or no user is logged in.

    File: /tf/active/vicechatdev/docchat/app.py | Lines: 100-104

    authentication session-management user-identification flask access-control
  • function get_user_session_key

    Generates a user-specific session key by combining user ID and session ID when authentication is required, or returns just the session ID otherwise.

    File: /tf/active/vicechatdev/docchat/app.py | Lines: 84-97

    session-management authentication user-session key-generation session-key
  • function login_required

    A Flask decorator that enforces authentication requirements on routes by checking for user session data and redirecting unauthenticated users to the login page.

    File: /tf/active/vicechatdev/docchat/app.py | Lines: 56-69

    authentication decorator flask security session-management
  • function conversation_example

    Demonstrates a multi-turn conversational RAG system with chat history management, showing how follow-up questions are automatically optimized based on conversation context.

    File: /tf/active/vicechatdev/docchat/example_usage.py | Lines: 135-164

    RAG conversational-ai chat-history multi-turn-conversation context-management
  • function full_reading_example

    Demonstrates the full reading mode of a RAG (Retrieval-Augmented Generation) system by processing all documents to answer a comprehensive query about key findings.

    File: /tf/active/vicechatdev/docchat/example_usage.py | Lines: 103-132

    example demonstration RAG retrieval-augmented-generation full-reading