{"id":22164393,"url":"https://github.com/trendy-design/llmchat","last_synced_at":"2025-05-15T16:03:43.981Z","repository":{"id":239265402,"uuid":"799047774","full_name":"trendy-design/llmchat","owner":"trendy-design","description":"Most intuitive unified AI chat interface.","archived":false,"fork":false,"pushed_at":"2025-04-11T23:18:18.000Z","size":17773,"stargazers_count":550,"open_issues_count":12,"forks_count":111,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-12T01:48:05.463Z","etag":null,"topics":["ai","claude","langchain","llm","local-rag","nextjs","ollama","ollama-client","pglite","rag","shadcn-ui","tailwindcss","tiptap","typescript","vector","vercel"],"latest_commit_sha":null,"homepage":"https://llmchat.co","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trendy-design.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-05-11T03:34:28.000Z","updated_at":"2025-04-11T17:53:25.000Z","dependencies_parsed_at":"2024-05-11T05:23:56.937Z","dependency_job_id":"b550b779-5f62-416d-8bfd-cb4e325c0ef4","html_url":"https://github.com/trendy-design/llmchat","commit_stats":null,"previous_names":["deep93333/aichat","deep93333/llmchat","trendy-design/llmchat","trendy-design/deep.new"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trendy-design%2Fllmchat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trendy-design%2Fllmchat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trendy-design%2Fllmchat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trendy-design%2Fllmchat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trendy-design","download_url":"https://codeload.github.com/trendy-design/llmchat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248880810,"owners_count":21176738,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","claude","langchain","llm","local-rag","nextjs","ollama","ollama-client","pglite","rag","shadcn-ui","tailwindcss","tiptap","typescript","vector","vercel"],"created_at":"2024-12-02T05:07:22.240Z","updated_at":"2025-05-15T16:03:43.974Z","avatar_url":"https://github.com/trendy-design.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","Platforms \u0026 Applications"],"sub_categories":[],"readme":"\n\u003cimg width=\"1512\" alt=\"Screenshot 2025-04-14 at 9 13 25 PM\" src=\"https://github.com/user-attachments/assets/b89d1343-7c6f-4685-8bcf-dbcc71ce2229\" /\u003e\n\n## Introduction\n\n[LLMChat.co](https://llmchat.co) is a sophisticated AI-powered chatbot platform that prioritizes privacy while offering powerful research and agentic capabilities. Built as a monorepo with Next.js, TypeScript, and cutting-edge AI technologies, it provides multiple specialized chat modes including Pro Search and Deep Research for in-depth analysis of complex topics.\n\nLLMChat.co stands out with its workflow orchestration system and focus on privacy, storing all user data locally in the browser using IndexedDB, ensuring your conversations never leave your device.\n\n## Key Features\n\n**Advanced Research Modes**\n\n- **Deep Research**: Comprehensive analysis of complex topics with in-depth exploration\n- **Pro Search**: Enhanced search with web integration for real-time information\n\n**Multiple LLM Provider Support**\n- OpenAI\n- Anthropic\n- Google\n- Fireworks\n- Together AI\n- xAI\n\n**Privacy-Focused**\n\n- **Local Storage**: All user data stored in browser using IndexedDB via Dexie.js\n- **No Server-Side Storage**: Chat history never leaves your device\n\n**Agentic Capabilities**\n- **Workflow Orchestration**: Complex task coordination via custom workflow engine\n- **Reflective Analysis**: Self-improvement through analysis of prior reasoning\n- **Structured Output**: Clean presentation of research findings\n\n## Architecture\n\nLLMChat.co is built as a monorepo with a clear separation of concerns:\n\n```\n├── apps/\n│   ├── web/         # Next.js web application\n│   └── desktop/     # Desktop application\n│\n└── packages/\n    ├── ai/          # AI models and workflow orchestration\n    ├── actions/     # Shared actions and API handlers\n    ├── common/      # Common utilities and hooks\n    ├── orchestrator/# Workflow engine and task management\n    ├── prisma/      # Database schema and client\n    ├── shared/      # Shared types and constants\n    ├── ui/          # Reusable UI components\n    ├── tailwind-config/ # Shared Tailwind configuration\n    └── typescript-config/ # Shared TypeScript configuration\n```\n\n## Workflow Orchestration\n\nLLMChat.co's workflow orchestration enables powerful agentic capabilities through a modular, step-by-step approach. Here's how to create a research agent:\n\n### 1. Define Event and Context Types\n\nFirst, establish the data structure for events and context:\n\n```typescript\n// Define the events emitted by each task\ntype AgentEvents = {\n    taskPlanner: {\n        tasks: string[];\n        query: string;\n    };\n    informationGatherer: {\n        searchResults: string[];\n    };\n    informationAnalyzer: {\n        analysis: string;\n        insights: string[];\n    };\n    reportGenerator: {\n        report: string;\n    };\n};\n\n// Define the shared context between tasks\ntype AgentContext = {\n    query: string;\n    tasks: string[];\n    searchResults: string[];\n    analysis: string;\n    insights: string[];\n    report: string;\n};\n```\n\n### 2. Initialize Core Components\n\nNext, set up the event emitter, context, and workflow builder:\n\n```typescript\nimport { OpenAI } from 'openai';\nimport { createTask } from 'task';\nimport { WorkflowBuilder } from './builder';\nimport { Context } from './context';\nimport { TypedEventEmitter } from './events';\n\n// Initialize event emitter with proper typing\nconst events = new TypedEventEmitter\u003cAgentEvents\u003e();\n\n// Create the workflow builder with proper context\nconst builder = new WorkflowBuilder\u003cAgentEvents, AgentContext\u003e('research-agent', {\n    events,\n    context: new Context\u003cAgentContext\u003e({\n        query: '',\n        tasks: [],\n        searchResults: [],\n        analysis: '',\n        insights: [],\n        report: '',\n    }),\n});\n\n// Initialize LLM client\nconst llm = new OpenAI({\n    apiKey: process.env.OPENAI_API_KEY,\n});\n```\n\n### 3. Define Research Tasks\n\nCreate specialized tasks for each step of the research process:\n\n#### Planning Task\n\n```typescript\n// Task Planner: Breaks down a research query into specific tasks\nconst taskPlanner = createTask({\n    name: 'taskPlanner',\n    execute: async ({ context, data }) =\u003e {\n        const userQuery = data?.query || 'Research the impact of AI on healthcare';\n\n        const planResponse = await llm.chat.completions.create({\n            model: 'gpt-4o',\n            messages: [\n                {\n                    role: 'system',\n                    content:\n                        'You are a task planning assistant that breaks down research queries into specific search tasks.',\n                },\n                {\n                    role: 'user',\n                    content: `Break down this research query into specific search tasks: \"${userQuery}\". Return a JSON array of tasks.`,\n                },\n            ],\n            response_format: { type: 'json_object' },\n        });\n\n        const content = planResponse.choices[0].message.content || '{\"tasks\": []}';\n        const parsedContent = JSON.parse(content);\n        const tasks = parsedContent.tasks || [];\n\n        context?.set('query', userQuery);\n        context?.set('tasks', tasks);\n\n        return {\n            tasks,\n            query: userQuery,\n        };\n    },\n    route: () =\u003e 'informationGatherer',\n});\n```\n\n#### Information Gathering Task\n\n```typescript\n// Information Gatherer: Searches for information based on tasks\nconst informationGatherer = createTask({\n    name: 'informationGatherer',\n    dependencies: ['taskPlanner'],\n    execute: async ({ context, data }) =\u003e {\n        const tasks = data.taskPlanner.tasks;\n        const searchResults: string[] = [];\n\n        // Process each task to gather information\n        for (const task of tasks) {\n            const searchResponse = await llm.chat.completions.create({\n                model: 'gpt-4o',\n                messages: [\n                    {\n                        role: 'system',\n                        content: 'You are a search engine that returns factual information.',\n                    },\n                    {\n                        role: 'user',\n                        content: `Search for information about: ${task}. Return relevant facts and data.`,\n                    },\n                ],\n            });\n\n            const result = searchResponse.choices[0].message.content || '';\n            if (result) {\n                searchResults.push(result);\n            }\n        }\n\n        context?.set('searchResults', searchResults);\n\n        return {\n            searchResults,\n        };\n    },\n    route: () =\u003e 'informationAnalyzer',\n});\n```\n\n#### Analysis Task\n\n```typescript\n// Information Analyzer: Analyzes gathered information for insights\nconst informationAnalyzer = createTask({\n    name: 'informationAnalyzer',\n    dependencies: ['informationGatherer'],\n    execute: async ({ context, data }) =\u003e {\n        const searchResults = data.informationGatherer.searchResults;\n        const query = context?.get('query') || '';\n\n        const analysisResponse = await llm.chat.completions.create({\n            model: 'gpt-4o',\n            messages: [\n                {\n                    role: 'system',\n                    content:\n                        'You are an analytical assistant that identifies patterns and extracts insights from information.',\n                },\n                {\n                    role: 'user',\n                    content: `Analyze the following information regarding \"${query}\" and provide a coherent analysis with key insights:\\n\\n${searchResults.join('\\n\\n')}`,\n                },\n            ],\n            response_format: { type: 'json_object' },\n        });\n\n        const content =\n            analysisResponse.choices[0].message.content || '{\"analysis\": \"\", \"insights\": []}';\n        const parsedContent = JSON.parse(content);\n        const analysis = parsedContent.analysis || '';\n        const insights = parsedContent.insights || [];\n\n        context?.set('analysis', analysis);\n        context?.set('insights', insights);\n\n        return {\n            analysis,\n            insights,\n        };\n    },\n    route: () =\u003e 'reportGenerator',\n});\n```\n\n#### Report Generation Task\n\n```typescript\n// Report Generator: Creates a comprehensive report\nconst reportGenerator = createTask({\n    name: 'reportGenerator',\n    dependencies: ['informationAnalyzer'],\n    execute: async ({ context, data }) =\u003e {\n        const { analysis, insights } = data.informationAnalyzer;\n        const { query, searchResults } = context?.getAll() || { query: '', searchResults: [] };\n\n        const reportResponse = await llm.chat.completions.create({\n            model: 'gpt-4o',\n            messages: [\n                {\n                    role: 'system',\n                    content:\n                        'You are a report writing assistant that creates comprehensive, well-structured reports.',\n                },\n                {\n                    role: 'user',\n                    content: `Create a comprehensive report on \"${query}\" using the following analysis and insights.\\n\\nAnalysis: ${analysis}\\n\\nInsights: ${insights.join('\\n- ')}\\n\\nStructure the report with an executive summary, key findings, detailed analysis, and conclusions.`,\n                },\n            ],\n        });\n\n        const report = reportResponse.choices[0].message.content || '';\n\n        context?.set('report', report);\n\n        return {\n            report,\n        };\n    },\n    route: () =\u003e 'end',\n});\n```\n\n### 4. Build and Execute the Workflow\n\nFinally, assemble and run the workflow:\n\n```typescript\n// Add all tasks to the workflow\nbuilder.addTask(taskPlanner);\nbuilder.addTask(informationGatherer);\nbuilder.addTask(informationAnalyzer);\nbuilder.addTask(reportGenerator);\n\n// Build the workflow\nconst workflow = builder.build();\n\n// Start the workflow with an initial query\nworkflow.start('taskPlanner', { query: 'Research the impact of AI on healthcare' });\n\n// Export the workflow for external use\nexport const researchAgent = workflow;\n```\n\nThe workflow processes through these stages:\n\n1. **Planning**: Breaks down complex questions into specific research tasks\n2. **Information Gathering**: Collects relevant data for each task\n3. **Analysis**: Synthesizes information and identifies key insights\n4. **Report Generation**: Produces a comprehensive, structured response\n\nEach step emits events that can update the UI in real-time, allowing users to see the research process unfold.\n\n## Local Storage\nLLMChat.co prioritizes user privacy by storing all data locally\n\n## Tech Stack\n\n### Frontend\n\n- **Next.js 14**: React framework with server components\n- **TypeScript**: Type-safe development\n- **Tailwind CSS**: Utility-first styling\n- **Framer Motion**: Smooth animations\n- **Shadcn UI**: Component library\n- **Tiptap**: Rich text editor\n- **Zustand**: State management\n- **Dexie.js**: Used for IndexedDB interaction with a simple and powerful API\n- **AI SDK**: Unified interface for multiple AI providers\n\n### Development\n\n- **Turborepo**: Monorepo management\n- **Bun**: JavaScript runtime and package manager\n- **ESLint \u0026 Prettier**: Code quality tools\n- **Husky**: Git hooks\n\n## Getting Started\n\n### Prerequisites\n\n- Ensure you have `bun` installed (recommended) or `yarn`\n\n### Installation\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/your-repo/llmchat.git\ncd llmchat\n```\n\n2. Install dependencies:\n\n```bash\nbun install\n# or\nyarn install\n```\n\n3. Start the development server:\n\n```bash\nbun dev\n# or\nyarn dev\n```\n\n4. Open your browser and navigate to `http://localhost:3000`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrendy-design%2Fllmchat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrendy-design%2Fllmchat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrendy-design%2Fllmchat/lists"}