feat: 优化内容模板变量引用与换行展示
- 内容模板直接引用上游参数并自动维护运行参数 - 支持 Enjoy 变量标签编辑及中文变量显示 - 保留试运行与聊天运行页的模板输出换行
This commit is contained in:
@@ -69,7 +69,7 @@ function makeItem(item: any, index: number) {
|
||||
:src="`${item}`"
|
||||
class="h-3/5 w-full"
|
||||
></audio>
|
||||
<div v-if="contentType === 'text'">
|
||||
<div v-if="contentType === 'text'" class="whitespace-pre-wrap">
|
||||
{{ typeof item === 'string' ? item : JSON.stringify(item) }}
|
||||
</div>
|
||||
<div v-if="contentType === 'other' || contentType === 'file'">
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { nextTick } from 'vue';
|
||||
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
|
||||
@@ -44,4 +45,21 @@ describe('workflow final output', () => {
|
||||
expect(wrapper.text()).toContain('复制全部');
|
||||
expect(wrapper.findAll('button')).toHaveLength(3);
|
||||
});
|
||||
|
||||
it('renders scalar line breaks in the workflow chat result', async () => {
|
||||
const wrapper = mount(WorkflowFinalOutput, {
|
||||
props: {
|
||||
output: {
|
||||
output: '问题:你是谁\n答案:你好',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
await nextTick();
|
||||
|
||||
const textOutput = wrapper.get('.workflow-final-output__text');
|
||||
expect(textOutput.text()).toContain('问题:你是谁');
|
||||
expect(textOutput.text()).toContain('答案:你好');
|
||||
expect(textOutput.find('br').exists()).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import { mount } from '@vue/test-utils';
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import ExecResultItem from '../ExecResultItem.vue';
|
||||
|
||||
describe('execResultItem', () => {
|
||||
it('preserves line breaks for text results', () => {
|
||||
const wrapper = mount(ExecResultItem, {
|
||||
props: {
|
||||
contentType: 'text',
|
||||
defName: 'output',
|
||||
result: ['问题:你是谁\n答案:你好'],
|
||||
resultCount: 1,
|
||||
},
|
||||
});
|
||||
|
||||
const textResult = wrapper.get('.whitespace-pre-wrap');
|
||||
expect(textResult.text()).toContain('问题:你是谁\n答案:你好');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user