niceeval 0.11.1-canary.9 → 0.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INDEX.md +1 -0
- package/dist/i18n/en.d.ts +0 -1
- package/dist/i18n/en.js +5 -5
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/index.js +14 -3
- package/dist/i18n/zh-CN.d.ts +1 -2
- package/dist/i18n/zh-CN.js +4 -5
- package/dist/runner/types.d.ts +7 -2
- package/docs-site/zh/examples/integrations/langgraph.mdx +3 -3
- package/docs-site/zh/explanation/judge.mdx +7 -5
- package/docs-site/zh/reference/cli.mdx +11 -17
- package/docs-site/zh/reference/define-config.mdx +14 -1
- package/docs-site/zh/tutorials/agent-onboarding.mdx +8 -22
- package/docs-site/zh/tutorials/ci-integration.mdx +2 -3
- package/docs-site/zh/tutorials/configuration.mdx +165 -0
- package/docs-site/zh/tutorials/custom-reports.mdx +30 -3
- package/package.json +1 -1
- package/src/agents/bub.ts +5 -8
- package/src/cli.ts +22 -17
- package/src/i18n/en.ts +5 -5
- package/src/i18n/index.ts +16 -3
- package/src/i18n/locale.test.ts +41 -0
- package/src/i18n/zh-CN.ts +4 -5
- package/src/report/assets/styles.css +16 -14
- package/src/runner/feedback/io.ts +1 -1
- package/src/runner/types.ts +7 -2
- package/src/scoring/judge.test.ts +47 -6
- package/src/scoring/judge.ts +15 -22
- package/src/show/index.ts +1 -1
- package/src/show/json.test.ts +3 -5
- package/src/show/show.test.ts +3 -5
- package/src/view/app/App.tsx +3 -1
- package/src/view/client-dist/app.css +1 -1
- package/src/view/client-dist/app.js +1 -1
- package/src/view/site-base.test.ts +51 -0
- package/src/view/site.ts +16 -0
- package/src/view/styles.css +1 -2
- package/src/view/template.html +1 -0
package/src/view/site.ts
CHANGED
|
@@ -197,7 +197,21 @@ async function materializeHeadAssets(head: ResolvedHeadTag[], files: Map<string,
|
|
|
197
197
|
return rendered.join("\n");
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
+
/**
|
|
201
|
+
* 站点根归一:托管方可以把站点根暴露成无尾斜杠路径(cleanUrls 用 `/showcase/memory` 直接服务
|
|
202
|
+
* `index.html`,并把带斜杠形态 308 回无斜杠),而浏览器按文档 URL 的**目录**解析相对引用——
|
|
203
|
+
* 那时 `attempt/<locator>.html`、`assets/`、`artifact/` 全部少一层,链接、证据 fetch 与 head
|
|
204
|
+
* 资产一起断。`index.html` 按构造恒是站点根,所以这段引导脚本在任何相对引用被解析之前
|
|
205
|
+
* 落一个 `<base>` 把根写成目录形态(view.md「静态导出」)。判定只看 pathname:已是目录形态
|
|
206
|
+
* 不插入,末段带扩展名(`/out/index.html`、`file://` 直接打开)取其目录,其余补一层斜杠。
|
|
207
|
+
* 独立 attempt 文档住在真实的 `attempt/` 目录下,相对引用天然对齐,不带这段脚本。
|
|
208
|
+
* 写成 `location` / `document` 两个自由变量的形式:测试直接把这段源码原样喂给假的宿主执行,
|
|
209
|
+
* 断言的是导出产物里的同一份字节,不复制第二份判定逻辑。
|
|
210
|
+
*/
|
|
211
|
+
export const SITE_BASE_SCRIPT = `(function(){try{var p=location.pathname;if(p.charAt(p.length-1)==="/")return;var i=p.lastIndexOf("/");var root=/\\.[A-Za-z0-9]+$/.test(p.slice(i+1))?p.slice(0,i+1):p+"/";var b=document.createElement("base");b.href=root;document.head.appendChild(b);}catch(e){}})();`;
|
|
212
|
+
|
|
200
213
|
const TEMPLATE_PLACEHOLDERS = {
|
|
214
|
+
siteBase: "__NICEEVAL_SITE_BASE_SCRIPT__",
|
|
201
215
|
styles: "<!-- __NICEEVAL_STYLES__ -->",
|
|
202
216
|
appCode: "__NICEEVAL_APP_CODE__",
|
|
203
217
|
viewData: "__NICEEVAL_VIEW_DATA_JSON__",
|
|
@@ -206,6 +220,7 @@ const TEMPLATE_PLACEHOLDERS = {
|
|
|
206
220
|
|
|
207
221
|
/**
|
|
208
222
|
* 把 viewData(只含原始值与相对路径,不含宿主机绝对路径)和前端产物烘焙进单个 HTML。
|
|
223
|
+
* `<head>` 最前面是站点根归一的引导脚本(SITE_BASE_SCRIPT),排在任何相对引用之前。
|
|
209
224
|
* 报告槽恒在:每页报告 HTML 作为 <template id="niceeval-report-<pageId>-<locale>"> 静态块
|
|
210
225
|
* 烘在 __NICEEVAL_VIEW_DATA__ 旁(不 hydrate,自定义组件的 <Style> 产物已内联其中),
|
|
211
226
|
* 并恒内联官方组件样式(report/react/styles.css)与渐进增强 runtime(report/react/enhance.js,
|
|
@@ -239,6 +254,7 @@ export async function renderHtml(scan: ViewScan, headHtml = ""): Promise<string>
|
|
|
239
254
|
const title = localizeText(scan.viewData.report?.title, "en") ?? "Eval Results";
|
|
240
255
|
|
|
241
256
|
return template
|
|
257
|
+
.replace(TEMPLATE_PLACEHOLDERS.siteBase, () => SITE_BASE_SCRIPT)
|
|
242
258
|
.replace(/<title>[^<]*<\/title>/, () => `<title>${escapeText(title)}</title>`)
|
|
243
259
|
.replace(
|
|
244
260
|
TEMPLATE_PLACEHOLDERS.styles,
|
package/src/view/styles.css
CHANGED
|
@@ -60,11 +60,10 @@ a { color: inherit; }
|
|
|
60
60
|
shell-links—语言切换)恒有最小间距,不依赖富余空间。 */
|
|
61
61
|
gap: 28px;
|
|
62
62
|
padding: 0 clamp(20px, 5vw, 80px);
|
|
63
|
-
background:
|
|
63
|
+
background: var(--bg);
|
|
64
64
|
position: sticky;
|
|
65
65
|
top: 0;
|
|
66
66
|
z-index: 10;
|
|
67
|
-
backdrop-filter: blur(10px);
|
|
68
67
|
}
|
|
69
68
|
/* 页头左端的恒定品牌位:NiceEval 字标 + 45° 方块 mark,外链官网(App.tsx 的 .brand)。
|
|
70
69
|
与 hero 下 nre-powered-by 品牌行同族,由宿主渲染、报告定义不能覆盖或移除。 */
|
package/src/view/template.html
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<script>__NICEEVAL_SITE_BASE_SCRIPT__</script>
|
|
6
7
|
<title>niceeval experiment view</title>
|
|
7
8
|
<!-- __NICEEVAL_STYLES__ -->
|
|
8
9
|
<script>window.__NICEEVAL_VIEW_DATA__ = __NICEEVAL_VIEW_DATA_JSON__;</script>
|