File tree 4 files changed +35
-1
lines changed
public/locales/translation
4 files changed +35
-1
lines changed Original file line number Diff line number Diff line change 32
32
show_system_prompt : Show system prompt
33
33
system_prompt : System Prompt
34
34
title : Chat
35
+ view_prompt_examples : View Prompt Examples
35
36
common :
36
37
cancel : Cancel
37
38
clear : Clear
Original file line number Diff line number Diff line change 30
30
show_system_prompt : システムプロンプトの表示
31
31
system_prompt : システムプロンプト
32
32
title : チャット
33
+ view_prompt_examples : プロンプト例を見る
33
34
common :
34
35
cancel : キャンセル
35
36
clear : クリア
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ type Props = BaseProps & {
32
32
systemContextId : string ,
33
33
title : string
34
34
) => Promise < void > ;
35
+ forceExpand : number | null ;
35
36
} ;
36
37
37
38
const PromptList : React . FC < Props > = ( props ) => {
@@ -42,11 +43,29 @@ const PromptList: React.FC<Props> = (props) => {
42
43
// PromptList is fixed for use on the chat page
43
44
const { getModelId } = useChat ( '/chat' ) ;
44
45
const modelId = getModelId ( ) ;
46
+ const [ previousForceExpanded , setPreviousForceExpanded ] = useState <
47
+ number | null
48
+ > ( null ) ;
45
49
46
50
const prompter = useMemo ( ( ) => {
47
51
return getPrompter ( modelId ) ;
48
52
} , [ modelId ] ) ;
49
53
54
+ useEffect ( ( ) => {
55
+ if (
56
+ props . forceExpand !== null &&
57
+ previousForceExpanded !== props . forceExpand
58
+ ) {
59
+ setPreviousForceExpanded ( props . forceExpand ) ;
60
+ setExpanded ( true ) ;
61
+ }
62
+ } , [
63
+ props . forceExpand ,
64
+ previousForceExpanded ,
65
+ setPreviousForceExpanded ,
66
+ setExpanded ,
67
+ ] ) ;
68
+
50
69
// To access the upper setExpanded, nest the component
51
70
const Item : React . FC < PromptListItem > = ( props ) => {
52
71
const onClickPrompt = useCallback ( ( ) => {
Original file line number Diff line number Diff line change @@ -157,6 +157,9 @@ const ChatPage: React.FC = () => {
157
157
> ( undefined ) ;
158
158
const [ showSetting , setShowSetting ] = useState ( false ) ;
159
159
const { t } = useTranslation ( ) ;
160
+ const [ forceExpandPromptList , setForceExpandPromptList ] = useState <
161
+ number | null
162
+ > ( null ) ;
160
163
161
164
useEffect ( ( ) => {
162
165
// On the conversation history page, do not change the system prompt even if the model is changed
@@ -433,12 +436,21 @@ const ChatPage: React.FC = () => {
433
436
</ div >
434
437
435
438
{ ( ( isEmpty && ! loadingMessages ) || loadingMessages ) && (
436
- < div className = "relative flex h-[calc(100vh-13rem)] flex-col items-center justify-center" >
439
+ < div className = "relative flex h-[calc(100vh-13rem)] flex-col items-center justify-center gap-y-4 " >
437
440
< BedrockIcon
438
441
className = { `fill-gray-400 ${
439
442
loadingMessages ? 'animate-pulse' : ''
440
443
} `}
441
444
/>
445
+
446
+ < Button
447
+ className = "text-sm"
448
+ outlined
449
+ onClick = { ( ) => {
450
+ setForceExpandPromptList ( Math . random ( ) ) ;
451
+ } } >
452
+ { t ( 'chat.view_prompt_examples' ) }
453
+ </ Button >
442
454
</ div >
443
455
) }
444
456
@@ -557,6 +569,7 @@ const ChatPage: React.FC = () => {
557
569
systemContextList = { systemContextList as SystemContext [ ] }
558
570
onClickDeleteSystemContext = { onClickDeleteSystemContext }
559
571
onClickUpdateSystemContext = { onClickUpdateSystemContext }
572
+ forceExpand = { forceExpandPromptList }
560
573
/>
561
574
) }
562
575
You can’t perform that action at this time.
0 commit comments