@@ -15,6 +15,8 @@ import Markdown from "markdown-to-jsx";
1515// 引入SyntaxHighlighter的两种版本
1616import { Prism as SyntaxHighlighter } from "react-syntax-highlighter" ;
1717import { Light as LightSyntaxHighlighter } from "react-syntax-highlighter" ;
18+ // 导入预设提示弹窗组件
19+ import PresetPromptModal from "./PresetPromptModal" ;
1820
1921// 导入Prism的样式
2022import {
@@ -1129,6 +1131,9 @@ export default function AITestDialog({
11291131 useState ( false ) ;
11301132 const [ requirementContext , setRequirementContext ] = useState ( "" ) ;
11311133
1134+ // 添加预设提示弹窗状态
1135+ const [ showPresetPrompts , setShowPresetPrompts ] = useState ( false ) ;
1136+
11321137 // 自动滚动到当前AI回复的开头位置
11331138 const scrollToCurrentResponse = useCallback ( ( ) => {
11341139 if ( currentRoundRef . current ) {
@@ -2698,6 +2703,11 @@ ${aiResponse}
26982703 }
26992704 } ;
27002705
2706+ // 处理选择预设提示
2707+ const handleSelectPrompt = ( prompt : string ) => {
2708+ setCustomInput ( prompt ) ;
2709+ } ;
2710+
27012711 return (
27022712 < div className = "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50" >
27032713 < div className = "bg-white dark:bg-gray-800 w-full h-full flex flex-col" >
@@ -2839,7 +2849,6 @@ ${aiResponse}
28392849 ) }
28402850 </ div >
28412851
2842- { /* 底部输入区域 - ChatGPT风格 */ }
28432852 < div className = "p-3 sm:p-4 border-t border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800" >
28442853 < div className = "max-w-3xl mx-auto" >
28452854 < form onSubmit = { handleCustomInputSubmit } className = "relative" >
@@ -2873,29 +2882,53 @@ ${aiResponse}
28732882
28742883 < div className = "absolute right-2 bottom-2 sm:bottom-2.5 flex space-x-1" >
28752884 { ! isTesting && ! isComplete && (
2876- < button
2877- type = "button"
2878- onClick = { ( ) => setShowOptions ( ! showOptions ) }
2879- className = "p-1.5 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-600"
2880- title = {
2881- t ( "vectorReport.aiDialog.optionsTitle" ) || "显示建议问题"
2882- }
2883- >
2884- < svg
2885- xmlns = "http://www.w3.org/2000/svg"
2886- className = "h-5 w-5"
2887- fill = "none"
2888- viewBox = "0 0 24 24"
2889- stroke = "currentColor"
2885+ < >
2886+ < button
2887+ type = "button"
2888+ onClick = { ( ) => setShowPresetPrompts ( true ) }
2889+ className = "p-1.5 text-blue-600 hover:text-blue-700 dark:text-blue-500 dark:hover:text-blue-400 rounded-md hover:bg-gray-100 dark:hover:bg-gray-600"
2890+ title = { t ( "presetPrompts.button" ) || "提示" }
28902891 >
2891- < path
2892- strokeLinecap = "round"
2893- strokeLinejoin = "round"
2894- strokeWidth = { 2 }
2895- d = "M8 12h.01M12 12h.01M16 12h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
2896- />
2897- </ svg >
2898- </ button >
2892+ < svg
2893+ xmlns = "http://www.w3.org/2000/svg"
2894+ className = "h-5 w-5"
2895+ fill = "none"
2896+ viewBox = "0 0 24 24"
2897+ stroke = "currentColor"
2898+ >
2899+ < path
2900+ strokeLinecap = "round"
2901+ strokeLinejoin = "round"
2902+ strokeWidth = { 2 }
2903+ d = "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"
2904+ />
2905+ </ svg >
2906+ </ button >
2907+ < button
2908+ type = "button"
2909+ onClick = { ( ) => setShowOptions ( ! showOptions ) }
2910+ className = "p-1.5 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-600"
2911+ title = {
2912+ t ( "vectorReport.aiDialog.optionsTitle" ) ||
2913+ "显示建议问题"
2914+ }
2915+ >
2916+ < svg
2917+ xmlns = "http://www.w3.org/2000/svg"
2918+ className = "h-5 w-5"
2919+ fill = "none"
2920+ viewBox = "0 0 24 24"
2921+ stroke = "currentColor"
2922+ >
2923+ < path
2924+ strokeLinecap = "round"
2925+ strokeLinejoin = "round"
2926+ strokeWidth = { 2 }
2927+ d = "M8 12h.01M12 12h.01M16 12h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
2928+ />
2929+ </ svg >
2930+ </ button >
2931+ </ >
28992932 ) }
29002933
29012934 < button
@@ -2998,6 +3031,13 @@ ${aiResponse}
29983031 />
29993032 ) }
30003033 </ div >
3034+
3035+ { /* 添加预设提示弹窗 */ }
3036+ < PresetPromptModal
3037+ isOpen = { showPresetPrompts }
3038+ onClose = { ( ) => setShowPresetPrompts ( false ) }
3039+ onSelectPrompt = { handleSelectPrompt }
3040+ />
30013041 </ div >
30023042 ) ;
30033043}
0 commit comments