├── ai ├── __init__.py ├── llm │ ├── factory.py │ └── openai_chat.py ├── settings.py └── vectordb.py ├── workspace ├── __init__.py ├── .gitignore ├── example_secrets │ ├── prd_app_secrets.yml │ ├── prd_db_secrets.yml │ └── dev_app_secrets.yml ├── settings.py └── dev_resources.py ├── __init__.py ├── app ├── styles │ ├── __init__.py │ └── css.py ├── api │ ├── __init__.py │ ├── routes │ │ ├── endpoints.py │ │ ├── v1_router.py │ │ ├── __init__.py │ │ ├── health.py │ │ ├── status.py │ │ └── tools.py │ ├── middleware │ │ └── error_handler.py │ ├── main.py │ ├── auth.py │ └── settings.py ├── db │ ├── __init__.py │ ├── factory.py │ ├── session.py │ ├── models.py │ ├── settings.py │ ├── config.py │ ├── memory.py │ ├── base.py │ ├── memory_storage.py │ ├── sqlite.py │ └── init.py ├── utils │ ├── __init__.py │ └── session.py ├── components │ ├── __init__.py │ ├── sidebar.py │ ├── tools.py │ ├── history.py │ ├── knowledge_base.py │ └── chat.py ├── config │ ├── __init__.py │ ├── ai_settings.py │ └── settings.py ├── __init__.py ├── assets │ └── images │ │ └── lyraios.png ├── main.py └── tools │ └── protocol │ └── adapters │ └── base.py ├── client ├── src │ ├── vite-env.d.ts │ ├── assets │ │ └── images │ │ │ ├── lyraios.png │ │ │ └── background.png │ ├── components │ │ ├── ui │ │ │ ├── aspect-ratio.tsx │ │ │ ├── skeleton.tsx │ │ │ ├── collapsible.tsx │ │ │ ├── label.tsx │ │ │ ├── textarea.tsx │ │ │ ├── separator.tsx │ │ │ ├── progress.tsx │ │ │ ├── input.tsx │ │ │ ├── toaster.tsx │ │ │ ├── sonner.tsx │ │ │ ├── slider.tsx │ │ │ ├── checkbox.tsx │ │ │ ├── tooltip.tsx │ │ │ ├── switch.tsx │ │ │ ├── badge.tsx │ │ │ ├── hover-card.tsx │ │ │ ├── popover.tsx │ │ │ ├── toggle.tsx │ │ │ ├── radio-group.tsx │ │ │ ├── avatar.tsx │ │ │ ├── scroll-area.tsx │ │ │ ├── alert.tsx │ │ │ ├── resizable.tsx │ │ │ ├── toggle-group.tsx │ │ │ ├── button.tsx │ │ │ ├── tabs.tsx │ │ │ ├── card.tsx │ │ │ ├── accordion.tsx │ │ │ ├── input-otp.tsx │ │ │ ├── calendar.tsx │ │ │ ├── breadcrumb.tsx │ │ │ ├── pagination.tsx │ │ │ ├── table.tsx │ │ │ ├── drawer.tsx │ │ │ └── dialog.tsx │ │ ├── ChatMessage.tsx │ │ └── AppIcon.tsx │ ├── main.tsx │ ├── types.ts │ ├── config │ │ └── apps.ts │ ├── services │ │ ├── llmService.ts │ │ └── appService.ts │ ├── App.tsx │ ├── lib │ │ └── utils.ts │ ├── index.css │ └── hooks │ │ └── use-toast.ts ├── tsconfig.node.json ├── .gitignore ├── components.json ├── index.html ├── tsconfig.app.json ├── tsconfig.json └── package.json ├── docs ├── lyraios-architecture.jpg └── manus-architecture.png ├── mcp_solana ├── models │ └── __init__.py ├── utils │ └── __init__.py ├── __init__.py ├── client │ └── __init__.py ├── server │ └── __init__.py ├── setup.py ├── examples │ ├── server_example.py │ └── client_example.py └── README.md ├── example.env ├── scripts ├── auth_ecr.sh ├── build_dev_image.sh ├── build_prd_image.sh ├── _utils.sh ├── format.sh ├── validate.sh ├── init_db.py ├── create_venv.sh ├── install.sh ├── dev.py ├── check_db.py ├── upgrade.sh └── entrypoint.sh ├── setup.py ├── .editorconfig ├── CONTRIBUTING.md ├── run_api.py ├── .dockerignore ├── run.py ├── streamlit_app.py ├── Dockerfile ├── .gitignore ├── pyproject.toml ├── examples ├── register_calculator.py ├── test_calculator.py └── tools │ └── calculator.py ├── test ├── test_storage.py └── test_sqlite_adapter.py └── requirements.txt /ai/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /workspace/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /__init__.py: -------------------------------------------------------------------------------- 1 | # Empty file to mark directory as Python package -------------------------------------------------------------------------------- /app/styles/__init__.py: -------------------------------------------------------------------------------- 1 | """Styles package for LYRAIOS application""" -------------------------------------------------------------------------------- /client/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /app/api/__init__.py: -------------------------------------------------------------------------------- 1 | # Empty file to mark directory as Python package 2 | -------------------------------------------------------------------------------- /app/db/__init__.py: -------------------------------------------------------------------------------- 1 | """Database package for LYRAIOS application""" 2 | -------------------------------------------------------------------------------- /app/utils/__init__.py: -------------------------------------------------------------------------------- 1 | """Utilities package for LYRAIOS application""" -------------------------------------------------------------------------------- /app/components/__init__.py: -------------------------------------------------------------------------------- 1 | """UI components package for LYRAIOS application""" -------------------------------------------------------------------------------- /app/config/__init__.py: -------------------------------------------------------------------------------- 1 | """Configuration package for LYRAIOS application""" -------------------------------------------------------------------------------- /app/__init__.py: -------------------------------------------------------------------------------- 1 | """LYRAIOS application package""" 2 | 3 | # from app.main import main 4 | 5 | __all__ = [] 6 | -------------------------------------------------------------------------------- /app/assets/images/lyraios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GalaxyLLMCI/lyraios/HEAD/app/assets/images/lyraios.png -------------------------------------------------------------------------------- /docs/lyraios-architecture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GalaxyLLMCI/lyraios/HEAD/docs/lyraios-architecture.jpg -------------------------------------------------------------------------------- /docs/manus-architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GalaxyLLMCI/lyraios/HEAD/docs/manus-architecture.png -------------------------------------------------------------------------------- /client/src/assets/images/lyraios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GalaxyLLMCI/lyraios/HEAD/client/src/assets/images/lyraios.png -------------------------------------------------------------------------------- /workspace/.gitignore: -------------------------------------------------------------------------------- 1 | # ignore inputs 2 | inputs 3 | 4 | # ignore outputs 5 | output 6 | 7 | # ignore secrets 8 | secrets 9 | -------------------------------------------------------------------------------- /client/src/assets/images/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GalaxyLLMCI/lyraios/HEAD/client/src/assets/images/background.png -------------------------------------------------------------------------------- /workspace/example_secrets/prd_app_secrets.yml: -------------------------------------------------------------------------------- 1 | APP_PASSWORD: "admin" 2 | # OPENAI_API_KEY: "***" 3 | # EXA_API_KEY: "***" 4 | 5 | -------------------------------------------------------------------------------- /mcp_solana/models/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | MCP Solana Models Module 3 | 4 | This module contains data models for the MCP Solana integration. 5 | """ -------------------------------------------------------------------------------- /workspace/example_secrets/prd_db_secrets.yml: -------------------------------------------------------------------------------- 1 | # Secrets used by prd RDS database 2 | MASTER_USERNAME: ai 3 | MASTER_USER_PASSWORD: "ai9999!!" 4 | -------------------------------------------------------------------------------- /mcp_solana/utils/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | MCP Solana Utilities Module 3 | 4 | This module contains utility functions for the MCP Solana integration. 5 | """ -------------------------------------------------------------------------------- /workspace/example_secrets/dev_app_secrets.yml: -------------------------------------------------------------------------------- 1 | SECRET_KEY: "very_secret" 2 | # APP_PASSWORD: "admin" 3 | # OPENAI_API_KEY: "***" 4 | # EXA_API_KEY: "***" 5 | -------------------------------------------------------------------------------- /client/src/components/ui/aspect-ratio.tsx: -------------------------------------------------------------------------------- 1 | import * as AspectRatioPrimitive from '@radix-ui/react-aspect-ratio'; 2 | 3 | const AspectRatio = AspectRatioPrimitive.Root; 4 | 5 | export { AspectRatio }; 6 | -------------------------------------------------------------------------------- /mcp_solana/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | MCP Solana Integration Package 3 | 4 | This package provides MCP (Model Context Protocol) integration for Solana blockchain operations. 5 | """ 6 | 7 | __version__ = "0.1.0" -------------------------------------------------------------------------------- /example.env: -------------------------------------------------------------------------------- 1 | # OPENAI_API_KEY="sk-xxx" 2 | # EXA_API_KEY="xxx" 3 | # PHI_API_KEY="phi-xxx" 4 | # IMAGE_REPO=repo 5 | # BUILD_IMAGES=True 6 | # PUSH_IMAGES=True 7 | # AWS_PROFILE=ai-demos 8 | # OPENAI_API_KEY=sk-*** 9 | -------------------------------------------------------------------------------- /scripts/auth_ecr.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # Authenticate with ecr 6 | aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin [AWS_ACCOUNT].dkr.ecr.us-east-1.amazonaws.com 7 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # A minimal setup.py file for supporting editable installs 2 | 3 | from setuptools import setup, find_packages 4 | 5 | setup( 6 | name="llm-os", 7 | packages=find_packages(), 8 | version="0.1.0", 9 | ) 10 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_size = 2 5 | indent_style = space 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.py] 12 | indent_size = 4 13 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | We welcome contributions! Please see the [README.md](README.md) file for details. 4 | 5 | ## License 6 | 7 | This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details. -------------------------------------------------------------------------------- /app/api/routes/endpoints.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | 3 | 4 | @dataclass 5 | class ApiEndpoints: 6 | PING: str = "/ping" 7 | HEALTH: str = "/health" 8 | ASSISTANTS: str = "/assistants" 9 | 10 | 11 | endpoints = ApiEndpoints() 12 | -------------------------------------------------------------------------------- /client/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "skipLibCheck": true, 5 | "module": "ESNext", 6 | "moduleResolution": "bundler", 7 | "allowSyntheticDefaultImports": true 8 | }, 9 | "include": [ 10 | "vite.config.ts" 11 | ] 12 | } -------------------------------------------------------------------------------- /client/src/main.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import App from './App'; 4 | import './index.css'; 5 | 6 | ReactDOM.createRoot(document.getElementById('root')!).render( 7 | 8 | 9 | 10 | ); 11 | -------------------------------------------------------------------------------- /app/api/routes/v1_router.py: -------------------------------------------------------------------------------- 1 | from fastapi import APIRouter 2 | 3 | from app.api.routes.status import status_router 4 | from app.api.routes.assistants import assistants_router 5 | 6 | v1_router = APIRouter(prefix="/v1") 7 | v1_router.include_router(status_router) 8 | v1_router.include_router(assistants_router) 9 | -------------------------------------------------------------------------------- /run_api.py: -------------------------------------------------------------------------------- 1 | import uvicorn 2 | import os 3 | import sys 4 | 5 | # Add project root directory to Python path 6 | sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) 7 | 8 | if __name__ == "__main__": 9 | # Update API application path 10 | uvicorn.run("app.api.main:app", host="0.0.0.0", port=8000, reload=True) -------------------------------------------------------------------------------- /client/src/types.ts: -------------------------------------------------------------------------------- 1 | export interface AppConfig { 2 | id: string; 3 | name: string; 4 | icon: string; 5 | color: string; 6 | description?: string; 7 | chatTitle?: string; 8 | } 9 | 10 | export interface Message { 11 | id: string; 12 | content: string; 13 | sender: 'user' | 'app'; 14 | timestamp: Date; 15 | } -------------------------------------------------------------------------------- /mcp_solana/client/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | MCP Solana Client Package 3 | 4 | This package provides client implementations for the MCP Solana integration. 5 | """ 6 | 7 | from .client import SolanaMCPClient 8 | from .contract_client import SolanaContractClient 9 | 10 | __all__ = [ 11 | "SolanaMCPClient", 12 | "SolanaContractClient", 13 | ] -------------------------------------------------------------------------------- /client/src/components/ui/skeleton.tsx: -------------------------------------------------------------------------------- 1 | import { cn } from '@/lib/utils'; 2 | 3 | function Skeleton({ 4 | className, 5 | ...props 6 | }: React.HTMLAttributes) { 7 | return ( 8 |
12 | ); 13 | } 14 | 15 | export { Skeleton }; 16 | -------------------------------------------------------------------------------- /ai/llm/factory.py: -------------------------------------------------------------------------------- 1 | from ai.llm.openai_chat import CustomOpenAIChat 2 | from ai.settings import ai_settings 3 | 4 | def create_llm() -> CustomOpenAIChat: 5 | """Create and configure the LLM instance""" 6 | return CustomOpenAIChat( 7 | model=ai_settings.openai_chat_model, 8 | api_key=ai_settings.openai_api_key, 9 | base_url=ai_settings.openai_base_url 10 | ) -------------------------------------------------------------------------------- /client/src/components/ui/collapsible.tsx: -------------------------------------------------------------------------------- 1 | import * as CollapsiblePrimitive from '@radix-ui/react-collapsible'; 2 | 3 | const Collapsible = CollapsiblePrimitive.Root; 4 | 5 | const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger; 6 | 7 | const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent; 8 | 9 | export { Collapsible, CollapsibleTrigger, CollapsibleContent }; 10 | -------------------------------------------------------------------------------- /app/main.py: -------------------------------------------------------------------------------- 1 | """ 2 | Main entry point for the LYRAIOS API server. 3 | """ 4 | 5 | import uvicorn 6 | 7 | from app.api.main import app 8 | 9 | 10 | def main(): 11 | """Run the API server.""" 12 | uvicorn.run( 13 | "app.api.main:app", 14 | host="0.0.0.0", 15 | port=8000, 16 | reload=True 17 | ) 18 | 19 | 20 | if __name__ == "__main__": 21 | main() -------------------------------------------------------------------------------- /mcp_solana/server/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | MCP Solana Server Package 3 | 4 | This package provides server implementations for the MCP Solana integration. 5 | """ 6 | 7 | from .server import SolanaMCPServer, run_server, main 8 | from .contract_server import SolanaContractServer 9 | 10 | __all__ = [ 11 | "SolanaMCPServer", 12 | "SolanaContractServer", 13 | "run_server", 14 | "main", 15 | ] -------------------------------------------------------------------------------- /app/db/factory.py: -------------------------------------------------------------------------------- 1 | """Database factory for LYRAIOS application""" 2 | 3 | from typing import Optional 4 | from app.db.storage import AssistantStorage 5 | 6 | def get_storage() -> Optional[AssistantStorage]: 7 | """Get storage implementation""" 8 | try: 9 | return AssistantStorage() 10 | except Exception as e: 11 | print(f"Error creating storage: {e}") 12 | return None -------------------------------------------------------------------------------- /app/config/ai_settings.py: -------------------------------------------------------------------------------- 1 | """AI model settings for LYRAIOS application""" 2 | 3 | class ModelSettings: 4 | """Model settings class""" 5 | 6 | def __init__(self): 7 | self.openai_chat_model = "gpt-4o" 8 | 9 | def get_default_model(self): 10 | """Get default model name""" 11 | return self.openai_chat_model 12 | 13 | # Create singleton instance 14 | model_settings = ModelSettings() -------------------------------------------------------------------------------- /client/.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 | 26 | # Environment variables 27 | .env 28 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | docs 4 | .git 5 | config.json 6 | Pipfile 7 | Pipfile.lock 8 | 9 | # Cache 10 | .mypy_cache 11 | .ruff_cache 12 | .pytest_cache 13 | *__pycache__* 14 | *.egg-info 15 | *.pyc 16 | 17 | # Machine specific 18 | .idea 19 | .vscode 20 | 21 | # Ignore .env files 22 | .env 23 | .envrc 24 | 25 | # ignore virtualenvs 26 | .venv 27 | venv* 28 | aienv* 29 | apienv* 30 | appenv* 31 | llmenv* 32 | 33 | .ipynb_checkpoints 34 | -------------------------------------------------------------------------------- /run.py: -------------------------------------------------------------------------------- 1 | """LYRAIOS application launcher""" 2 | 3 | import sys 4 | import os 5 | 6 | # Add current directory to Python path 7 | sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) 8 | 9 | # Import and run main application 10 | from app.main import main 11 | 12 | if __name__ == "__main__": 13 | # Use streamlit to run application 14 | import streamlit.web.bootstrap as bootstrap 15 | 16 | bootstrap.run("app/main.py", "", [], []) -------------------------------------------------------------------------------- /app/api/routes/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | API routes for the LYRAIOS system. 3 | """ 4 | 5 | from fastapi import APIRouter 6 | 7 | from app.api.routes.tools import router as tools_router 8 | from app.api.routes.health import router as health_router 9 | 10 | # Create main router 11 | router = APIRouter() 12 | 13 | # Include sub-routers 14 | router.include_router(tools_router, prefix="/tools", tags=["tools"]) 15 | router.include_router(health_router, prefix="/health", tags=["health"]) 16 | -------------------------------------------------------------------------------- /client/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": "tailwind.config.js", 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 | } 21 | -------------------------------------------------------------------------------- /scripts/build_dev_image.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | CURR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 6 | WS_ROOT="$(dirname ${CURR_DIR})" 7 | DOCKERFILE="Dockerfile" 8 | REPO="repo" 9 | NAME="lyraios" 10 | TAG="dev" 11 | 12 | # Run docker buildx create --use before running this script 13 | echo "Running: docker buildx build --platform=linux/amd64,linux/arm64 -t $REPO/$NAME:$TAG -f $DOCKERFILE $WS_ROOT --push" 14 | docker buildx build --platform=linux/amd64,linux/arm64 -t $REPO/$NAME:$TAG -f $DOCKERFILE $WS_ROOT --push 15 | -------------------------------------------------------------------------------- /scripts/build_prd_image.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | CURR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 6 | WS_ROOT="$(dirname ${CURR_DIR})" 7 | DOCKERFILE="Dockerfile" 8 | REPO="repo" 9 | NAME="lyraios" 10 | TAG="prd" 11 | 12 | # Run docker buildx create --use before running this script 13 | echo "Running: docker buildx build --platform=linux/amd64,linux/arm64 -t $REPO/$NAME:$TAG -f $DOCKERFILE $WS_ROOT --push" 14 | docker buildx build --platform=linux/amd64,linux/arm64 -t $REPO/$NAME:$TAG -f $DOCKERFILE $WS_ROOT --push 15 | -------------------------------------------------------------------------------- /scripts/_utils.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ############################################################################ 4 | # 5 | # Helper functions to import in other scripts 6 | # 7 | ############################################################################ 8 | 9 | print_horizontal_line() { 10 | echo "------------------------------------------------------------" 11 | } 12 | 13 | print_heading() { 14 | print_horizontal_line 15 | echo "-*- $1" 16 | print_horizontal_line 17 | } 18 | 19 | print_status() { 20 | echo "-*- $1" 21 | } 22 | -------------------------------------------------------------------------------- /client/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | lyraios 9 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /scripts/format.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ############################################################################ 4 | # 5 | # Run this script to format using ruff 6 | # Usage: 7 | # ./scripts/format.sh 8 | ############################################################################ 9 | 10 | CURR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 11 | REPO_ROOT="$(dirname $CURR_DIR)" 12 | source ${CURR_DIR}/_utils.sh 13 | 14 | main() { 15 | print_heading "Formatting workspace..." 16 | print_heading "Running: ruff format ${REPO_ROOT}" 17 | ruff format ${REPO_ROOT} 18 | } 19 | 20 | main "$@" 21 | -------------------------------------------------------------------------------- /app/api/middleware/error_handler.py: -------------------------------------------------------------------------------- 1 | from fastapi import Request, status 2 | from fastapi.responses import JSONResponse 3 | 4 | class ErrorHandler: 5 | async def __call__(self, request: Request, call_next): 6 | try: 7 | return await call_next(request) 8 | except Exception as e: 9 | # Log the error here 10 | return JSONResponse( 11 | status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, 12 | content={ 13 | "error": str(e), 14 | "status": "error" 15 | } 16 | ) -------------------------------------------------------------------------------- /app/api/routes/health.py: -------------------------------------------------------------------------------- 1 | """ 2 | Health check API routes. 3 | """ 4 | 5 | from fastapi import APIRouter 6 | from pydantic import BaseModel 7 | 8 | router = APIRouter() 9 | 10 | 11 | class HealthResponse(BaseModel): 12 | """Health check response model.""" 13 | 14 | status: str 15 | version: str 16 | 17 | 18 | @router.get("/", response_model=HealthResponse) 19 | async def health_check(): 20 | """ 21 | Health check endpoint. 22 | 23 | Returns: 24 | Health status 25 | """ 26 | return HealthResponse( 27 | status="ok", 28 | version="0.1.0" 29 | ) -------------------------------------------------------------------------------- /streamlit_app.py: -------------------------------------------------------------------------------- 1 | """LYRAIOS Streamlit application entry point""" 2 | 3 | import os 4 | import sys 5 | import streamlit as st 6 | from phi.tools.streamlit.components import check_password 7 | 8 | # Add project root directory to Python path 9 | sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) 10 | 11 | # Set page configuration 12 | st.set_page_config( 13 | page_title="LYRAIOS AI Assistant", 14 | page_icon="🧠", 15 | layout="wide", 16 | initial_sidebar_state="expanded" 17 | ) 18 | 19 | # Import main application 20 | from app.main import main 21 | 22 | # Check password and start main program 23 | if check_password(): 24 | main() 25 | -------------------------------------------------------------------------------- /client/src/config/apps.ts: -------------------------------------------------------------------------------- 1 | import { AppConfig } from '../types'; 2 | import { fetchApps } from '../services/appService'; 3 | 4 | // Empty initial array 5 | export const appConfigs: AppConfig[] = []; 6 | 7 | // Function to load apps 8 | export async function loadApps(): Promise { 9 | try { 10 | const apps = await fetchApps(); 11 | 12 | // Update the appConfigs array with fetched data 13 | appConfigs.length = 0; // Clear the array 14 | appConfigs.push(...apps); // Add all fetched apps 15 | 16 | return apps; 17 | } catch (error) { 18 | console.error('Failed to load apps:', error); 19 | return []; 20 | } 21 | } -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.11.5 2 | 3 | ARG USER=app 4 | ARG APP_DIR=${USER_LOCAL_DIR}/${USER} 5 | ENV APP_DIR=${APP_DIR} 6 | # Add APP_DIR to PYTHONPATH 7 | ENV PYTHONPATH="${APP_DIR}:${PYTHONPATH}" 8 | 9 | # Create user and home directory 10 | RUN groupadd -g 61000 ${USER} \ 11 | && useradd -g 61000 -u 61000 -ms /bin/bash -d ${APP_DIR} ${USER} 12 | 13 | WORKDIR ${APP_DIR} 14 | 15 | # Update pip 16 | RUN pip install --upgrade pip 17 | # Copy pinned requirements 18 | COPY requirements.txt . 19 | # Install pinned requirements 20 | RUN pip install -r requirements.txt 21 | 22 | # Copy project files 23 | COPY . . 24 | 25 | COPY scripts /scripts 26 | ENTRYPOINT ["/scripts/entrypoint.sh"] 27 | CMD ["chill"] 28 | -------------------------------------------------------------------------------- /app/api/routes/status.py: -------------------------------------------------------------------------------- 1 | from fastapi import APIRouter 2 | 3 | from app.api.routes.endpoints import endpoints 4 | 5 | ###################################################### 6 | ## Router for health checks 7 | ###################################################### 8 | 9 | status_router = APIRouter(tags=["Status"]) 10 | 11 | 12 | @status_router.get(endpoints.PING) 13 | def status_ping(): 14 | """Ping the Api""" 15 | 16 | return {"ping": "pong"} 17 | 18 | 19 | @status_router.get(endpoints.HEALTH) 20 | def status_health(): 21 | """Check the health of the Api""" 22 | 23 | return { 24 | "status": "success", 25 | "router": "status", 26 | "path": endpoints.HEALTH, 27 | } 28 | -------------------------------------------------------------------------------- /scripts/validate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ############################################################################ 4 | # 5 | # Run this script to validate the workspace: 6 | # 1. Type check using mypy 7 | # 2. Lint using ruff 8 | # Usage: 9 | # ./scripts/validate.sh 10 | ############################################################################ 11 | 12 | CURR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 13 | REPO_ROOT="$(dirname $CURR_DIR)" 14 | source ${CURR_DIR}/_utils.sh 15 | 16 | main() { 17 | print_heading "Validating workspace..." 18 | print_heading "Running: ruff check ${REPO_ROOT}" 19 | ruff check ${REPO_ROOT} 20 | print_heading "Running: mypy ${REPO_ROOT}" 21 | mypy ${REPO_ROOT} 22 | } 23 | 24 | main "$@" 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | .DS_Store 4 | 5 | # Python cache 6 | .mypy_cache 7 | *__pycache__* 8 | *.egg-info 9 | *.pyc 10 | *.pytest_cache 11 | *.ruff_cache 12 | *.cache* 13 | *.config* 14 | 15 | # Machine specific 16 | .idea 17 | .vscode 18 | .cursor 19 | 20 | # Ignore .env files 21 | .env 22 | .envrc 23 | 24 | # ignore storage dir 25 | storage 26 | 27 | # ignore scratch dir 28 | scratch 29 | 30 | # ignore .local dir 31 | .local 32 | 33 | # ignore dist dir 34 | dist 35 | 36 | # ignore virtualenvs 37 | .venv 38 | venv* 39 | aienv* 40 | apienv* 41 | appenv* 42 | llmenv* 43 | 44 | # ignore jupyter checkpoints 45 | .ipynb_checkpoints 46 | .Trash* 47 | 48 | # Data files 49 | data/ 50 | *.db 51 | -------------------------------------------------------------------------------- /scripts/init_db.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import logging 4 | from pathlib import Path 5 | from db.init import init_database 6 | 7 | logging.basicConfig(level=logging.INFO) 8 | logger = logging.getLogger(__name__) 9 | 10 | def main(): 11 | """Initialize database""" 12 | try: 13 | # Ensure data directory exists 14 | data_dir = Path.cwd() / "data" 15 | os.makedirs(data_dir, exist_ok=True) 16 | 17 | # Initialize database 18 | init_database() 19 | logger.info("Database initialization completed successfully") 20 | 21 | except Exception as e: 22 | logger.error(f"Database initialization failed: {e}") 23 | raise 24 | 25 | if __name__ == "__main__": 26 | main() -------------------------------------------------------------------------------- /client/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2020", 4 | "useDefineForClassFields": true, 5 | "lib": ["ES2020", "DOM", "DOM.Iterable"], 6 | "module": "ESNext", 7 | "skipLibCheck": true, 8 | 9 | /* Bundler mode */ 10 | "moduleResolution": "bundler", 11 | "allowImportingTsExtensions": true, 12 | "isolatedModules": true, 13 | "moduleDetection": "force", 14 | "noEmit": true, 15 | "jsx": "react-jsx", 16 | 17 | /* Linting */ 18 | "strict": true, 19 | "noUnusedLocals": true, 20 | "noUnusedParameters": true, 21 | "noFallthroughCasesInSwitch": true, 22 | 23 | /* for ShadCN */ 24 | "baseUrl": ".", 25 | "paths": { 26 | "@/*": ["./src/*"] 27 | } 28 | }, 29 | "include": ["src"] 30 | } 31 | -------------------------------------------------------------------------------- /client/src/components/ui/label.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import * as LabelPrimitive from '@radix-ui/react-label'; 3 | import { cva, type VariantProps } from 'class-variance-authority'; 4 | 5 | import { cn } from '@/lib/utils'; 6 | 7 | const labelVariants = cva( 8 | 'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70' 9 | ); 10 | 11 | const Label = React.forwardRef< 12 | React.ElementRef, 13 | React.ComponentPropsWithoutRef & 14 | VariantProps 15 | >(({ className, ...props }, ref) => ( 16 | 21 | )); 22 | Label.displayName = LabelPrimitive.Root.displayName; 23 | 24 | export { Label }; 25 | -------------------------------------------------------------------------------- /app/db/session.py: -------------------------------------------------------------------------------- 1 | from sqlalchemy.engine import Engine, create_engine 2 | from sqlalchemy.orm import Session, sessionmaker 3 | 4 | from db.settings import db_settings 5 | 6 | # Create SQLAlchemy Engine using a database URL 7 | db_url = db_settings.get_db_url() 8 | db_engine: Engine = create_engine(db_url, pool_pre_ping=True) 9 | 10 | # Create a SessionLocal class 11 | # https://fastapi.tiangolo.com/tutorial/sql-databases/#create-a-sessionlocal-class 12 | SessionLocal: sessionmaker[Session] = sessionmaker(autocommit=False, autoflush=False, bind=db_engine) 13 | 14 | 15 | def get_db(): 16 | """ 17 | Dependency to get a database session. 18 | 19 | https://fastapi.tiangolo.com/tutorial/sql-databases/#create-a-dependency 20 | """ 21 | 22 | db = SessionLocal() 23 | try: 24 | yield db 25 | finally: 26 | db.close() 27 | -------------------------------------------------------------------------------- /client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2020", 4 | "useDefineForClassFields": true, 5 | "lib": [ 6 | "ES2020", 7 | "DOM", 8 | "DOM.Iterable" 9 | ], 10 | "module": "ESNext", 11 | "skipLibCheck": true, 12 | "moduleResolution": "bundler", 13 | "allowImportingTsExtensions": true, 14 | "resolveJsonModule": true, 15 | "isolatedModules": true, 16 | "noEmit": true, 17 | "jsx": "react-jsx", 18 | "strict": true, 19 | "noUnusedLocals": true, 20 | "noUnusedParameters": true, 21 | "noFallthroughCasesInSwitch": true, 22 | "baseUrl": ".", 23 | "paths": { 24 | "@/*": [ 25 | "src/*" 26 | ] 27 | } 28 | }, 29 | "include": [ 30 | "src" 31 | ], 32 | "references": [ 33 | { 34 | "path": "./tsconfig.node.json" 35 | } 36 | ] 37 | } -------------------------------------------------------------------------------- /client/src/components/ui/textarea.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | import { cn } from '@/lib/utils'; 4 | 5 | export interface TextareaProps 6 | extends React.TextareaHTMLAttributes {} 7 | 8 | const Textarea = React.forwardRef( 9 | ({ className, ...props }, ref) => { 10 | return ( 11 |