fix(ui): 移除高级-变量模式中冗余的测试内容输入框
修复 v2.3.0 引入的 regression bug (1970a2b):
- 高级-变量模式错误显示了测试内容输入框
- 该输入框在变量模式下是冗余的,用户应通过变量系统管理输入
变更内容:
- ContextUserTestPanel: 移除 TestInputSection 及相关 props/emits
- ContextUserWorkspace: 移除 testContent prop 和相关事件
- useContextUserTester: 移除 executeTest 的 testContent 参数
- App.vue: 移除 ContextUserWorkspace 的 test-content 绑定
基础模式的测试内容输入框保持不变
This commit is contained in:
1 parent
1f1348a4b8
commit
f014ffc311
4 files changed
+2
-61
No files matched your search
@@ -1,18 +1,5 @@
|
||||
<template>
|
||||
<NFlex vertical :style="{ height: '100%' }">
|
||||
<!-- 测试内容输入区 (ContextUser专属,ConversationTestPanel没有这个) -->
|
||||
<div :style="{ flexShrink: 0, marginBottom: '16px' }">
|
||||
<TestInputSection
|
||||
v-model="testContentProxy"
|
||||
:label="t('test.content')"
|
||||
:placeholder="t('test.simpleMode.placeholder')"
|
||||
:disabled="isTestRunning"
|
||||
:mode="inputMode"
|
||||
:size="inputSize"
|
||||
:enable-fullscreen="enableFullscreen"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 变量值输入表单 -->
|
||||
<div
|
||||
v-if="showVariableForm"
|
||||
@@ -228,7 +215,6 @@ import { useResponsive } from '../../composables/ui/useResponsive';
|
||||
import { usePerformanceMonitor } from "../../composables/performance/usePerformanceMonitor";
|
||||
import { useDebounceThrottle } from "../../composables/performance/useDebounceThrottle";
|
||||
import { useTestVariableManager } from "../../composables/variable/useTestVariableManager";
|
||||
import TestInputSection from "../TestInputSection.vue";
|
||||
import TestControlBar from "../TestControlBar.vue";
|
||||
import TestResultSection from "../TestResultSection.vue";
|
||||
|
||||
@@ -245,13 +231,9 @@ const {
|
||||
shouldUseVerticalLayout,
|
||||
shouldUseCompactMode,
|
||||
buttonSize,
|
||||
inputSize,
|
||||
} = useResponsive();
|
||||
|
||||
interface Props {
|
||||
// 测试内容(ContextUser专属)
|
||||
testContent: string;
|
||||
|
||||
// 优化后的提示词(用于检测变量)
|
||||
optimizedPrompt?: string;
|
||||
|
||||
@@ -265,11 +247,7 @@ interface Props {
|
||||
predefinedVariables?: Record<string, string>;
|
||||
temporaryVariables?: Record<string, string>;
|
||||
|
||||
// 功能开关
|
||||
enableFullscreen?: boolean;
|
||||
|
||||
// 布局配置
|
||||
inputMode?: "compact" | "normal";
|
||||
controlBarLayout?: "default" | "compact" | "minimal";
|
||||
buttonSize?: "small" | "medium" | "large";
|
||||
resultVerticalLayout?: boolean;
|
||||
@@ -283,8 +261,6 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
isTestRunning: false,
|
||||
isCompareMode: false,
|
||||
enableCompareMode: true,
|
||||
enableFullscreen: true,
|
||||
inputMode: "normal",
|
||||
controlBarLayout: "default",
|
||||
buttonSize: "medium",
|
||||
resultVerticalLayout: false,
|
||||
@@ -295,7 +271,6 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
"update:testContent": [value: string];
|
||||
"update:isCompareMode": [value: boolean];
|
||||
test: [testVariables: Record<string, string>];
|
||||
"compare-toggle": [];
|
||||
@@ -306,15 +281,6 @@ const emit = defineEmits<{
|
||||
"temporary-variables-clear": [];
|
||||
}>();
|
||||
|
||||
// 测试内容双向绑定
|
||||
const testContentProxy = computed({
|
||||
get: () => props.testContent,
|
||||
set: (value: string) => {
|
||||
emit("update:testContent", value);
|
||||
recordUpdate();
|
||||
},
|
||||
});
|
||||
|
||||
// 处理对比模式切换
|
||||
const handleCompareModeToggle = (value: boolean) => {
|
||||
emit("update:isCompareMode", value);
|
||||
@@ -347,11 +313,9 @@ const primaryActionText = computed(() => {
|
||||
: t("test.startTest");
|
||||
});
|
||||
|
||||
// 主要操作按钮禁用状态(纯业务逻辑,无模式判断)
|
||||
// 主要操作按钮禁用状态
|
||||
const primaryActionDisabled = computed(() => {
|
||||
if (props.isTestRunning) return true;
|
||||
if (!props.testContent.trim()) return true; // 测试内容不能为空
|
||||
return false;
|
||||
return props.isTestRunning;
|
||||
});
|
||||
|
||||
const handleTest = throttle(
|
||||
|
||||
@@ -143,8 +143,6 @@
|
||||
>
|
||||
<ContextUserTestPanel
|
||||
ref="testAreaPanelRef"
|
||||
:test-content="testContent"
|
||||
@update:testContent="emit('update:testContent', $event)"
|
||||
:optimized-prompt="contextUserOptimization.optimizedPrompt"
|
||||
:is-test-running="contextUserTester.testResults.isTestingOriginal || contextUserTester.testResults.isTestingOptimized"
|
||||
:is-compare-mode="isCompareMode"
|
||||
@@ -152,8 +150,6 @@
|
||||
:global-variables="globalVariables"
|
||||
:predefined-variables="predefinedVariables"
|
||||
:temporary-variables="temporaryVariables"
|
||||
:enable-fullscreen="true"
|
||||
:input-mode="inputMode"
|
||||
:control-bar-layout="controlBarLayout"
|
||||
:button-size="buttonSize"
|
||||
:result-vertical-layout="resultVerticalLayout"
|
||||
@@ -294,8 +290,6 @@ interface Props {
|
||||
selectedIterateTemplate: Template | null;
|
||||
|
||||
// --- 测试数据 ---
|
||||
/** 测试输入内容 */
|
||||
testContent: string;
|
||||
/** 是否启用对比模式 */
|
||||
isCompareMode: boolean;
|
||||
/** 是否正在执行测试(兼容性保留,实际由内部管理)*/
|
||||
@@ -308,8 +302,6 @@ interface Props {
|
||||
predefinedVariables: Record<string, string>;
|
||||
|
||||
// --- 响应式布局配置 ---
|
||||
/** 输入模式 */
|
||||
inputMode?: "compact" | "normal";
|
||||
/** 控制栏布局 */
|
||||
controlBarLayout?: "default" | "compact" | "minimal";
|
||||
/** 按钮尺寸 */
|
||||
@@ -328,7 +320,6 @@ interface ContextUserHistoryPayload {
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
isTestRunning: false,
|
||||
inputMode: "normal",
|
||||
controlBarLayout: "default",
|
||||
buttonSize: "medium",
|
||||
conversationMaxHeight: 300,
|
||||
@@ -341,7 +332,6 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
const emit = defineEmits<{
|
||||
// --- 数据更新事件 ---
|
||||
"update:selectedIterateTemplate": [value: Template | null];
|
||||
"update:testContent": [value: string];
|
||||
"update:isCompareMode": [value: boolean];
|
||||
|
||||
// --- 操作事件 ---
|
||||
@@ -617,7 +607,6 @@ const handleTestWithVariables = async () => {
|
||||
await contextUserTester.executeTest(
|
||||
contextUserOptimization.prompt,
|
||||
contextUserOptimization.optimizedPrompt,
|
||||
props.testContent,
|
||||
props.isCompareMode,
|
||||
testVariables
|
||||
);
|
||||
|
||||
@@ -32,7 +32,6 @@ export interface UseContextUserTester {
|
||||
executeTest: (
|
||||
prompt: string,
|
||||
optimizedPrompt: string,
|
||||
testContent: string,
|
||||
isCompareMode: boolean,
|
||||
testVariables?: Record<string, string>
|
||||
) => Promise<void>
|
||||
@@ -64,7 +63,6 @@ export interface UseContextUserTester {
|
||||
* await contextUserTester.executeTest(
|
||||
* prompt,
|
||||
* optimizedPrompt,
|
||||
* testContent,
|
||||
* isCompareMode,
|
||||
* testVariables
|
||||
* )
|
||||
@@ -97,7 +95,6 @@ export function useContextUserTester(
|
||||
executeTest: async (
|
||||
prompt: string,
|
||||
optimizedPrompt: string,
|
||||
testContent: string,
|
||||
isCompareMode: boolean,
|
||||
testVariables?: Record<string, string>
|
||||
) => {
|
||||
@@ -118,14 +115,12 @@ export function useContextUserTester(
|
||||
'original',
|
||||
prompt,
|
||||
optimizedPrompt,
|
||||
testContent,
|
||||
testVariables
|
||||
),
|
||||
state.testPromptWithType(
|
||||
'optimized',
|
||||
prompt,
|
||||
optimizedPrompt,
|
||||
testContent,
|
||||
testVariables
|
||||
)
|
||||
])
|
||||
@@ -135,7 +130,6 @@ export function useContextUserTester(
|
||||
'optimized',
|
||||
prompt,
|
||||
optimizedPrompt,
|
||||
testContent,
|
||||
testVariables
|
||||
)
|
||||
}
|
||||
@@ -148,7 +142,6 @@ export function useContextUserTester(
|
||||
type: 'original' | 'optimized',
|
||||
prompt: string,
|
||||
optimizedPrompt: string,
|
||||
testContent: string,
|
||||
testVars?: Record<string, string>
|
||||
) => {
|
||||
const isOriginal = type === 'original'
|
||||
|
||||
@@ -283,8 +283,6 @@
|
||||
@update:selectedIterateTemplate="
|
||||
optimizer.selectedIterateTemplate = $event
|
||||
"
|
||||
:test-content="testContent"
|
||||
@update:testContent="testContent = $event"
|
||||
:is-compare-mode="isCompareMode"
|
||||
@update:isCompareMode="isCompareMode = $event"
|
||||
:global-variables="
|
||||
@@ -293,9 +291,6 @@
|
||||
:predefined-variables="predefinedVariables"
|
||||
@variable-change="handleTestPanelVariableChange"
|
||||
@save-to-global="handleSaveToGlobal"
|
||||
:input-mode="
|
||||
responsiveLayout.recommendedInputMode.value
|
||||
"
|
||||
:control-bar-layout="
|
||||
responsiveLayout.recommendedControlBarLayout
|
||||
.value
|
||||
|
||||
Reference in new issue
Block a user