Prompt
+ {!isDiffVisible && references.length > 0 && (
+
+ Show resolved
+
+ )}
{!isDiffVisible && (
) : isRenderingMarkdown ? (
<>
-
+
- {promptText}
+ {displayText}
>
) : (
-
{prompt.prompt}
+
{displayText}
)}
+ {resolvedText !== null && (resolvedPreview?.resolved_references?.length ?? 0) > 0 && (
+
+ Includes:
+ {resolvedPreview?.resolved_references?.map((reference) => (
+
+ {reference.name} v{reference.version}
+ {reference.label ? ` (via ${reference.label})` : ''}
+
+ ))}
+
+ )}
+
+ {!isShowingResolvedPreview &&
}
+
{variables.length > 0 && (
Variables:
@@ -905,7 +946,16 @@ export function PromptEditForm({
selectedVersion: number | null
}): JSX.Element {
const { promptVariables, isNewPrompt, isRenderingMarkdown, promptForm, publishConflict } = useValues(llmPromptLogic)
- const { toggleMarkdownRendering } = useActions(llmPromptLogic)
+ const { toggleMarkdownRendering, setPromptFormValue } = useActions(llmPromptLogic)
+ const promptTextAreaRef = useRef
(null)
+
+ const insertReferenceTag = (tag: string): void => {
+ const textarea = promptTextAreaRef.current
+ const current = promptForm.prompt || ''
+ const start = textarea?.selectionStart ?? current.length
+ const end = textarea?.selectionEnd ?? current.length
+ setPromptFormValue('prompt', current.slice(0, start) + tag + current.slice(end))
+ }
return (
@@ -957,6 +1007,12 @@ export function PromptEditForm({
toggleMarkdownRendering()
}}
/>
+ {!isRenderingMarkdown && (
+
+ )}
}
help="Use {{variable_name}} to define variables that will be replaced when fetching the prompt from your backend."
@@ -967,6 +1023,7 @@ export function PromptEditForm({
) : (
)}
+
+
)