feat(frontend): 接入真实媒体工作流与模型配置卡片

This commit is contained in:
2026-09-04 12:39:50 +08:00
parent 8d092533f6
commit 8c644d0aae
15 changed files with 428 additions and 13 deletions
@@ -0,0 +1,20 @@
// @vitest-environment happy-dom
import { mount } from '@vue/test-utils'
import { expect, it } from 'vitest'
import RequestJsonEditor from './RequestJsonEditor.vue'
it('validates object JSON and prevents host-owned fields from being saved', async () => {
const wrapper = mount(RequestJsonEditor, {props: {modelValue: []}})
await wrapper.get('button').trigger('click')
await wrapper.get('textarea').setValue('{"stream":false}')
expect(wrapper.emitted('valid')?.at(-1)).toEqual([false])
expect(wrapper.text()).toContain('运行请求管理字段不可覆盖')
await wrapper.get('textarea').setValue('{"stream_options":{"include_usage":true}}')
expect(wrapper.emitted('valid')?.at(-1)).toEqual([true])
expect(wrapper.emitted('update:modelValue')?.at(-1)?.[0]).toEqual([
{capability:'chat', model:null, stream:null, body:{stream_options:{include_usage:true}}},
])
await wrapper.get('textarea').setValue('[]')
expect(wrapper.emitted('valid')?.at(-1)).toEqual([false])
wrapper.unmount()
})