mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-25 04:03:13 +00:00
模型接入报错收尾(第 1 轮复核,前端):反方审稿的模型一栏不再多出一句相反的说明;检查器读工作流默认设置里的模型;助手栏保存失败时退回原样并说明、「当前」只写在跟随默认上、原因的去向写「上方」;接入「启用」的说明另起一行;落到演示模型的修复候选加醒目标签
- 检查器:模型一栏的留空说明(modelDefault)只用于节点定义里的模型栏。反方审稿的「反方模型」自己画、只读节点自己的 配置、留空跟随设置,以前全图默认点名了接入时也被套上「留空则使用接入「X」的默认模型」,和它自己的说明相反;工作流 默认设置写了模型时,空选项和说明写「使用工作流默认设置的模型「X」」(后端执行时取的就是它,也不报「没有指定模型」), 不再说成某个接入的默认模型; - 助手栏「助手使用的模型」:重新选择时保存失败,下拉、原因、齿轮上的红点退回选之前的样子(服务端存着的没变),下面写 「保存失败,助手使用的模型未更改」,收起再展开后不再留着;只认最后一次选择的回包;选了具体模型时「跟随默认」不写 「当前」(那时服务端给的 effective_model 是选的那个模型);下拉下面的原因用服务端的 panel_error; - 设置页接入编辑框:停用的后果另起一行写在复选框下面(aria-describedby 接上,读屏名只是「启用」),不再和「启用」并排 放在 label 里把它挤成上下两个字;说法收紧为「停用后,该接入的模型不再出现在下拉列表中,指定它或其模型的节点和设置也 无法调用」——调不了以后怎样(报错、转人工审批、记未裁判、记缺口)由各组自己那句说,不笼统写「运行时报错」; - 发布前检查:候选带 demo 标记时,选项名旁加提醒色的「演示模型」标签,说明里那半句照旧(normalizeFix 留下这个标记)。 types.ts 的 PublishFix 选项加可选的 demo 字段。 检查:check-studio 那一节加反方审稿不套说明(全图默认点名接入、写了模型两种)、工作流默认设置带模型时的空选项和说明、 保存失败退回原样与收起再展开、选具体模型不写「当前」、原因写「上方」;check-manage 量「启用」只占一行(1440、390)、 说明不在 label 里、读屏名只是「启用」、说明在弹窗里;check-publish 的伪造门禁跟上「无法改用其他接入:」与 demo 标记, 加一节演示标签(两个候选各一个、提醒色而非淡色、和选项名同一行、390 宽在弹窗里)。新加的检查项对着改动前的界面跑过, 都会不通过。
This commit is contained in:
+102
-36
@@ -2610,7 +2610,7 @@ await section('合并查询:节点库认得、卡片摘要、检查器从上
|
||||
// ================================================================ 点名的模型接入(K1b)
|
||||
// 接入表、画布校验、助手的模型设定都是伪造的(一家启用、一家停用,名字都是通用名)。校验按伪造的接入表现算,形状照
|
||||
// 后端:点名的接入不存在、已停用给接入那一条(provider.*);点名的接入好好的、没写模型给「将使用接入「X」的默认模型」;
|
||||
// 接入那一条在时不再给「没有指定模型」(provider_refs.quiet_unset_model)
|
||||
// 接入那一条在时不再给「没有指定模型」(provider_refs.quiet_unset_model);工作流默认设置写了模型时不报「没有指定模型」
|
||||
const MODEL_PROVIDERS = [
|
||||
{ id: 'pv-main', name: 'demo-main', kind: 'openai_compatible', base_url: 'https://example.com/v1', default_model: 'big-model',
|
||||
models: [{ id: 'big-model' }, { id: 'small-model' }], enabled: true, extra: {}, api_key_masked: '', has_key: true },
|
||||
@@ -2624,6 +2624,8 @@ const MODEL_GRAPH = {
|
||||
node('gone', 'llm', 300, 220, '接入已删', { prompt: '{{ input.q }}', provider: 'demo-gone' }),
|
||||
node('off', 'agent', 300, 380, '接入已停用', { prompt: '{{ input.q }}', provider: 'demo-off' }),
|
||||
node('plain', 'llm', 300, 540, '没点名', { prompt: '{{ input.q }}' }),
|
||||
// 反方审稿的模型一栏自己画(只读节点自己的配置、留空跟随设置),不取工作流默认设置
|
||||
node('chal', 'challenge', 300, 700, '审稿', {}),
|
||||
node('done', 'output', 640, 300, '成果', { fields: [{ name: 'a', value: '{{ last_message }}' }] }),
|
||||
],
|
||||
edges: [edge('start', 'named'), edge('start', 'gone'), edge('start', 'off'), edge('start', 'plain'),
|
||||
@@ -2643,64 +2645,75 @@ const modelLint = (graph) => {
|
||||
message: `「${n.data.label}」指定的模型接入「${named}」${p ? '已停用' : '不存在'}。请在「设置 → 模型接入」中${p ? '启用它' : '核对名称'}` })
|
||||
continue
|
||||
}
|
||||
if (!c.model) {
|
||||
if (!c.model && !graph.defaults?.model) {
|
||||
issues.push({ level: 'warning', node_id: n.id, field: 'model', code: 'model.unset',
|
||||
message: named ? `没有指定模型,将使用接入「${named}」的默认模型` : '没有指定模型,将使用默认模型' })
|
||||
}
|
||||
}
|
||||
return { ok: true, issues }
|
||||
}
|
||||
// 助手的模型取不到:error 是生成时报的整句(别处也这么说),panel_error 写在助手栏那一格下面,去向是「上方」的下拉框
|
||||
const ASSISTANT_BROKEN = '助手使用的模型接入「demo-gone」不存在。请在「设置 → 模型接入」中核对名称,或在「编排」页助手栏的「助手使用的模型」中重新选择'
|
||||
const ASSISTANT_PANEL = '助手使用的模型接入「demo-gone」不存在。请在上方重新选择,或在「设置 → 模型接入」中核对名称'
|
||||
|
||||
await section('点名的模型接入:检查器模型一栏说清留空用哪个接入;助手栏照实显示存着的设定、能重新选「跟随默认」', async () => {
|
||||
FAKES['st-model'] = wf('st-model', { name: '__studio_check_model__', graph: MODEL_GRAPH, version: 1 })
|
||||
FAKES['st-modeldef'] = wf('st-modeldef', { name: '__studio_check_model_defaults__', graph: { ...MODEL_GRAPH, defaults: { provider: 'demo-main' } }, version: 1 })
|
||||
// 助手的模型设定:存着一个已删掉的接入和一个下拉里列得出的模型(big-model),GET 照后端说明用不了;PUT 记下请求、
|
||||
// 清掉存着的接入。模型列得出也不能直接选中它:那样看着一切正常,发出去还会带上模型、绕过存着的接入
|
||||
const BROKEN = { configured: true, provider: 'demo-gone', model: 'big-model', effective_provider: null, effective_model: null, error: ASSISTANT_BROKEN }
|
||||
const copilot = { saved: BROKEN, puts: [] }
|
||||
FAKES['st-modeldm'] = wf('st-modeldm', { name: '__studio_check_model_default_model__',
|
||||
graph: { ...MODEL_GRAPH, defaults: { provider: 'demo-main', model: 'small-model' } }, version: 1 })
|
||||
// 助手的模型设定:存着一个已删掉的接入和一个下拉里列得出的模型(big-model),GET 照后端说明用不了;PUT 记下请求,照请求
|
||||
// 存(选了模型就是那个模型、跟随默认就清掉存着的接入),fail 为真时答 500、什么都不改。模型列得出也不能直接选中它:
|
||||
// 那样看着一切正常,发出去还会带上模型、绕过存着的接入
|
||||
const BROKEN = { configured: true, provider: 'demo-gone', model: 'big-model', effective_provider: null, effective_model: null,
|
||||
error: ASSISTANT_BROKEN, panel_error: ASSISTANT_PANEL }
|
||||
const copilot = { saved: BROKEN, puts: [], fail: false }
|
||||
const before = async (page) => {
|
||||
const json = (route, body) => route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(body) })
|
||||
const json = (route, body, status = 200) => route.fulfill({ status, contentType: 'application/json', body: JSON.stringify(body) })
|
||||
await page.route(/\/api\/providers(\?.*)?$/, (route) => (route.request().method() === 'GET' ? json(route, MODEL_PROVIDERS) : route.fallback()))
|
||||
await page.route(/\/api\/workflows\/validate$/, (route) => json(route, modelLint(route.request().postDataJSON()?.graph ?? {})))
|
||||
await page.route(/\/api\/copilot\/model$/, (route) => {
|
||||
if (route.request().method() === 'PUT') {
|
||||
copilot.puts.push(route.request().postDataJSON())
|
||||
copilot.saved = { configured: false, provider: null, model: null, effective_provider: 'demo-main', effective_model: 'big-model', error: null }
|
||||
const body = route.request().postDataJSON()
|
||||
copilot.puts.push(body)
|
||||
if (copilot.fail) return json(route, { detail: '数据库已锁定,请稍后重试' }, 500)
|
||||
copilot.saved = body.model
|
||||
? { configured: true, provider: null, model: body.model, effective_provider: 'demo-main', effective_model: body.model, error: null, panel_error: null }
|
||||
: { configured: false, provider: null, model: null, effective_provider: 'demo-main', effective_model: 'big-model', error: null, panel_error: null }
|
||||
}
|
||||
return json(route, copilot.saved)
|
||||
})
|
||||
}
|
||||
try {
|
||||
const { ctx, page, state, errors } = await open({ path: '/studio/st-model', before, stream: [{ op: 'done', explanation: '好' }] })
|
||||
const field = page.locator('[data-inspector-sheet] [data-field="model"]')
|
||||
const look = async (id) => {
|
||||
await S(page, (x) => window.__studio.getState().select(x), id)
|
||||
await field.waitFor({ timeout: 4000 })
|
||||
await page.waitForTimeout(150)
|
||||
const look = async (p, id) => {
|
||||
const f = p.locator('[data-inspector-sheet] [data-field="model"]')
|
||||
await S(p, (x) => window.__studio.getState().select(x), id)
|
||||
await f.waitFor({ timeout: 4000 })
|
||||
await p.waitForTimeout(150)
|
||||
const select = f.locator('select option[value=""]')
|
||||
return {
|
||||
blank: (await field.locator('select option[value=""]').innerText()).trim(),
|
||||
help: await field.locator('[data-field-help]').count() ? (await field.locator('[data-field-help]').innerText()).trim() : null,
|
||||
text: await field.innerText(),
|
||||
sheet: await page.locator('[data-inspector-sheet]').innerText(),
|
||||
blank: await select.count() ? (await select.innerText()).trim() : null,
|
||||
help: await f.locator('[data-field-help]').count() ? (await f.locator('[data-field-help]').innerText()).trim() : null,
|
||||
text: await f.innerText(),
|
||||
sheet: await p.locator('[data-inspector-sheet]').innerText(),
|
||||
}
|
||||
}
|
||||
await waitAnalysis(page)
|
||||
const named = await look('named')
|
||||
const named = await look(page, 'named')
|
||||
check('点名了启用的接入、没写模型:空选项写「使用接入「demo-main」的默认模型」', named.blank === '默认(使用接入「demo-main」的默认模型)', named.blank)
|
||||
check('……下面的说明同样写这个接入', named.help === '留空则使用接入「demo-main」的默认模型', named.help)
|
||||
check('……校验那条也照实写接入', named.text.includes('没有指定模型,将使用接入「demo-main」的默认模型'), named.text.slice(0, 120))
|
||||
const gone = await look('gone')
|
||||
const gone = await look(page, 'gone')
|
||||
check('点名的接入不存在:空选项说状态,不说「使用」', gone.blank === '默认(模型接入「demo-gone」不存在)', gone.blank)
|
||||
check('……模型一栏下面不再写说明,也没有「没有指定模型」那条', gone.help === null && !gone.text.includes('没有指定模型'), gone.text.slice(0, 120))
|
||||
check('……接入那条问题在检查器顶上', gone.sheet.includes('指定的模型接入「demo-gone」不存在'), gone.sheet.slice(0, 160))
|
||||
const off = await look('off')
|
||||
const off = await look(page, 'off')
|
||||
check('点名的接入已停用:空选项写「已停用」,没有说明', off.blank === '默认(模型接入「demo-off」已停用)' && off.help === null, `${off.blank} · ${off.help}`)
|
||||
const plain = await look('plain')
|
||||
const plain = await look(page, 'plain')
|
||||
check('没点名接入:照旧写第一个可用的模型接入', plain.blank === '默认(使用第一个可用的模型接入)' && plain.help === '留空则使用默认模型接入',
|
||||
`${plain.blank} · ${plain.help}`)
|
||||
if (SHOTS) {
|
||||
await look('gone')
|
||||
await look(page, 'gone')
|
||||
for (const theme of ['dark', 'light']) {
|
||||
await page.evaluate((t) => document.documentElement.setAttribute('data-theme', t), theme)
|
||||
await page.waitForTimeout(200)
|
||||
@@ -2719,12 +2732,15 @@ await section('点名的模型接入:检查器模型一栏说清留空用哪
|
||||
await gear.click()
|
||||
const select = page.locator('#copilot-model')
|
||||
await select.waitFor({ timeout: 3000 })
|
||||
const picked = await select.evaluate((el) => el.options[el.selectedIndex]?.textContent ?? '')
|
||||
const pickedText = () => select.evaluate((el) => el.options[el.selectedIndex]?.textContent ?? '')
|
||||
const followText = async () => (await select.locator('option[value=""]').innerText()).trim()
|
||||
const picked = await pickedText()
|
||||
check('下拉停在存着的设定上(接入连同模型),不显示成「跟随默认」,也不只选中同名的模型', picked === 'big-model(模型接入「demo-gone」)'
|
||||
&& await select.inputValue() !== '' && await select.inputValue() !== 'big-model', picked)
|
||||
check('……「跟随默认」不带「当前」:选它以后用哪个要服务端说了算', (await select.locator('option[value=""]').innerText()).trim() === '跟随默认')
|
||||
check('……「跟随默认」不带「当前」:选它以后用哪个要服务端说了算', await followText() === '跟随默认')
|
||||
const said = await page.locator('[data-copilot-model-error]').innerText().catch(() => '')
|
||||
check('下拉下面照实写原因(和发出一句话后报的同一句)', said === ASSISTANT_BROKEN && await select.getAttribute('aria-invalid') === 'true', said)
|
||||
check('下拉下面写原因,去向是「上方」的下拉框,不把人指回这个下拉框本身', said === ASSISTANT_PANEL
|
||||
&& await select.getAttribute('aria-invalid') === 'true', said)
|
||||
if (SHOTS) {
|
||||
for (const theme of ['dark', 'light']) {
|
||||
await page.evaluate((t) => document.documentElement.setAttribute('data-theme', t), theme)
|
||||
@@ -2742,27 +2758,76 @@ await section('点名的模型接入:检查器模型一栏说清留空用哪
|
||||
check('……发出的请求不带模型', state.bodies.length === 1 && !('model' in state.bodies[0] && state.bodies[0].model), JSON.stringify(state.bodies[0] ?? {}).slice(0, 100))
|
||||
await page.waitForFunction(() => !window.__studio.getState().copilot.active, null, { timeout: 4000 }).catch(() => {})
|
||||
|
||||
// 重新选「跟随默认」时保存失败:服务端存着的没变,下拉退回存着的那一项,原因和齿轮上的红点照旧,并说明没改成
|
||||
copilot.fail = true
|
||||
await select.selectOption('')
|
||||
await until(() => copilot.puts.length > 0, 3000)
|
||||
check('重新选「跟随默认」算一次改动:存成不指定接入和模型', copilot.puts.length === 1 && copilot.puts[0].model === null
|
||||
&& !copilot.puts[0].provider, JSON.stringify(copilot.puts))
|
||||
await page.locator('[data-copilot-model-save-failed]').waitFor({ timeout: 3000 }).catch(() => {})
|
||||
check('保存失败:说明没改成', (await page.locator('[data-copilot-model-save-failed]').innerText().catch(() => '')) === '保存失败,助手使用的模型未更改')
|
||||
check('……下拉退回存着的那一项,原因和齿轮上的红点照旧', await pickedText() === 'big-model(模型接入「demo-gone」)'
|
||||
&& await page.locator('[data-copilot-model-error]').innerText().catch(() => '') === ASSISTANT_PANEL
|
||||
&& await page.locator('[data-copilot-model-broken]').count() === 1, await pickedText())
|
||||
// 收起再展开:重新取回的就是服务端现在存着的,上一次「保存失败」的说明不再留着,原因照旧
|
||||
await gear.click()
|
||||
await gear.click()
|
||||
await select.waitFor({ timeout: 3000 })
|
||||
await page.waitForTimeout(300)
|
||||
check('……收起再展开:「保存失败」的说明不再留着,原因照旧', await page.locator('[data-copilot-model-save-failed]').count() === 0
|
||||
&& await page.locator('[data-copilot-model-error]').innerText().catch(() => '') === ASSISTANT_PANEL)
|
||||
copilot.fail = false
|
||||
|
||||
await select.selectOption('')
|
||||
await until(() => copilot.puts.length > 1, 3000)
|
||||
check('重新选「跟随默认」算一次改动:存成不指定接入和模型', copilot.puts.length === 2 && copilot.puts[1].model === null
|
||||
&& !copilot.puts[1].provider, JSON.stringify(copilot.puts))
|
||||
await page.waitForFunction(() => !document.querySelector('[data-copilot-model-error]'), null, { timeout: 3000 }).catch(() => {})
|
||||
check('……原因和齿轮上的标记一起消失,「跟随默认」写出当前用的模型', await page.locator('[data-copilot-model-error]').count() === 0
|
||||
check('……原因、保存失败的说明、齿轮上的标记一起消失,「跟随默认」写出当前用的模型', await page.locator('[data-copilot-model-error]').count() === 0
|
||||
&& await page.locator('[data-copilot-model-save-failed]').count() === 0
|
||||
&& await page.locator('[data-copilot-model-broken]').count() === 0
|
||||
&& (await select.locator('option[value=""]').innerText()).trim() === '跟随默认(当前:big-model)')
|
||||
&& await followText() === '跟随默认(当前:big-model)', await followText())
|
||||
// 选了一个模型:服务端回来的「当前」就是这个模型,不能写到「跟随默认」上(跟随默认用的是 demo-main 的 big-model)
|
||||
await select.selectOption('small-model')
|
||||
await until(() => copilot.puts.length > 2, 3000)
|
||||
await page.waitForTimeout(200)
|
||||
check('选了具体模型:「跟随默认」不写「当前」', copilot.puts[2]?.model === 'small-model' && await followText() === '跟随默认'
|
||||
&& await select.inputValue() === 'small-model', await followText())
|
||||
check('没有运行时报错', errors.length === 0, errors.slice(0, 2).join(' | '))
|
||||
await ctx.close()
|
||||
|
||||
// 全图默认点名的接入:没写自己接入的节点跟着它
|
||||
// 全图默认点名的接入:没写自己接入的节点跟着它。反方审稿的模型一栏不取全图默认,不套这句
|
||||
const second = await open({ path: '/studio/st-modeldef', before })
|
||||
await S(second.page, () => window.__studio.getState().select('plain'))
|
||||
const defField = second.page.locator('[data-inspector-sheet] [data-field="model"]')
|
||||
await defField.waitFor({ timeout: 4000 })
|
||||
const defBlank = (await defField.locator('select option[value=""]').innerText()).trim()
|
||||
check('全图默认点名了接入:没写自己接入的节点写「使用接入「demo-main」的默认模型」', defBlank === '默认(使用接入「demo-main」的默认模型)', defBlank)
|
||||
const defPlain = await look(second.page, 'plain')
|
||||
check('全图默认点名了接入:没写自己接入的节点写「使用接入「demo-main」的默认模型」', defPlain.blank === '默认(使用接入「demo-main」的默认模型)', defPlain.blank)
|
||||
const chal = await look(second.page, 'chal')
|
||||
check('反方审稿的「反方模型」:不多出「留空则使用接入……」(和它自己「跟随设置」的说明相反)', chal.help === null
|
||||
&& !chal.text.includes('留空则使用接入') && chal.text.includes('核查模型'), chal.text.slice(0, 140))
|
||||
check('没有运行时报错', second.errors.length === 0, second.errors.slice(0, 2).join(' | '))
|
||||
await second.ctx.close()
|
||||
|
||||
// 工作流默认设置写了模型:节点没写模型时用的就是它,不说「使用接入的默认模型」
|
||||
const third = await open({ path: '/studio/st-modeldm', before })
|
||||
const dmPlain = await look(third.page, 'plain')
|
||||
check('全图默认写了模型:空选项和说明都写这个模型', dmPlain.blank === '默认(使用工作流默认设置的模型「small-model」)'
|
||||
&& dmPlain.help === '留空则使用工作流默认设置的模型「small-model」', `${dmPlain.blank} · ${dmPlain.help}`)
|
||||
const dmNamed = await look(third.page, 'named')
|
||||
check('……节点自己点名了接入也一样(模型取全图默认的)', dmNamed.blank === '默认(使用工作流默认设置的模型「small-model」)'
|
||||
&& dmNamed.help === '留空则使用工作流默认设置的模型「small-model」' && !dmNamed.text.includes('没有指定模型'), `${dmNamed.blank} · ${dmNamed.help}`)
|
||||
const dmGone = await look(third.page, 'gone')
|
||||
check('……点名的接入不存在时仍先说状态,不说「使用」', dmGone.blank === '默认(模型接入「demo-gone」不存在)' && dmGone.help === null,
|
||||
`${dmGone.blank} · ${dmGone.help}`)
|
||||
const dmChal = await look(third.page, 'chal')
|
||||
check('……反方审稿的模型一栏同样不套这句', dmChal.help === null && !dmChal.text.includes('工作流默认设置'), dmChal.text.slice(0, 140))
|
||||
if (SHOTS) {
|
||||
await look(third.page, 'plain')
|
||||
for (const theme of ['dark', 'light']) {
|
||||
await third.page.evaluate((t) => document.documentElement.setAttribute('data-theme', t), theme)
|
||||
await third.page.waitForTimeout(200)
|
||||
await third.page.locator('[data-inspector-sheet]').screenshot({ path: `${SHOTS}/studio-model-defaults-${theme}.png` })
|
||||
}
|
||||
}
|
||||
check('没有运行时报错', third.errors.length === 0, third.errors.slice(0, 2).join(' | '))
|
||||
await third.ctx.close()
|
||||
|
||||
// 390 宽:助手栏浮在画布上,展开「助手使用的模型」、原因那一长句照样折行,不把页面撑出横向滚动
|
||||
copilot.saved = BROKEN
|
||||
const narrow = await open({ path: '/studio/st-model', before, width: 390, height: 844 })
|
||||
@@ -2795,6 +2860,7 @@ await section('点名的模型接入:检查器模型一栏说清留空用哪
|
||||
} finally {
|
||||
delete FAKES['st-model']
|
||||
delete FAKES['st-modeldef']
|
||||
delete FAKES['st-modeldm']
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user