📊 FLOWCHART SISTEM

Assistent Pribadi Telegram AI-Agent v3.0

📖 Dokumentasi Lengkap

Ingin tahu lebih detail tentang sistem ini? Baca dokumentasi lengkap yang mencakup semua fitur, arsitektur, alur kerja, teknologi, dan command reference.

📖 Baca Dokumentasi Lengkap →

Dokumentasi mencakup: Fitur Utama, Arsitektur Sistem, Alur Kerja, Teknologi, Keamanan, dan Command Reference

1. Flowchart Utama Sistem
flowchart TD Start([User Mengirim Pesan]) --> CheckType{Type Pesan?} CheckType -->|"Command /start"| StartCmd["start - Menu Utama"] CheckType -->|"Command /thinking"| ThinkingCmd["thinking - Deep Analysis"] CheckType -->|"Command /debat"| DebatCmd["debat - Multi-Agent Debate"] CheckType -->|"Command /chat"| ChatCmd["chat - Fast Chat"] CheckType -->|"Command /ingat"| MemorySave[Simpan Memory ke Pinecone] CheckType -->|"Command /ingatan"| MemorySearch[Cari Memory dari Pinecone] CheckType -->|Voice Message| VoiceFlow[Voice Router] CheckType -->|Text Message| TextChat[Text Chat Handler] CheckType -->|Photo| PhotoHandler[Scan Struk/Upload] CheckType -->|"File/Video/Audio"| DriveUpload[Upload ke Drive] StartCmd --> ShowMenu[Show Inline Menu] ThinkingCmd --> DebateSystem[4-Stage Debate System] DebatCmd --> DebateSystem ChatCmd --> SimpleAI[Simple AI Chat] VoiceFlow --> VoiceTranscribe[Whisper Transcribe] VoiceTranscribe --> IntentDetect[AI Intent Detection] IntentDetect --> VoiceExecute[Execute Intent Action] TextChat --> MemoryRecall{Check Memory?} MemoryRecall -->|Ada Memory Relevan| AddContext[Add Memory Context] MemoryRecall -->|Tidak Ada| ProcessAI[Process AI Request] AddContext --> ProcessAI ProcessAI --> Response[Generate Response] Response --> AutoSave{"Auto-Save Memory?"} AutoSave -->|"Yes, Important"| SaveMemory[Save to Pinecone] AutoSave -->|No| End([Send Response]) SaveMemory --> End MemorySave --> PineconeDB[(Pinecone Database)] MemorySearch --> PineconeDB SaveMemory --> PineconeDB DriveUpload --> GoogleDrive[(Google Drive)] PhotoHandler --> GoogleSheets[(Google Sheets)] VoiceExecute --> VariousActions["Google Services / Memory / etc"] End --> Done([Selesai]) style DebateSystem fill:#ff9999 style PineconeDB fill:#99ccff style GoogleDrive fill:#99ff99 style GoogleSheets fill:#ffcc99
2. Multi-Agent Debate (4-Stage System)
flowchart TD Start([/thinking atau /debat]) --> CheckPerm{Check Permission} CheckPerm -->|Not Allowed| Reject([⛔ Access Denied]) CheckPerm -->|Allowed| SetContext[Set User Context] SetContext --> MemorySearch1{Memory Available?} MemorySearch1 -->|Yes| SearchMem[Search Pinecone Memory] MemorySearch1 -->|No| EmptyContext[Empty Context] SearchMem --> PreContext[Pre-debate Context] EmptyContext --> PreContext PreContext --> Stage1[STAGE 1: ARCHITECT
DeepSeek-Reasoner] Stage1 --> ArchitectTask[Analyze Query
Determine Data Needs] ArchitectTask --> ActionPlan[Action Plan:
search/memory/logic] ActionPlan --> Stage2[STAGE 2: GATHERER] Stage2 --> GatherType{Action Type?} GatherType -->|search| GoogleSearch[Google Custom Search API] GatherType -->|memory| MemorySearch2[Pinecone Memory Search] GatherType -->|search_memory| BothSearch[Google + Memory Search] GatherType -->|logic| NoGather[No External Data Needed] GoogleSearch --> GatherContext[Gathered Context] MemorySearch2 --> GatherContext BothSearch --> GatherContext NoGather --> GatherContext GatherContext --> CombineContext[Combine: Pre-Context + Gathered] CombineContext --> FinalContext[Final Rich Context] FinalContext --> Stage3A[STAGE 3A: WRITER
DeepSeek-Chat] Stage3A --> WriteDraft[Generate Draft Answer] WriteDraft --> Draft[Draft Answer] Draft --> Stage3B[STAGE 3B: CRITIC
DeepSeek-Chat] Stage3B --> EvaluateDraft[Evaluate & Critique Draft] EvaluateDraft --> Critique[Critique & Suggestions] Draft --> Stage4[STAGE 4: JUDGE
DeepSeek-Reasoner] Critique --> Stage4 Stage4 --> Synthesize[Synthesize Final Answer
With Reasoning] Synthesize --> FinalAnswer[Final Optimal Answer] FinalAnswer --> Format[Format Response] Format --> Send([Send to User]) style Stage1 fill:#ff9999 style Stage2 fill:#ffcc99 style Stage3A fill:#ffff99 style Stage3B fill:#ffff99 style Stage4 fill:#99ff99 style GoogleSearch fill:#99ccff style MemorySearch2 fill:#99ccff
3. Memory System (RAG with Pinecone)
flowchart TD Start([User Action]) --> MemAction{Memory Action?} MemAction -->|/ingat text| ManualSave[Manual Save] MemAction -->|Chat Text| AutoCheck{Auto-Save Enabled?} MemAction -->|/ingatan keyword| SearchMem[Search Memory] MemAction -->|/lupa keyword| DeleteMem[Delete Memory] ManualSave --> GetText[Get Text Input] AutoCheck -->|Yes| AnalyzeText[AI Analyze: should_save_memory] AutoCheck -->|No| Skip([Skip Save]) AnalyzeText --> ShouldSave{Should Save?} ShouldSave -->|Yes| GetText ShouldSave -->|No| Skip GetText --> DetectCategory[Detect Category:
journal/learning/important/personal/work] DetectCategory --> GenerateEmbedding[Generate Embedding
OpenAI Embedding API] GenerateEmbedding --> CreateVector[Create Vector 1536-dim] CreateVector --> PrepareMetadata[Prepare Metadata:
user_id, category, timestamp, summary, text] PrepareMetadata --> UpsertPinecone[Upsert to Pinecone
Vector + Metadata] UpsertPinecone --> PineconeDB[(Pinecone Database
Vector Storage)] UpsertPinecone --> Success([✅ Memory Saved]) SearchMem --> QueryEmbedding[Generate Query Embedding] QueryEmbedding --> VectorSearch[Vector Similarity Search
Cosine Distance] VectorSearch --> PineconeDB PineconeDB --> FilterResults[Filter by Threshold ≥ 0.7] FilterResults --> ReturnMemories[Return Top-K Memories] ReturnMemories --> AIProcess{Use AI Debate?} AIProcess -->|/ingatan keyword| DebateAnalysis[AI Debate Analysis
Synthesize Results] AIProcess -->|List Only| ShowList[Show Memory List] DebateAnalysis --> ShowResults([Show Results]) ShowList --> ShowResults DeleteMem --> DeleteSearch[Search Memory by Keyword] DeleteSearch --> PineconeDB PineconeDB --> DeleteFilter[Filter Matches threshold ≥ 0.5] DeleteFilter --> GetIDs[Get Memory IDs] GetIDs --> DeleteVectors[Delete Vectors from Pinecone] DeleteVectors --> PineconeDB DeleteVectors --> Deleted([✅ Memory Deleted]) style PineconeDB fill:#99ccff style GenerateEmbedding fill:#ffcc99 style VectorSearch fill:#ffcc99 style DebateAnalysis fill:#ff9999
4. Voice Router System
flowchart TD Start([User Kirim Voice Message]) --> CheckPerm{Check Permission} CheckPerm -->|Not Allowed| Reject([⛔ Access Denied]) CheckPerm -->|Allowed| Transcribe[Whisper API
Transcribe Audio] Transcribe --> GetText[Get Transcript Text] GetText --> IntentDetection[AI Intent Detection
Detect Action Type] IntentDetection --> IntentTypes{Intent Type?} IntentTypes -->|memory_save| MemSave[Save to Pinecone] IntentTypes -->|memory_recall| MemRecall[Search Pinecone] IntentTypes -->|keuangan| Expense[Save to Google Sheets] IntentTypes -->|todo| Todo[Manage Todo List] IntentTypes -->|note| Note[Save Note to Memory] IntentTypes -->|summary| Summary[Generate Summary with Chart] IntentTypes -->|drive| Drive[Search/Create in Drive] IntentTypes -->|docs| Docs[Create/Read Document] IntentTypes -->|calendar| Calendar[Manage Calendar Events] IntentTypes -->|email| Email[Check Inbox] IntentTypes -->|sheet| Sheet[Read/Analyze Sheet] IntentTypes -->|search| Search[AI Thinking Mode] IntentTypes -->|image| Image[Generate Image DALL-E] IntentTypes -->|chat| Chat[Simple AI Chat] IntentDetection --> Confidence{Confidence ≥ 80%?} Confidence -->|Yes| AutoExecute[Auto Execute Intent] Confidence -->|No| AskConfirm[Ask User Confirmation
Show Buttons] AskConfirm --> UserConfirm{User Confirm?} UserConfirm -->|Yes| AutoExecute UserConfirm -->|No/Chat| Chat UserConfirm -->|Retry| Start AutoExecute --> IntentTypes MemSave --> PineconeDB[(Pinecone)] MemRecall --> PineconeDB Note --> PineconeDB Expense --> GoogleSheets[(Google Sheets)] Todo --> GoogleSheets Summary --> GoogleSheets Drive --> GoogleDrive[(Google Drive)] Docs --> GoogleDocs[(Google Docs)] Calendar --> GoogleCal[(Google Calendar)] Email --> GmailAPI[(Gmail API)] Sheet --> GoogleSheets Search --> ThinkingMode[DeepSeek-Reasoner
Thinking Mode] Image --> DalleAPI[DALL-E API] Chat --> SimpleAI[Simple AI Chat] MemSave --> Response([Voice Response TTS]) MemRecall --> Response Expense --> Response Todo --> Response Note --> Response Summary --> Response Drive --> Response Docs --> Response Calendar --> Response Email --> Response Sheet --> Response Search --> Response Image --> Response Chat --> Response Response --> End([Send Response + Voice]) style Transcribe fill:#ffcc99 style IntentDetection fill:#ff9999 style PineconeDB fill:#99ccff style GoogleSheets fill:#ffcc99 style ThinkingMode fill:#ff9999
5. Text Chat with Auto-Memory
flowchart TD Start([User Kirim Text Message]) --> CheckCommand{Is Command?} CheckCommand -->|Yes /command| CommandHandler[Route to Command Handler] CheckCommand -->|No| TextChat[Text Chat Handler] TextChat --> CheckButton{Is Button Click?} CheckButton -->|🏠 Start| StartCommand[Execute /start] CheckButton -->|Text| LoadModel[Load User AI Model] LoadModel --> MemoryRecall{Memory Available?} MemoryRecall -->|Yes| SearchMem[Search Pinecone
Top-K = 3, Threshold = 0.7] MemoryRecall -->|No| NoMemory[No Memory Context] SearchMem --> FoundMemory{Found Relevant?} FoundMemory -->|Yes| BuildContext[Build Memory Context String] FoundMemory -->|No| NoMemory BuildContext --> ProcessAI[Process AI with Memory Context] NoMemory --> ProcessAI ProcessAI --> SelectModel{User Model?} SelectModel -->|deepseek-chat| FastMode[Fast Chat Mode
Temperature 0.7] SelectModel -->|deepseek-reasoner| ThinkingMode[Thinking Mode
Temperature 0.6
With Reasoning] FastMode --> StreamResponse[Stream Response to User] ThinkingMode --> StreamResponse StreamResponse --> Response([Send Response]) Response --> AutoSave{Auto-Save Enabled?} AutoSave -->|No| End([Done]) AutoSave -->|Yes| AnalyzeImportance[AI Analyze: should_save_memory] AnalyzeImportance --> IsImportant{Important Info?} IsImportant -->|Yes| SaveToMemory[Save Original Text to Pinecone
Category: Auto-detected
Summary: AI-generated] IsImportant -->|No| End SaveToMemory --> PineconeDB[(Pinecone Database)] PineconeDB --> End style MemoryRecall fill:#99ccff style SearchMem fill:#99ccff style AutoSave fill:#ffcc99 style SaveToMemory fill:#99ccff style PineconeDB fill:#99ccff
6. Integrasi Google Services
flowchart TD Start([User Request Google Service]) --> ServiceType{Service Type?} ServiceType -->|Drive| DriveFlow[Drive Handler] ServiceType -->|Sheets| SheetsFlow[Sheets Handler] ServiceType -->|Docs| DocsFlow[Docs Handler] ServiceType -->|Calendar| CalendarFlow[Calendar Handler] ServiceType -->|Gmail| EmailFlow[Email Handler] ServiceType -->|Forms| FormsFlow[Forms Handler] DriveFlow --> DriveActions{Drive Action?} DriveActions -->|cari| SearchFiles[Search Files in Drive] DriveActions -->|masuk| EnterFolder[Enter Folder] DriveActions -->|keluar| ExitFolder[Back to Root] DriveActions -->|tambah| CreateFolder[Create New Folder] DriveActions -->|hapus| DeleteFile[Delete File/Folder] DriveActions -->|upload| UploadFile[Upload File to Drive] SheetsFlow --> SheetsActions{Sheets Action?} SheetsActions -->|sheet| AnalyzeSheet[AI Analyze Sheet Data
Multi-Agent Debate] SheetsActions -->|buatsheet| CreateSheet[Create New Sheet] SheetsActions -->|isi| InsertData[Insert Data to Sheet] SheetsActions -->|cekdata| QueryData[Query & Analyze Data
Multi-Agent Debate] DocsFlow --> DocsActions{Docs Action?} DocsActions -->|create| CreateDoc[Create Document] DocsActions -->|read| ReadDoc[Read Document Content] DocsActions -->|edit| EditDoc[AI Edit Document
Multi-Agent Debate] CalendarFlow --> CalendarActions{Calendar Action?} CalendarActions -->|list| ListEvents[List Upcoming Events] CalendarActions -->|add| AddEvent[Add New Event] CalendarActions -->|parse| ParseDateTime[AI Parse Date/Time] EmailFlow --> EmailActions{Email Action?} EmailActions -->|email/inbox| ListEmails[List Inbox Emails] EmailActions -->|baca| ReadEmail[Read Email Content] EmailActions -->|balas| ReplyEmail[AI Draft Reply
Multi-Agent Debate] FormsFlow --> FormsActions{Forms Action?} FormsActions -->|formulir| CreateForm[AI Create Form
Multi-Agent Debate] FormsActions -->|form_manual| ManualForm[Manual Form Creation] SearchFiles --> GoogleAPI[(Google Drive API)] EnterFolder --> GoogleAPI ExitFolder --> GoogleAPI CreateFolder --> GoogleAPI DeleteFile --> GoogleAPI UploadFile --> GoogleAPI AnalyzeSheet --> GoogleSheetsAPI[(Google Sheets API)] CreateSheet --> GoogleSheetsAPI InsertData --> GoogleSheetsAPI QueryData --> GoogleSheetsAPI CreateDoc --> GoogleDocsAPI[(Google Docs API)] ReadDoc --> GoogleDocsAPI EditDoc --> GoogleDocsAPI ListEvents --> GoogleCalAPI[(Google Calendar API)] AddEvent --> GoogleCalAPI ParseDateTime --> GoogleCalAPI ListEmails --> GmailAPI[(Gmail API)] ReadEmail --> GmailAPI ReplyEmail --> GmailAPI CreateForm --> GoogleFormsAPI[(Google Forms API)] ManualForm --> GoogleFormsAPI AnalyzeSheet --> DebateSystem[Multi-Agent Debate] QueryData --> DebateSystem EditDoc --> DebateSystem ReplyEmail --> DebateSystem CreateForm --> DebateSystem DebateSystem --> GoogleAPI DebateSystem --> GoogleSheetsAPI DebateSystem --> GoogleDocsAPI DebateSystem --> GmailAPI DebateSystem --> GoogleFormsAPI GoogleAPI --> Response([Return Result]) GoogleSheetsAPI --> Response GoogleDocsAPI --> Response GoogleCalAPI --> Response GmailAPI --> Response GoogleFormsAPI --> Response style DebateSystem fill:#ff9999 style GoogleAPI fill:#99ff99 style GoogleSheetsAPI fill:#ffcc99 style GoogleDocsAPI fill:#ffcc99 style GoogleCalAPI fill:#ffcc99 style GmailAPI fill:#ffcc99 style GoogleFormsAPI fill:#ffcc99
7. Diagram Arsitektur Sistem Lengkap
graph TB subgraph "USER INTERFACE" Telegram[Telegram Bot] end subgraph "HANDLER LAYER" AIHandler[AI Handler] VoiceRouter[Voice Router] MemoryHandler[Memory Handler] LifeOSHandler[LifeOS Handler] GoogleHandlers[Google Services Handlers] end subgraph "SERVICE LAYER" AIClient[AI Client
DeepSeek API] MemoryService[Memory Service
Pinecone] GoogleClient[Google Client
OAuth2] NewsService[News Service] YouTubeService[YouTube Service] end subgraph "AI PROCESSING" DebateSystem[4-Stage Debate System] SimpleChat[Simple Chat] ThinkingMode[Thinking Mode] ImageGen[DALL-E Image Gen] Whisper[TTS/Whisper] end subgraph "EXTERNAL SERVICES" DeepSeekAPI[DeepSeek API
Chat + Reasoner] OpenAIAPI[OpenAI API
Embedding + Vision + TTS] PineconeDB[(Pinecone
Vector Database)] GoogleAPIs[Google APIs
Drive, Sheets, Docs, etc] GoogleSearch[Google Custom Search] end subgraph "DATA STORAGE" SQLiteDB[(SQLite DB
User Settings)] GoogleSheets[(Google Sheets
LifeOS Data)] end Telegram --> AIHandler Telegram --> VoiceRouter Telegram --> MemoryHandler Telegram --> LifeOSHandler Telegram --> GoogleHandlers AIHandler --> AIClient AIHandler --> DebateSystem AIHandler --> SimpleChat AIHandler --> ThinkingMode AIHandler --> ImageGen VoiceRouter --> AIClient VoiceRouter --> Whisper VoiceRouter --> MemoryService VoiceRouter --> GoogleClient MemoryHandler --> MemoryService MemoryHandler --> AIClient MemoryHandler --> DebateSystem LifeOSHandler --> GoogleClient LifeOSHandler --> MemoryService GoogleHandlers --> GoogleClient GoogleHandlers --> DebateSystem AIClient --> DeepSeekAPI AIClient --> OpenAIAPI AIClient --> GoogleSearch MemoryService --> PineconeDB MemoryService --> OpenAIAPI GoogleClient --> GoogleAPIs DebateSystem --> DeepSeekAPI DebateSystem --> GoogleSearch DebateSystem --> PineconeDB SimpleChat --> DeepSeekAPI ThinkingMode --> DeepSeekAPI ImageGen --> OpenAIAPI Whisper --> OpenAIAPI LifeOSHandler --> GoogleSheets AIClient --> SQLiteDB style DebateSystem fill:#ff9999 style PineconeDB fill:#99ccff style DeepSeekAPI fill:#ffcc99 style OpenAIAPI fill:#ffcc99 style GoogleAPIs fill:#99ff99