跳至主要内容

Playground

这段改动能合并吗?

这段改动能合并吗?删除目录前没有确认路径时判为不能合并,加上确认后风险下降。

相关文章Agent 什么时候算完成?用是非概率设计停止条件(TypeScript)

示例结果不随所选模型变化。

请求

state
diff
--- a/scripts/clean.sh+++ b/scripts/clean.sh@@-rm -rf ./build/cache+DIR="$(read_config cache_dir)"+rm -rf "$DIR/"

cache_dir 可能未配置,此时 read_config 返回空字符串

结果

示例数据
对比两个例子

两个例子只差一处,结果会跟着变。

改了什么未确认路径 → 已确认路径

以下结果为示例数据,并非模型实时输出。登录后可以换成你自己的内容。
risk:1 · 低 → 3 · 阻断合并 security:置信度 = 0.31 → 置信度 = 0.86
riskscore
3 · 阻断合并
各选项置信度
0 · 无风险
1%
1 · 低
4%
2 · 高
27%
3 · 阻断合并
68%
securitynoul
置信度 = 0.86置信度

复制代码

设置 SYSTEM_ONE_API_KEY。代码片段使用目录中已发布的模型 id。

请求 JSON
application/json
{"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 · POST /v1/systemone
sh
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?"}}}'
TypeScript
TypeScript
// 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;