├── Knowmore ├── __init__.py ├── handlers │ ├── __init__.py │ ├── message_processor.py │ └── stream_handler.py ├── services │ ├── __init__.py │ ├── ai_provider.py │ ├── openai_service.py │ ├── claude_service.py │ ├── web_search_firecrawl.py │ └── search_orchestrator.py ├── asgi.py ├── wsgi.py ├── urls.py ├── utils.py ├── sse.py ├── views.py └── settings.py ├── ui ├── src │ ├── vite-env.d.ts │ ├── lib │ │ └── utils.ts │ ├── chat │ │ ├── chat-header.tsx │ │ ├── chat-input.tsx │ │ ├── model-selector.tsx │ │ ├── chat-source.tsx │ │ └── chat-message.tsx │ ├── main.tsx │ ├── components │ │ ├── ui │ │ │ ├── textarea.tsx │ │ │ ├── scroll-button.tsx │ │ │ ├── avatar.tsx │ │ │ ├── chat-container.tsx │ │ │ ├── badge.tsx │ │ │ ├── scroll-area.tsx │ │ │ ├── tooltip.tsx │ │ │ ├── button.tsx │ │ │ ├── card.tsx │ │ │ ├── code-block.tsx │ │ │ ├── message.tsx │ │ │ ├── markdown.tsx │ │ │ ├── prompt-input.tsx │ │ │ ├── dropdown-menu.tsx │ │ │ └── loader.tsx │ │ └── chat-source-placeholder.tsx │ ├── App.tsx │ └── index.css ├── logo.png ├── dark-logo.png ├── tsconfig.json ├── .gitignore ├── components.json ├── index.html ├── eslint.config.js ├── tsconfig.node.json ├── vite.config.ts ├── tsconfig.app.json ├── public │ └── vite.svg ├── package.json └── README.md ├── demo-knowmore.png ├── static ├── favicon.ico ├── favicon-16x16.png ├── favicon-32x32.png ├── apple-touch-icon.png ├── android-chrome-192x192.png ├── android-chrome-512x512.png └── site.webmanifest ├── .gitignore ├── requirements.txt ├── Makefile ├── Dockerfile ├── run_asgi.py ├── manage.py ├── templates └── react_app.html ├── LICENSE └── README.md /Knowmore/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Knowmore/handlers/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Knowmore/services/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ui/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /ui/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadrosid/Knowmore/HEAD/ui/logo.png -------------------------------------------------------------------------------- /ui/dark-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadrosid/Knowmore/HEAD/ui/dark-logo.png -------------------------------------------------------------------------------- /demo-knowmore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadrosid/Knowmore/HEAD/demo-knowmore.png -------------------------------------------------------------------------------- /static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadrosid/Knowmore/HEAD/static/favicon.ico -------------------------------------------------------------------------------- /static/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadrosid/Knowmore/HEAD/static/favicon-16x16.png -------------------------------------------------------------------------------- /static/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadrosid/Knowmore/HEAD/static/favicon-32x32.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | static/CACHE/ 3 | static/dist/ 4 | .venv/ 5 | bun.lockb 6 | db.sqlite3 7 | .env 8 | -------------------------------------------------------------------------------- /static/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadrosid/Knowmore/HEAD/static/apple-touch-icon.png -------------------------------------------------------------------------------- /static/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadrosid/Knowmore/HEAD/static/android-chrome-192x192.png -------------------------------------------------------------------------------- /static/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahmadrosid/Knowmore/HEAD/static/android-chrome-512x512.png -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | anthropic 2 | openai 3 | Django==5.2.3 4 | daphne==4.2.0 5 | django-compressor==4.5.1 6 | django-environ 7 | requests 8 | -------------------------------------------------------------------------------- /ui/src/lib/utils.ts: -------------------------------------------------------------------------------- 1 | import { clsx, type ClassValue } from "clsx" 2 | import { twMerge } from "tailwind-merge" 3 | 4 | export function cn(...inputs: ClassValue[]) { 5 | return twMerge(clsx(inputs)) 6 | } 7 | -------------------------------------------------------------------------------- /static/site.webmanifest: -------------------------------------------------------------------------------- 1 | {"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} -------------------------------------------------------------------------------- /ui/src/chat/chat-header.tsx: -------------------------------------------------------------------------------- 1 | export function ChatHeader() { 2 | return ( 3 |
4 |

5 | Knowmore 6 |

7 |
8 | ) 9 | } -------------------------------------------------------------------------------- /ui/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": [], 3 | "references": [ 4 | { "path": "./tsconfig.app.json" }, 5 | { "path": "./tsconfig.node.json" } 6 | ], 7 | "compilerOptions": { 8 | "baseUrl": ".", 9 | "paths": { 10 | "@/*": ["./src/*"] 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: build 2 | 3 | build: ui backend 4 | 5 | dev: ui backend run-backend 6 | 7 | ui: 8 | ./build_ui.sh 9 | 10 | serve-ui: 11 | cd ui && bun run dev 12 | 13 | backend: 14 | docker build . -t knowmore 15 | 16 | run-backend: 17 | docker run --env-file .env -p 7000:8000 knowmore -------------------------------------------------------------------------------- /ui/src/main.tsx: -------------------------------------------------------------------------------- 1 | import { StrictMode } from 'react' 2 | import { createRoot } from 'react-dom/client' 3 | import './index.css' 4 | import '../dark-logo.png' 5 | import '../logo.png' 6 | import App from './App.tsx' 7 | 8 | createRoot(document.getElementById('root')!).render( 9 | 10 | 11 | , 12 | ) 13 | -------------------------------------------------------------------------------- /ui/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | -------------------------------------------------------------------------------- /Knowmore/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for Knowmore project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Knowmore.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /Knowmore/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for Knowmore project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Knowmore.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /ui/components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "new-york", 4 | "rsc": false, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "", 8 | "css": "src/index.css", 9 | "baseColor": "neutral", 10 | "cssVariables": true, 11 | "prefix": "" 12 | }, 13 | "aliases": { 14 | "components": "@/components", 15 | "utils": "@/lib/utils", 16 | "ui": "@/components/ui", 17 | "lib": "@/lib", 18 | "hooks": "@/hooks" 19 | }, 20 | "iconLibrary": "lucide" 21 | } -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.10-slim 2 | 3 | # Set environment variables 4 | ENV PYTHONDONTWRITEBYTECODE 1 5 | ENV PYTHONUNBUFFERED 1 6 | 7 | # Set work directory 8 | WORKDIR /app 9 | 10 | # Install dependencies 11 | COPY requirements.txt . 12 | RUN pip install --upgrade pip 13 | RUN pip install -r requirements.txt 14 | 15 | # Copy project 16 | COPY . . 17 | 18 | # Expose port 19 | EXPOSE 8000 20 | 21 | # Run the application with Daphne for proper streaming support 22 | CMD ["daphne", "-b", "0.0.0.0", "-p", "8000", "Knowmore.asgi:application"] -------------------------------------------------------------------------------- /ui/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Knowmore 10 | 11 | 12 |
13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /run_asgi.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """ 3 | Run the Django application with Daphne ASGI server for proper SSE streaming support. 4 | """ 5 | 6 | import os 7 | import sys 8 | 9 | if __name__ == "__main__": 10 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Knowmore.settings") 11 | 12 | # Run with Daphne 13 | from daphne.cli import CommandLineInterface 14 | 15 | # Run on port 8000 16 | sys.argv = ["daphne", "-b", "127.0.0.1", "-p", "8000", "Knowmore.asgi:application"] 17 | 18 | cli = CommandLineInterface() 19 | cli.run(sys.argv[1:]) -------------------------------------------------------------------------------- /Knowmore/urls.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from django.urls import path 3 | from django.conf import settings 4 | from django.conf.urls.static import static 5 | from .views import index, sse_stream, get_manifest, get_models 6 | 7 | urlpatterns = [ 8 | path('admin/', admin.site.urls), 9 | path('', index, name='react_app'), 10 | path('api/stream', sse_stream, name='sse_stream'), 11 | path('api/models', get_models, name='get_models'), 12 | path('manifest/', get_manifest, name='get_manifest'), 13 | ] 14 | 15 | if settings.DEBUG: 16 | urlpatterns += static(settings.STATIC_URL, document_root=settings.STATICFILES_DIRS[0]) 17 | -------------------------------------------------------------------------------- /ui/eslint.config.js: -------------------------------------------------------------------------------- 1 | import js from '@eslint/js' 2 | import globals from 'globals' 3 | import reactHooks from 'eslint-plugin-react-hooks' 4 | import reactRefresh from 'eslint-plugin-react-refresh' 5 | import tseslint from 'typescript-eslint' 6 | import { globalIgnores } from 'eslint/config' 7 | 8 | export default tseslint.config([ 9 | globalIgnores(['dist']), 10 | { 11 | files: ['**/*.{ts,tsx}'], 12 | extends: [ 13 | js.configs.recommended, 14 | tseslint.configs.recommended, 15 | reactHooks.configs['recommended-latest'], 16 | reactRefresh.configs.vite, 17 | ], 18 | languageOptions: { 19 | ecmaVersion: 2020, 20 | globals: globals.browser, 21 | }, 22 | }, 23 | ]) 24 | -------------------------------------------------------------------------------- /ui/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", 4 | "target": "ES2023", 5 | "lib": ["ES2023"], 6 | "module": "ESNext", 7 | "skipLibCheck": true, 8 | 9 | /* Bundler mode */ 10 | "moduleResolution": "bundler", 11 | "allowImportingTsExtensions": true, 12 | "verbatimModuleSyntax": true, 13 | "moduleDetection": "force", 14 | "noEmit": true, 15 | 16 | /* Linting */ 17 | "strict": true, 18 | "noUnusedLocals": true, 19 | "noUnusedParameters": true, 20 | "erasableSyntaxOnly": true, 21 | "noFallthroughCasesInSwitch": true, 22 | "noUncheckedSideEffectImports": true 23 | }, 24 | "include": ["vite.config.ts"] 25 | } 26 | -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Knowmore.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /ui/src/components/ui/textarea.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | import { cn } from "@/lib/utils" 4 | 5 | function Textarea({ className, ...props }: React.ComponentProps<"textarea">) { 6 | return ( 7 |