diff --git a/.env.example b/.env.example index e5ee50e..28254b1 100644 --- a/.env.example +++ b/.env.example @@ -6,6 +6,21 @@ PORT=8787 HOST=127.0.0.1 OLLAMA_BASE_URL=http://127.0.0.1:11434 SMARTSHIT_MODEL=smartshit -NUM_CTX=4096 -NUM_PREDICT=256 +NUM_CTX=2048 +NUM_PREDICT=512 CORS_ORIGIN=* + +# Cloud AI providers (optional, recommended for production) +OPENROUTER_API_KEY= +OPENROUTER_MODEL=qwen/qwen3-32b +OPENROUTER_BASE_URL=https://openrouter.ai/api/v1 + +HUGGINGFACE_API_KEY= +HUGGINGFACE_MODEL=Qwen/Qwen3-32B +HUGGINGFACE_BASE_URL=https://router.huggingface.co/v1 + +GROQ_API_KEY= +GROQ_MODEL=llama-3.1-8b-instant + +# Priority order for provider failover +LLM_PROVIDER_ORDER=openrouter,huggingface,groq,ollama diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..edc55ce --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "snyk.advanced.autoSelectOrganization": true +} \ No newline at end of file diff --git a/README.md b/README.md index 7005f2a..d0537d1 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ **Talk to your spreadsheet. No formulas required.** +π **[smartsht.com](https://smartsht.com)** + [](LICENSE) [](https://www.typescriptlang.org/) [](https://react.dev/) @@ -46,7 +48,7 @@ Chat on the left, spreadsheet on the right. Describe budgets, expenses, or invoi |------|---------| | Node.js | 20+ | | Ollama | latest | -| RAM | 8 GB+ recommended for local AI | +| RAM | 4 GB+ recommended for local AI | ### 1. Clone and install @@ -59,7 +61,7 @@ npm install --prefix server ### 2. Add a local model (optional but recommended) -Download **Qwen3.5-4B** GGUF (~2.7 GB) into `models/` β see [models/README.md](models/README.md). +Download **Qwen2.5-Coder-1.5B** GGUF (~1.6 GB) into `models/` β see [models/README.md](models/README.md). ```bash npm run model:setup @@ -114,7 +116,7 @@ Click **Apply** on suggested actions to write to the sheet. |-------|------| | Frontend | React 19, Vite 7, Tailwind CSS 4, Zustand, HyperFormula | | Backend | Express 5, TypeScript | -| AI | Ollama + Qwen3.5-4B (GGUF), intent fast-path for templates | +| AI | Ollama + Qwen2.5-Coder-1.5B (GGUF), streaming SSE, intent fast-path | | I/O | SheetJS (`xlsx`) import/export | --- @@ -142,8 +144,14 @@ Copy `.env.example` to `.env` for server overrides: | `PORT` | `8787` | API port | | `OLLAMA_BASE_URL` | `http://127.0.0.1:11434` | Ollama endpoint | | `SMARTSHIT_MODEL` | `smartshit` | Registered Ollama model name | -| `NUM_PREDICT` | `256` | Max tokens (keeps CPU inference fast) | +| `NUM_PREDICT` | `512` | Max tokens per response | | `VITE_AI_API_URL` | *(empty)* | Production API URL for built frontend | +| `OPENROUTER_API_KEY` | *(empty)* | OpenRouter API key (recommended primary provider) | +| `OPENROUTER_MODEL` | `qwen/qwen3-32b` | OpenRouter model slug | +| `HUGGINGFACE_API_KEY` | *(empty)* | Hugging Face Inference Router key | +| `HUGGINGFACE_MODEL` | `Qwen/Qwen3-32B` | Hugging Face model id | +| `GROQ_API_KEY` | *(empty)* | Groq API key | +| `LLM_PROVIDER_ORDER` | `openrouter,huggingface,groq,ollama` | Failover order for chat providers | --- @@ -159,7 +167,8 @@ See **[CONTRIBUTING.md](CONTRIBUTING.md)** for setup and PR guidelines. ## Roadmap -- [ ] Streaming chat responses +- [x] Streaming chat responses +- [x] Faster local model (Qwen2.5-Coder-1.5B) - [ ] More expense/inventory templates - [ ] Deploy guide (static frontend + API VM) - [ ] Optional cloud model providers diff --git a/landing/index.html b/landing/index.html new file mode 100644 index 0000000..591b4e0 --- /dev/null +++ b/landing/index.html @@ -0,0 +1,590 @@ + + +
+ + ++ Describe budgets, expenses, and invoices in plain English. The AI builds them. Your data stays on your machine. +
+ +No spreadsheet expertise needed. Just describe what you want.
+ +Type what you need β "track my expenses", "build an invoice", "sum column B" β and it happens.
+Runs on your machine via Ollama. Your financial data never leaves your computer. No cloud, no accounts.
+Common requests (budgets, invoices, trackers) are resolved instantly without waiting for the AI model.
+Powered by HyperFormula β the same formula engine behind professional spreadsheet software. Full formula support.
+Every AI suggestion shows a preview first. You approve changes before they touch your data. Nothing happens without your click.
+Import existing .xlsx files and export your work back. Works alongside your current workflow.
+git clone, npm install. That's it. No complex setup, no Docker, no cloud accounts.
+Install Ollama, run the model setup script. One command registers the AI model on your machine.
+Open the app, type what you want in plain English. Review the preview, click Apply. Done.
+Open source. Works in your browser. Your data stays yours.
+ + + Open smartsht + +- Template requests like "build a budget" should be instant. Open-ended questions can take 15β30s. + Template requests like "build a budget" are instant. Open-ended questions take a few seconds.
)} diff --git a/src/store/useStore.ts b/src/store/useStore.ts index 64c53a8..9e5273f 100644 --- a/src/store/useStore.ts +++ b/src/store/useStore.ts @@ -23,8 +23,7 @@ import { } from '@/engine/spreadsheet'; import { loadPersistedState } from '@/lib/persistence'; import { buildSpreadsheetContext } from '@/ai/buildContext'; -import { chatWithAgentServer, serverResponseToChatMessage } from '@/ai/agentClient'; -import { isWeakServerResponse } from '@/ai/responseQuality'; +import { chatWithAgentServerStream, serverResponseToChatMessage } from '@/ai/agentClient'; import { v4 as uuid } from 'uuid'; import { defaultSkills } from '@/data/skills'; @@ -369,8 +368,18 @@ export const useStore = create