☁️
Zus Docs
  • About Züs
  • System
    • Providers and Services
      • Miner
      • Sharder
      • Blobber
      • Validator
      • Authorizer
      • Node Locator (0DNS)
    • Storage
      • Architecture and Data Management
      • Protocol
        • Allocations
        • Reference Objects
        • Challenges
        • Write Markers
          • Chain Hashing
          • Two Commit
        • Blobber Repair Protocol
      • ZS3 Server
        • Backup, Recovery and Replication
        • Encryption and Compression
        • S3FS Setup and Usage
        • Backup & Recovery with Restic on Blimp + ZS3 Server
        • Backup & Recovery with Veeam on Blimp + ZS3 Server
      • File Operations
        • Upload
        • Download
        • File Sharing
        • Partial Error Recovery
        • Streaming
        • Rent a Blobber
    • Smart Contracts
      • Storage S.C.
      • Miner S.C.
      • ZCN S.C.
      • ERC-20 S.C.s
      • Bridge Protocol
    • Blockchain & Consensus
      • Entities
    • User Authentication and Wallet Management System
      • OKTA Integration
      • Key Management System (KMS)
  • APIs
    • 0DNS API
    • JS API
    • Mobile API
  • CLIs
    • Storage CLI
      • Quickstart
      • Configuring the tool
    • Wallet CLI
      • Wallet Configuration
      • Quickstart
      • Configuring the tool
  • SDKs
    • Go SDK
      • GO SDK Microservices
    • JS SDK
  • Tokenomics
    • Staking
    • Reward & Penalty
  • ✨Züs Apps
    • 🗝️Vult
      • Getting Started
        • Web
        • Mobile
      • Vult AI
        • Batch Processing
        • Memory Retention
        • Technical Implementation
        • Architecture Overview
      • Login / Register
      • File Management Pages
      • File Sharing
      • Storage Management Dashboard
      • Storage Maintenance and Troubleshooting
      • Züs Subscription
      • Wallet Management
      • Refer a friend
      • Settings
    • 🏗️Blimp
      • Getting Started
      • Login / Register
      • Configure Storage
        • Create Standard Storage Allocation
        • Create Enterprise Allocation
        • Create S3 Server Allocation
        • Create Cloud Migration Allocation
        • Allocation Maintenance and Troubleshooting
      • File Management Pages
      • File Sharing
      • Manage Allocations
      • Upgrade Storage
      • Blimp Vault
      • Refer a friend
      • Settings
      • Launching ZS3 Server
      • Using CLI to backup files into Blimp + ZS3 Server
    • 🏠Chimney
      • Getting Started
      • Login / Register
      • Create New Deployment
      • Manage Your Deployments
      • Homepage
      • Staking Dashboard
      • Rank Dashboard
      • Monitor Dashboard
      • Stats Dashboard
      • Logs Dashboard
      • Wallet Dashboard
      • Operations on your Deployments
      • Restricted Blobbers
      • Settings
        • Manage Profile
        • Wallet Settings
        • Update Blobber Settings
        • Update Blobber Version
        • Refer a friend
        • Help
    • 🌐Atlus
      • Getting Started
      • Home page
      • Service Providers Page
      • Charts Page
        • Market Charts
        • Network Charts
        • Storage Charts
      • Blockchain Page
      • Server Map Page
      • Storage Explainer Page
      • Details Pages
        • Block Details Page
        • Transaction Details Page
        • Wallet Details Page
        • Miner Details Page
        • Sharder Details Page
        • Blobber Details Page
        • Validator Details Page
        • Authorizer Details Page
        • Allocation Details Page
      • Appendix: Common Components
    • ⚡Bolt
      • Getting Started
        • Web
        • Mobile
      • Login / Register
      • Sign In with external wallet
      • Staking Dashboard
      • Staking/Unstaking a provider
      • Claiming Rewards
      • Send/Receive ZCN tokens
      • Buy ZCN
      • Deposit/Withdraw ZCN tokens
      • Activity Dashboard
      • Refer a friend
      • Settings
  • Releases
    • Hardfork
Powered by GitBook
On this page
  • High-Level System Components
  • Backend Implementation
  1. Züs Apps
  2. Vult
  3. Vult AI

Architecture Overview

PreviousTechnical ImplementationNextLogin / Register

Last updated 29 days ago

High-Level System Components

The memory retention system consists of the following components:

  • Frontend (Vult AI Chat UI)

    • Users interact with AI via the chat interface.

    • Prompts and responses are stored in the AI Chat Folder.

  • Backend (AI Processing & Memory Storage)

    • Handles user queries and processes AI-generated responses.

    • Uses Mem0 AI API for memory storage and retrieval.

    • Stores structured chat logs in a database or file system.

  • Memory Storage Layer (Mem0 AI API)

    • Stores chat histories and user data.

    • Retrieves relevant memories based on user input and prompt context.

    • Ensures quick access to stored interactions for seamless responses.

Backend Implementation

1. Data Structures (Go Structs for Memory Storage)

type Chat struct {
    ShareInfoUrls       []string                `json:"share_info_urls"`
    ShareInfoIds        string                  `json:"share_info_ids"`
    Prompt             string                  `json:"prompt"`
    Model              string                  `json:"model"`
    IsFileProcessing   bool                    `json:"is_file_processing"`
    MasterPrompt       string                  `json:"master_prompt"`
    OpenAiMessages     []map[string]interface{} `json:"open_ai_messages"`
    DeepSeekMessages   []map[string]interface{} `json:"deep_seek_messages"`
    FileType           string                  `json:"file_type"`
    IsAgentInput       bool                    `json:"is_agent_input"`
    WebSearch          bool                    `json:"web_search"`
}

This struct represents a chat session in Vult AI. The key fields are:

  • Prompt: Stores the user’s latest query.

  • Model: The AI model used for processing.

  • OpenAiMessages: Stores previous interactions with OpenAI models.

  • DeepSeekMessages: Stores previous interactions with DeepSeek models.

  • IsAgentInput: Indicates if the request is from AI Agent (file-based processing).

2. Memory Retrieval via Mem0 AI

func retrieveMemory(userID string, prompt string) (string, error) {
    memoryClient := memory.NewMem0Client(config.Configuration.Mem0ApiKey)

    memoryResponse, err := memoryClient.SearchMemory(userID, prompt)
    if err != nil {
        logger.LogError("AI Chat: Failed to search memory", zap.Error(err))
        return "", err
    }

    if memoryResponse != nil {
        return memoryResponse.Memories, nil
    }
    return "", nil
}

This function:

  1. Initializes the Mem0 API client.

  2. Calls SearchMemory() to fetch previously stored interactions.

  3. If memory exists, it returns retrieved context to be appended to the user prompt.

3. AI Model Processing with Memory Context

func processChatRequest(ctx context.Context, chatInput Chat) (Response, error) {
    memoryContext, _ := retrieveMemory(chatInput.UserID, chatInput.Prompt)

    chatInput.Prompt = memoryContext + "\nUser Question: " + chatInput.Prompt

    res, err := aiAgentService.CreateChat(ctx, authHeaders, chatInput)
    if err != nil {
        ctx.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"error": err.Error()})
        return nil, err
    }

    return res, nil
}

This function:

  1. Calls retrieveMemory() to fetch relevant past interactions.

  2. Appends retrieved memory to the current user prompt.

  3. Passes the enriched prompt to the AI model for response generation.

  4. Returns the processed response to the Vult AI UI.

✨
🗝️