尚未偵測到更新。GitHub 發布版本後會顯示在這裡。
個人 GitHub 帳號下公開儲存庫的擁有者可以登入並驗證所有權,自行管理介紹,無需管理員核准。
登入並產生驗證檔案,在 30 分鐘內將其提交至此儲存庫的預設分支。其他分支或分叉儲存庫中的檔案無效。然後在下方檢查檔案,即可無需管理員核准直接管理專案。請保留檔案以維持管理權限。
如需登入,將前往登入頁面。登入後請回到此處,再次點擊所選的驗證按鈕。
在專案資料夾中執行 /nomorevibe verify,即可驗證所有權並自行管理介紹。
一分鐘完成驗證Calcolatore costi di viaggio per auto ibride plug-in (PHEV)
翻譯準備中
取自儲存庫 README
正在載入完整 README。
檢視完整 README ↗Web app that compares the cost of a plug-in hybrid trip started with a full battery against the same trip on petrol only, and shows the electricity break-even price.
Live: https://danizhou.github.io/Car-electric-petrol-calculator/
Built with Next.js (App Router) and TypeScript. Installable as a PWA and usable offline.
npm install
npm run dev # http://localhost:3000
npm test # unit tests for the calculation logic
npm run build && npm start
The service worker is only registered in production builds (npm run build && npm start).
Every push to main builds a static export and publishes it with GitHub Actions (.github/workflows/deploy-pages.yml). The footer of the live site shows the commit it was built from. Pages has no server, so the AI assistant route is left out of that build.
To reproduce the Pages build locally (move app/api aside first):
STATIC_EXPORT=true NEXT_PUBLIC_BASE_PATH=/Car-electric-petrol-calculator npm run build # output in out/
The app includes an assistant that answers questions about the trip using Claude (claude-opus-5-5) and the same calculation logic, via a calculate_trip tool. It is switched off: the section is hidden and /api/assistant returns 404.
To enable it, copy .env.example to .env.local and set:
NEXT_PUBLIC_ASSISTANT_ENABLED=true
ANTHROPIC_API_KEY=sk-ant-...
The flag is read at build time, so rebuild after changing it. The endpoint has no authentication or rate limiting, so add some before exposing it publicly.
app/ layout, page, PWA manifest, global styles, api/assistant route
components/ UI: trip inputs, car presets, results
lib/
calculator.ts pure calculation logic (scenario A, scenario B, break-even)
assistant.ts AI assistant: system prompt, calculate_trip tool, streaming
features.ts feature flags
cars.ts built-in car presets + custom cars in localStorage
format.ts Italian number/currency formatting and parsing
public/ icons and service worker
Add an entry to BUILT_IN_CARS in lib/cars.ts. Cars saved from the UI are stored in the browser only.