Skip to content

Commit f014ffc

Browse files
committed
fix(ui): 移除高级-变量模式中冗余的测试内容输入框
修复 v2.3.0 引入的 regression bug (1970a2b): - 高级-变量模式错误显示了测试内容输入框 - 该输入框在变量模式下是冗余的,用户应通过变量系统管理输入 变更内容: - ContextUserTestPanel: 移除 TestInputSection 及相关 props/emits - ContextUserWorkspace: 移除 testContent prop 和相关事件 - useContextUserTester: 移除 executeTest 的 testContent 参数 - App.vue: 移除 ContextUserWorkspace 的 test-content 绑定 基础模式的测试内容输入框保持不变
1 parent 1f1348a commit f014ffc

File tree

4 files changed

+2
-61
lines changed

4 files changed

+2
-61
lines changed

packages/ui/src/components/context-mode/ContextUserTestPanel.vue

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
11
<template>
22
<NFlex vertical :style="{ height: '100%' }">
3-
<!-- 测试内容输入区 (ContextUser专属,ConversationTestPanel没有这个) -->
4-
<div :style="{ flexShrink: 0, marginBottom: '16px' }">
5-
<TestInputSection
6-
v-model="testContentProxy"
7-
:label="t('test.content')"
8-
:placeholder="t('test.simpleMode.placeholder')"
9-
:disabled="isTestRunning"
10-
:mode="inputMode"
11-
:size="inputSize"
12-
:enable-fullscreen="enableFullscreen"
13-
/>
14-
</div>
15-
163
<!-- 变量值输入表单 -->
174
<div
185
v-if="showVariableForm"
@@ -228,7 +215,6 @@ import { useResponsive } from '../../composables/ui/useResponsive';
228215
import { usePerformanceMonitor } from "../../composables/performance/usePerformanceMonitor";
229216
import { useDebounceThrottle } from "../../composables/performance/useDebounceThrottle";
230217
import { useTestVariableManager } from "../../composables/variable/useTestVariableManager";
231-
import TestInputSection from "../TestInputSection.vue";
232218
import TestControlBar from "../TestControlBar.vue";
233219
import TestResultSection from "../TestResultSection.vue";
234220
@@ -245,13 +231,9 @@ const {
245231
shouldUseVerticalLayout,
246232
shouldUseCompactMode,
247233
buttonSize,
248-
inputSize,
249234
} = useResponsive();
250235
251236
interface Props {
252-
// 测试内容(ContextUser专属)
253-
testContent: string;
254-
255237
// 优化后的提示词(用于检测变量)
256238
optimizedPrompt?: string;
257239
@@ -265,11 +247,7 @@ interface Props {
265247
predefinedVariables?: Record<string, string>;
266248
temporaryVariables?: Record<string, string>;
267249
268-
// 功能开关
269-
enableFullscreen?: boolean;
270-
271250
// 布局配置
272-
inputMode?: "compact" | "normal";
273251
controlBarLayout?: "default" | "compact" | "minimal";
274252
buttonSize?: "small" | "medium" | "large";
275253
resultVerticalLayout?: boolean;
@@ -283,8 +261,6 @@ const props = withDefaults(defineProps<Props>(), {
283261
isTestRunning: false,
284262
isCompareMode: false,
285263
enableCompareMode: true,
286-
enableFullscreen: true,
287-
inputMode: "normal",
288264
controlBarLayout: "default",
289265
buttonSize: "medium",
290266
resultVerticalLayout: false,
@@ -295,7 +271,6 @@ const props = withDefaults(defineProps<Props>(), {
295271
});
296272
297273
const emit = defineEmits<{
298-
"update:testContent": [value: string];
299274
"update:isCompareMode": [value: boolean];
300275
test: [testVariables: Record<string, string>];
301276
"compare-toggle": [];
@@ -306,15 +281,6 @@ const emit = defineEmits<{
306281
"temporary-variables-clear": [];
307282
}>();
308283
309-
// 测试内容双向绑定
310-
const testContentProxy = computed({
311-
get: () => props.testContent,
312-
set: (value: string) => {
313-
emit("update:testContent", value);
314-
recordUpdate();
315-
},
316-
});
317-
318284
// 处理对比模式切换
319285
const handleCompareModeToggle = (value: boolean) => {
320286
emit("update:isCompareMode", value);
@@ -347,11 +313,9 @@ const primaryActionText = computed(() => {
347313
: t("test.startTest");
348314
});
349315
350-
// 主要操作按钮禁用状态(纯业务逻辑,无模式判断)
316+
// 主要操作按钮禁用状态
351317
const primaryActionDisabled = computed(() => {
352-
if (props.isTestRunning) return true;
353-
if (!props.testContent.trim()) return true; // 测试内容不能为空
354-
return false;
318+
return props.isTestRunning;
355319
});
356320
357321
const handleTest = throttle(

packages/ui/src/components/context-mode/ContextUserWorkspace.vue

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -143,17 +143,13 @@
143143
>
144144
<ContextUserTestPanel
145145
ref="testAreaPanelRef"
146-
:test-content="testContent"
147-
@update:testContent="emit('update:testContent', $event)"
148146
:optimized-prompt="contextUserOptimization.optimizedPrompt"
149147
:is-test-running="contextUserTester.testResults.isTestingOriginal || contextUserTester.testResults.isTestingOptimized"
150148
:is-compare-mode="isCompareMode"
151149
@update:isCompareMode="emit('update:isCompareMode', $event)"
152150
:global-variables="globalVariables"
153151
:predefined-variables="predefinedVariables"
154152
:temporary-variables="temporaryVariables"
155-
:enable-fullscreen="true"
156-
:input-mode="inputMode"
157153
:control-bar-layout="controlBarLayout"
158154
:button-size="buttonSize"
159155
:result-vertical-layout="resultVerticalLayout"
@@ -294,8 +290,6 @@ interface Props {
294290
selectedIterateTemplate: Template | null;
295291
296292
// --- 测试数据 ---
297-
/** 测试输入内容 */
298-
testContent: string;
299293
/** 是否启用对比模式 */
300294
isCompareMode: boolean;
301295
/** 是否正在执行测试(兼容性保留,实际由内部管理)*/
@@ -308,8 +302,6 @@ interface Props {
308302
predefinedVariables: Record<string, string>;
309303
310304
// --- 响应式布局配置 ---
311-
/** 输入模式 */
312-
inputMode?: "compact" | "normal";
313305
/** 控制栏布局 */
314306
controlBarLayout?: "default" | "compact" | "minimal";
315307
/** 按钮尺寸 */
@@ -328,7 +320,6 @@ interface ContextUserHistoryPayload {
328320
329321
const props = withDefaults(defineProps<Props>(), {
330322
isTestRunning: false,
331-
inputMode: "normal",
332323
controlBarLayout: "default",
333324
buttonSize: "medium",
334325
conversationMaxHeight: 300,
@@ -341,7 +332,6 @@ const props = withDefaults(defineProps<Props>(), {
341332
const emit = defineEmits<{
342333
// --- 数据更新事件 ---
343334
"update:selectedIterateTemplate": [value: Template | null];
344-
"update:testContent": [value: string];
345335
"update:isCompareMode": [value: boolean];
346336
347337
// --- 操作事件 ---
@@ -617,7 +607,6 @@ const handleTestWithVariables = async () => {
617607
await contextUserTester.executeTest(
618608
contextUserOptimization.prompt,
619609
contextUserOptimization.optimizedPrompt,
620-
props.testContent,
621610
props.isCompareMode,
622611
testVariables
623612
);

packages/ui/src/composables/prompt/useContextUserTester.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export interface UseContextUserTester {
3232
executeTest: (
3333
prompt: string,
3434
optimizedPrompt: string,
35-
testContent: string,
3635
isCompareMode: boolean,
3736
testVariables?: Record<string, string>
3837
) => Promise<void>
@@ -64,7 +63,6 @@ export interface UseContextUserTester {
6463
* await contextUserTester.executeTest(
6564
* prompt,
6665
* optimizedPrompt,
67-
* testContent,
6866
* isCompareMode,
6967
* testVariables
7068
* )
@@ -97,7 +95,6 @@ export function useContextUserTester(
9795
executeTest: async (
9896
prompt: string,
9997
optimizedPrompt: string,
100-
testContent: string,
10198
isCompareMode: boolean,
10299
testVariables?: Record<string, string>
103100
) => {
@@ -118,14 +115,12 @@ export function useContextUserTester(
118115
'original',
119116
prompt,
120117
optimizedPrompt,
121-
testContent,
122118
testVariables
123119
),
124120
state.testPromptWithType(
125121
'optimized',
126122
prompt,
127123
optimizedPrompt,
128-
testContent,
129124
testVariables
130125
)
131126
])
@@ -135,7 +130,6 @@ export function useContextUserTester(
135130
'optimized',
136131
prompt,
137132
optimizedPrompt,
138-
testContent,
139133
testVariables
140134
)
141135
}
@@ -148,7 +142,6 @@ export function useContextUserTester(
148142
type: 'original' | 'optimized',
149143
prompt: string,
150144
optimizedPrompt: string,
151-
testContent: string,
152145
testVars?: Record<string, string>
153146
) => {
154147
const isOriginal = type === 'original'

packages/web/src/App.vue

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,6 @@
283283
@update:selectedIterateTemplate="
284284
optimizer.selectedIterateTemplate = $event
285285
"
286-
:test-content="testContent"
287-
@update:testContent="testContent = $event"
288286
:is-compare-mode="isCompareMode"
289287
@update:isCompareMode="isCompareMode = $event"
290288
:global-variables="
@@ -293,9 +291,6 @@
293291
:predefined-variables="predefinedVariables"
294292
@variable-change="handleTestPanelVariableChange"
295293
@save-to-global="handleSaveToGlobal"
296-
:input-mode="
297-
responsiveLayout.recommendedInputMode.value
298-
"
299294
:control-bar-layout="
300295
responsiveLayout.recommendedControlBarLayout
301296
.value

0 commit comments

Comments
 (0)