feat(ui): Add dynamic prompt config
This commit is contained in:
@@ -94,9 +94,10 @@ const AgentForm = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleAddDynamicPrompt = () => {
|
const handleAddDynamicPrompt = () => {
|
||||||
|
console.log('Adding dynamic prompt');
|
||||||
setFormData({
|
setFormData({
|
||||||
...formData,
|
...formData,
|
||||||
connectors: [
|
dynamicPrompts: [
|
||||||
...(formData.dynamicPrompts || []),
|
...(formData.dynamicPrompts || []),
|
||||||
{ type: '', config: '{}' }
|
{ type: '', config: '{}' }
|
||||||
]
|
]
|
||||||
@@ -108,7 +109,7 @@ const AgentForm = ({
|
|||||||
updatedDynamicPrompts.splice(index, 1);
|
updatedDynamicPrompts.splice(index, 1);
|
||||||
setFormData({
|
setFormData({
|
||||||
...formData,
|
...formData,
|
||||||
DynamicPrompts: updatedDynamicPrompts,
|
dynamicPrompts: updatedDynamicPrompts,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -266,7 +267,15 @@ const AgentForm = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={{ display: activeSection === 'prompts-section' ? 'block' : 'none' }}>
|
<div style={{ display: activeSection === 'prompts-section' ? 'block' : 'none' }}>
|
||||||
<PromptsGoalsSection formData={formData} handleInputChange={handleInputChange} isGroupForm={isGroupForm} metadata={metadata} />
|
<PromptsGoalsSection
|
||||||
|
formData={formData}
|
||||||
|
handleInputChange={handleInputChange}
|
||||||
|
isGroupForm={isGroupForm}
|
||||||
|
metadata={metadata}
|
||||||
|
onAddPrompt={handleAddDynamicPrompt}
|
||||||
|
onRemovePrompt={handleRemoveDynamicPrompt}
|
||||||
|
handleDynamicPromptChange={handleDynamicPromptChange}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={{ display: activeSection === 'advanced-section' ? 'block' : 'none' }}>
|
<div style={{ display: activeSection === 'advanced-section' ? 'block' : 'none' }}>
|
||||||
@@ -309,7 +318,15 @@ const AgentForm = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={{ display: activeSection === 'prompts-section' ? 'block' : 'none' }}>
|
<div style={{ display: activeSection === 'prompts-section' ? 'block' : 'none' }}>
|
||||||
<PromptsGoalsSection formData={formData} handleInputChange={handleInputChange} isGroupForm={isGroupForm} metadata={metadata} />
|
<PromptsGoalsSection
|
||||||
|
formData={formData}
|
||||||
|
handleInputChange={handleInputChange}
|
||||||
|
isGroupForm={isGroupForm}
|
||||||
|
metadata={metadata}
|
||||||
|
onAddPrompt={handleAddDynamicPrompt}
|
||||||
|
onRemovePrompt={handleRemoveDynamicPrompt}
|
||||||
|
handleDynamicPromptChange={handleDynamicPromptChange}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={{ display: activeSection === 'advanced-section' ? 'block' : 'none' }}>
|
<div style={{ display: activeSection === 'advanced-section' ? 'block' : 'none' }}>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import FormFieldDefinition from '../common/FormFieldDefinition';
|
import FormFieldDefinition from '../common/FormFieldDefinition';
|
||||||
import DynamicPromptForm from '../DynamicPromptForm';
|
import DynamicPromptForm from '../DynamicPromptForm';
|
||||||
|
import DynamicPromptForm from '../DynamicPromptForm';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prompts & Goals section of the agent form
|
* Prompts & Goals section of the agent form
|
||||||
@@ -17,7 +18,8 @@ const PromptsGoalsSection = ({
|
|||||||
isGroupForm,
|
isGroupForm,
|
||||||
metadata,
|
metadata,
|
||||||
onAddPrompt,
|
onAddPrompt,
|
||||||
onRemovePrompt
|
onRemovePrompt,
|
||||||
|
handleDynamicPromptChange
|
||||||
}) => {
|
}) => {
|
||||||
// Get fields based on metadata and form context
|
// Get fields based on metadata and form context
|
||||||
const getFields = () => {
|
const getFields = () => {
|
||||||
@@ -66,10 +68,10 @@ const PromptsGoalsSection = ({
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<DynamicPromptForm
|
<DynamicPromptForm
|
||||||
prompts={formData.prompts || []}
|
prompts={formData.dynamicPrompts || []}
|
||||||
onAddPrompt={onAddPrompt}
|
onAddPrompt={onAddPrompt}
|
||||||
onRemovePrompt={onRemovePrompt}
|
onRemovePrompt={onRemovePrompt}
|
||||||
onChange={handleInputChange}
|
onChange={handleDynamicPromptChange}
|
||||||
fieldGroups={metadata?.dynamicPrompts || []}
|
fieldGroups={metadata?.dynamicPrompts || []}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user