File tree Expand file tree Collapse file tree
examples/playground-react/client/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44import { useState , useEffect , useRef } from 'react' ;
55import { useApp } from '../context' ;
66import { FaChevronDown , FaChevronUp } from 'react-icons/fa' ;
7+ import { renderMarkdown } from '../utils' ;
78
89export function SystemPrompt ( ) {
910 const {
@@ -166,9 +167,25 @@ export function SystemPrompt() {
166167 autoFocus
167168 rows = { 4 }
168169 />
170+ ) : systemMsg ?. text ?. trim ( ) ? (
171+ < div
172+ className = "system-prompt-pinned-display"
173+ onClick = { startEdit }
174+ onKeyDown = { ( e ) => {
175+ if ( e . key === 'Enter' || e . key === ' ' ) {
176+ e . preventDefault ( ) ;
177+ startEdit ( ) ;
178+ }
179+ } }
180+ tabIndex = { 4 }
181+ role = "button"
182+ style = { { cursor : 'pointer' } }
183+ aria-label = "Edit system prompt"
184+ dangerouslySetInnerHTML = { { __html : renderMarkdown ( systemMsg . text ) } }
185+ />
169186 ) : (
170- < div
171- className = "system-prompt-pinned-display"
187+ < div
188+ className = "system-prompt-pinned-display system-prompt-empty"
172189 onClick = { startEdit }
173190 onKeyDown = { ( e ) => {
174191 if ( e . key === 'Enter' || e . key === ' ' ) {
@@ -181,7 +198,7 @@ export function SystemPrompt() {
181198 style = { { cursor : 'pointer' } }
182199 aria-label = "Edit system prompt"
183200 >
184- { systemMsg ?. text || < em style = { { color : '#999' } } > Click to add system prompt...</ em > }
201+ Click to add system prompt...
185202 </ div >
186203 ) }
187204 </ div >
You can’t perform that action at this time.
0 commit comments