How nasa-petal/bidara-deep-chat works
Project Type and Purpose
• Type: Single‐page, front-end web application (no custom backend).
• Purpose: A Svelte-based UI that connects directly to OpenAI Assistants API (the “deep-chat” component) to deliver a bio-inspired design assistant.
File Structure
• public/
– index.html & global.css: static entry point served to the browser
• src/
– main.js: Svelte app bootstrap
– App.svelte & components/: UI layer
– assistant/: wrappers around assistant logic & function handlers
– utils/: local storage, IndexedDB, OpenAI helper utilities, logging
• python/: Development tool for translating an OpenAPI spec (ss-spec-v3.json) into JS function definitions
• rollup.config.js: build tool config
• package.json / package-lock.json: dependencies (deep-chat web component, Svelte, etc.)
README for Insights
• No custom backend; uses OpenAI Assistants API exclusively
• Integrates “deep-chat” web component for speech & function calling
• Leverages built-in Code Interpreter & Knowledge Retrieval tools
• Supports custom functions calling external APIs: Semantic Scholar, DALL-E, PQAI, Tavily
Main Components & Interactions
a. Browser / Client
– Svelte SPA (App.svelte + components)
– deep-chat web component (handles chat UI, speech-to/text, function call plumbing)
– Local storage layer: IndexedDB (via utils/indexDBUtils.js) for offline chat persistence
b. Build / Dev Tools (local)
– rollup (bundles JS/CSS into /public)
– python/openapi-to-functions.py: generates functions interface code before build
c. OpenAI Assistants API
– Chat completion endpoint with Functions support
– Code Interpreter & Knowledge Retrieval plugins (handled server-side by OpenAI)
d. External Services (invoked via Functions)
– Semantic Scholar API
– DALL-E image generation
– PQAI patent search
– Tavily web search
Architectural Patterns & Principles
• SPA layering: Presentation (Svelte components), Logic (assistant wrappers + utils), Data (IndexedDB)
• Function-call pattern: JSON-RPC style via Assistants API → local JS handlers
• Static hosting: GitHub Pages or any CDN for /public