尚未检测到更新。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.