riskscore各选项置信度
0 · 无风险1%
1 · 低4%
2 · 高27%
3 · 阻断合并68%
Playground
这段改动能合并吗?删除目录前没有确认路径时判为不能合并,加上确认后风险下降。
--- a/scripts/clean.sh+++ b/scripts/clean.sh-rm -rf ./build/cache+DIR="$(read_config cache_dir)"+rm -rf "$DIR/"
cache_dir 可能未配置,此时 read_config 返回空字符串
两个例子只差一处,结果会跟着变。
改了什么未确认路径 → 已确认路径
riskscore0 · 无风险1 · 低2 · 高3 · 阻断合并securitynoul设置 SYSTEM_ONE_API_KEY。代码片段使用目录中已发布的模型 id。
{"model":"decider-v1.1","state":{"diff":"--- a/scripts/clean.sh\n+++ b/scripts/clean.sh\n@@\n-rm -rf ./build/cache\n+DIR=\"$(read_config cache_dir)\"\n+rm -rf \"$DIR/\"","context":"cache_dir 可能未配置,此时 read_config 返回空字符串"},"questions":{"risk":{"type":"score","instructions":"Rate the merge risk of this diff.","criteria":["无风险","低","高","阻断合并"]},"security":{"type":"noul","instructions":"Does this change affect security or data safety?"}}}curl "https://system-one.dev/v1/systemone" \ -H "Authorization: Bearer $SYSTEM_ONE_API_KEY" \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: saved-operation-id' \ --data '{"model":"decider-v1.1","state":{"diff":"--- a/scripts/clean.sh\n+++ b/scripts/clean.sh\n@@\n-rm -rf ./build/cache\n+DIR=\"$(read_config cache_dir)\"\n+rm -rf \"$DIR/\"","context":"cache_dir 可能未配置,此时 read_config 返回空字符串"},"questions":{"risk":{"type":"score","instructions":"Rate the merge risk of this diff.","criteria":["无风险","低","高","阻断合并"]},"security":{"type":"noul","instructions":"Does this change affect security or data safety?"}}}'// npm install @system-one-ai/core@0.6.0 @system-one-ai/transport-fetch@0.6.0 @system-one-ai/adapter-system-one@0.6.0import { createSystemOne, choice, score, booleanQuestion } from '@system-one-ai/core';import { systemOneAdapter } from '@system-one-ai/adapter-system-one';import { createFetchTransport } from '@system-one-ai/transport-fetch';const client = createSystemOne({ baseURL: "https://system-one.dev/v1", apiKey: process.env.SYSTEM_ONE_API_KEY!, model: "decider-v1.1", adapter: systemOneAdapter, transport: createFetchTransport(), timeoutMs: 30_000, maxRetries: 0,});const result = await client.evaluate({ state: { "diff": "--- a/scripts/clean.sh\n+++ b/scripts/clean.sh\n@@\n-rm -rf ./build/cache\n+DIR=\"$(read_config cache_dir)\"\n+rm -rf \"$DIR/\"", "context": "cache_dir 可能未配置,此时 read_config 返回空字符串" }, questions: { risk: score("Rate the merge risk of this diff.", ["无风险", "低", "高", "阻断合并"]), security: booleanQuestion("Does this change affect security or data safety?"), },}, { headers: { 'Idempotency-Key': crypto.randomUUID() } });result.answers.risk.scoreresult.answers.security.probabilityresult.response.requestId;