feat: add context missing warning (#1384)

Co-authored-by: StyleZhang <jasonapring2015@outlook.com>
This commit is contained in:
Joel
2023-10-19 17:52:14 +08:00
committed by GitHub
parent ff527a0190
commit 08aa367892
9 changed files with 115 additions and 57 deletions

View File

@@ -49,6 +49,7 @@ export type PromptEditorProps = {
onChange?: (text: string) => void
onBlur?: () => void
contextBlock?: {
show?: boolean
selectable?: boolean
datasets: Dataset[]
onInsert?: () => void
@@ -82,6 +83,7 @@ const PromptEditor: FC<PromptEditorProps> = ({
onChange,
onBlur,
contextBlock = {
show: true,
selectable: true,
datasets: [],
onAddContext: () => {},
@@ -158,23 +160,30 @@ const PromptEditor: FC<PromptEditorProps> = ({
/>
<ComponentPicker
contextDisabled={!contextBlock.selectable}
contextShow={contextBlock.show}
historyDisabled={!historyBlock.selectable}
historyShow={historyBlock.show}
queryDisabled={!queryBlock.selectable}
queryShow={queryBlock.show}
/>
<VariablePicker items={variableBlock.variables} />
<ContextBlock
datasets={contextBlock.datasets}
onAddContext={contextBlock.onAddContext}
onInsert={contextBlock.onInsert}
onDelete={contextBlock.onDelete}
/>
<ContextBlockReplacementBlock
datasets={contextBlock.datasets}
onAddContext={contextBlock.onAddContext}
onInsert={contextBlock.onInsert}
/>
{
contextBlock.show && (
<>
<ContextBlock
datasets={contextBlock.datasets}
onAddContext={contextBlock.onAddContext}
onInsert={contextBlock.onInsert}
onDelete={contextBlock.onDelete}
/>
<ContextBlockReplacementBlock
datasets={contextBlock.datasets}
onAddContext={contextBlock.onAddContext}
onInsert={contextBlock.onInsert}
/>
</>
)
}
<VariableBlock />
{
historyBlock.show && (