# jev-web **Repository Path**: kevinlights/jev-web ## Basic Information - **Project Name**: jev-web - **Description**: Jev Web - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-09-30 - **Last Updated**: 2026-09-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Jev System One Web Playground 一个轻量级的 Web 前端,用来交互调用本地 EdgeJev 模型推理服务(`/v1/systemone`),无需任何构建步骤——双击打开即可用。 A lightweight web frontend that calls the local EdgeJev inference service (`/v1/systemone`) — no build step required, just open in a browser. ## 功能 Features - **动态 Question 编辑器**:支持 `choice` / `noul` / `score` 三种问题类型,Choice 和 Score 自带 criteria(key + 描述)增删 - Dynamic question editor with `choice` / `noul` / `score` types, Choice and Score have editable criteria - **结果可视化**:Choice 类型用概率条形图(胜者绿色高亮 + 动画),Noul 用 SVG 环形仪表,Score 用数值显示 - Visualized results: Choice uses animated probability bars, Noul uses an SVG gauge, Score shows the numeric value - **历史记录**:自动缓存到 `localStorage`,最多 50 条,点击即可回填表单 + 重绘结果 - History persisted to `localStorage`, up to 50 entries, click to reload request and result - **服务器健康检查**:固定检测 `http://127.0.0.1:8009/health`,绿点 OK / 红点离线 - Health check against `http://127.0.0.1:8009/health`, green dot OK / red dot offline - **CORS 支持**:EdgeJev 原生 `serve.py` 不带 CORS,已在本地补上 - CORS: upstream `serve.py` lacks CORS, patched locally ## 快速开始 Quick Start ```bash # 1. 启动 EdgeJev server(另一个终端窗口) cd local-research/jev-research EDGEJEV_PROVIDER=cpu edgejev serve --model ./jev-int8 --port 8009 # 2. 启动 Web UI(当前终端) cd publish/jev-web python3 -m http.server 8765 # 3. 浏览器打开 open http://127.0.0.1:8765 ``` > **CORS 说明**:浏览器是跨域调用 EdgeJev(8765 → 8009),所以 EdgeJev 的 `serve.py` 需要支持 CORS。本地已打过补丁——加了 `do_OPTIONS` 方法和 `_cors()` 注入,`pip install --force-reinstall ./edgejev-src[build]` 后生效。 > > **Note on CORS**: The browser calls EdgeJev cross-origin (8765 → 8009). Upstream `serve.py` does not send CORS headers. The local fix adds `do_OPTIONS` and `_cors()` — run `pip install --force-reinstall ./edgejev-src[build]` from the `jev-research` dir to apply. ## 项目结构 Structure ``` publish/jev-web/ ├── index.html # 三栏布局骨架 ├── style.css # 暗色主题样式 ├── app.js # 全部交互逻辑(原生 JS,无框架) ├── mac-app/ # 原生 macOS App(WKWebView 封装,见 mac-app/README.md) └── README.md ``` ## API 接口 API Contract ``` POST http://127.0.0.1:8009/v1/systemone Content-Type: application/json { "model": "jev-latest", "state": "我的信用卡被扣了两次款,麻烦退一笔。", "questions": { "dept": { "type": "choice", "instructions": "该转给哪个组?", "criteria": { "billing": "支付、扣款、发票、退款", "technical": "程序缺陷、报错", "sales": "售前咨询、定价" } }, "urgent": { "type": "noul", "instructions": "这条消息表达了紧急或时间压力" } } } ``` 响应 Response: ```json { "model": "rl-agent", "answers": { "dept": { "type": "choice", "choice": "billing", "probabilities": { "billing": 0.998, "technical": 0.0018, "sales": 0.0002 }, "confidence": 0.9864, "action": { "act_probability": 1.0 } }, "urgent": { "type": "noul", "noul": 0.0168, "confidence": 0.9832, "action": { "act_probability": 1.0 } } }, "usage": { "input_tokens": 104, "output_tokens": 0 } } ``` ## 快捷键 Shortcuts | 操作 | 快捷键 | |------|--------| | 运行推理 Run inference | `Cmd/Ctrl + Enter`(在 State 输入框内) | ## 技术栈 Tech Stack - 纯原生 HTML / CSS / JavaScript,无框架、无构建 - EdgeJev 服务端:Python `http.server` + ONNX Runtime + CoreML / CPU Provider