A modern Streamlit chatbot where you can choose the AI's personality type to get responses tailored to different cognitive styles and communication patterns.
- Personalized AI Responses - Get answers tailored to your cognitive preferences
- Modern UI Design - Clean, minimalist interface with smooth animations
- Chat History - Keep track of your conversations
- localStorage Integration - Persistent user data across browser sessions
- Memory System (Memobase) - Long-term conversation memory with cloud sync
- Powered by Mistral-7B - Using Together.ai's advanced language model
The application uses browser localStorage for immediate data persistence:
- User Name Storage - Remembers your name across browser sessions
- Session Management - Maintains user identity locally
- Browser ID Mapping - Links browser sessions to cloud memory
- Fast Access - Instant loading without API calls
- Privacy First - Data stays on your device
// localStorage functions currently used
saveNameToLocalStorage(name)
getNameFromLocalStorage()
saveBrowserIdToLocalStorage(browserId)
getBrowserIdFromLocalStorage()
saveMemobaseMappingForBrowser(browserId, memobaseId)
getMemobaseMappingForBrowser(browserId)Advanced cloud-based memory system for long-term conversation storage:
- Long-term Memory - Conversations saved to cloud storage
- Cross-Device Sync - Access your history from any device
- Context Awareness - AI remembers previous conversations
- Manual Save Control - Choose what to save to preserve API credits
- Profile Building - System learns about user preferences over time
- Browser Identity - Unique ID generated and stored in localStorage
- Cloud Mapping - Browser ID mapped to Memobase user account
- Conversation Storage - Chat history saved as ChatBlob format
- Context Retrieval - Relevant past conversations inform AI responses
- Memory Flush - Triggers profile and event extraction
localStorage (Fast) ββ Memobase Cloud (Persistent)
β β
User Identity Conversation History
Session Data Cross-Device Sync
Complete data flow architecture of the Personality AI Chat system:
graph TB
%% User Input Layer
subgraph UserLayer ["π€ User Input Layer"]
User[π€ User<br/>Question + Personality]
end
%% Storage Layer - Side by side
subgraph StorageLayer ["πΎ Storage Layer"]
direction LR
LocalStorage[π± Browser Storage<br/>β’ User Name<br/>β’ Browser ID<br/>β’ Session Data]
CloudMemory[βοΈ Cloud Memory<br/>β’ Chat History<br/>β’ User Context<br/>β’ Profile Data]
LocalStorage <--> CloudMemory
end
%% AI Processing Layer - Sequential flow
subgraph AILayer ["π€ AI Processing Layer"]
direction LR
MemoryRetrieval[π§ Memory Context<br/>Retrieval]
PromptBuilder[π§ Prompt Builder<br/>+ Personality<br/>+ User History]
TogetherAPI[π Together.ai API<br/>Mistral-7B Model]
MemoryRetrieval --> PromptBuilder --> TogetherAPI
end
%% Output Layer - Response handling
subgraph OutputLayer ["π€ Output Layer"]
direction TB
AIResponse[β¨ Personality Response]
ChatUI[π¬ Display in Chat]
subgraph SaveOptions ["πΎ Save Decision"]
direction LR
CloudSave[βοΈ Yes β Cloud]
SessionOnly[π± No β Session Only]
end
AIResponse --> ChatUI
ChatUI --> SaveOptions
end
%% Main Flow Connections
User --> LocalStorage
User --> MemoryRetrieval
CloudMemory --> MemoryRetrieval
TogetherAPI --> AIResponse
CloudSave --> CloudMemory
%% Enhanced Styling
classDef userClass fill:#E3F2FD,stroke:#1976D2,stroke-width:3px,color:#000
classDef storageClass fill:#F3E5F5,stroke:#7B1FA2,stroke-width:3px,color:#000
classDef aiClass fill:#E8F5E8,stroke:#388E3C,stroke-width:3px,color:#000
classDef outputClass fill:#FFF3E0,stroke:#F57C00,stroke-width:3px,color:#000
classDef saveClass fill:#FFEBEE,stroke:#D32F2F,stroke-width:2px,color:#000
class User userClass
class LocalStorage,CloudMemory storageClass
class MemoryRetrieval,PromptBuilder,TogetherAPI aiClass
class AIResponse,ChatUI outputClass
class CloudSave,SessionOnly saveClass
%% Layer styling
class UserLayer userClass
class StorageLayer storageClass
class AILayer aiClass
class OutputLayer outputClass
- π€ User Input - User enters question & selects personality type
- π± Instant Storage - localStorage saves user identity and session data
- βοΈ Memory Retrieval - System fetches relevant conversation history from Memobase
- π§ Prompt Building - Combines user input + personality + historical context
- π€ AI Processing - Together.ai processes with Mistral-7B model
- β¨ Response Generation - AI generates personality-tailored response
- π¬ UI Display - Response appears in chat interface
- πΎ Save Decision - User chooses: save to cloud or keep session-only
flowchart LR
subgraph Browser ["π Browser Environment"]
LS[π± localStorage<br/>β’ User Identity<br/>β’ Session Data<br/>β’ Fast Access]
end
subgraph Cloud ["βοΈ Cloud Storage"]
MB[π§ Memobase<br/>β’ Conversation History<br/>β’ User Profiles<br/>β’ Cross-Device Sync]
end
LS -.->|Auto Sync| MB
MB -.->|Context Retrieval| LS
classDef browserStyle fill:#E3F2FD,stroke:#1976D2,stroke-width:3px
classDef cloudStyle fill:#E8F5E8,stroke:#388E3C,stroke-width:3px
class LS,Browser browserStyle
class MB,Cloud cloudStyle
- Streamlit - Web application framework
- Together.ai API - AI language model (Mistral-7B)
- Memobase - Cloud memory and context management
- JavaScript localStorage - Browser-based data persistence
- Python - Backend logic
- CSS - Custom styling and animations
-
Clone the repository
git clone https://github.com/yourusername/cognitype-chatbot.git cd cognitype-chatbot -
Install dependencies
pip install -r requirements.txt
-
Set up environment variables Create a
.env.localfile:TOGETHER_API_KEY="your-together-ai-api-key" MEMOBASE_API_KEY="your-memobase-api-key" MEMOBASE_URL="https://api.memobase.dev"
-
Run the application
streamlit run app.py
This application can be deployed on various platforms:
- Streamlit Community Cloud (Free)
- Railway ($5/month, no sleep mode)
- Render (Free tier with sleep mode)
- DigitalOcean App Platform ($5/month)
The chatbot uses Together.ai's Mistral-7B model with personality-specific prompts:
- Personalized Responses - Each personality type gets tailored communication style
- Context Awareness - Considers cognitive preferences and decision-making patterns
- Error Handling - Robust API error management
- Rate Limiting - Handles API limits gracefully
TOGETHER_API_KEY=your-together-ai-api-key-hereThis project is open source and available under the MIT License.
Contributions are welcome! Please feel free to submit a Pull Request.
For questions or suggestions, please open an issue on GitHub.
Built with β€οΈ using Streamlit β’ Powered by Together.ai & Mistral-7B