mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-13 17:22:37 +02:00
Suppress add new agent and add new tool by copilot if one exists already
This commit is contained in:
parent
c72728bf3d
commit
54e2574816
1 changed files with 13 additions and 3 deletions
|
|
@ -223,7 +223,11 @@ function AssistantMessage({
|
||||||
// Only apply, do not update appliedActions here
|
// Only apply, do not update appliedActions here
|
||||||
if (action.action === 'create_new') {
|
if (action.action === 'create_new') {
|
||||||
switch (action.config_type) {
|
switch (action.config_type) {
|
||||||
case 'agent':
|
case 'agent': {
|
||||||
|
// Prevent duplicate agent names
|
||||||
|
if (workflow.agents.some((agent: any) => agent.name === action.name)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'add_agent',
|
type: 'add_agent',
|
||||||
agent: {
|
agent: {
|
||||||
|
|
@ -232,7 +236,12 @@ function AssistantMessage({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'tool':
|
}
|
||||||
|
case 'tool': {
|
||||||
|
// Prevent duplicate tool names
|
||||||
|
if (workflow.tools.some((tool: any) => tool.name === action.name)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'add_tool',
|
type: 'add_tool',
|
||||||
tool: {
|
tool: {
|
||||||
|
|
@ -241,6 +250,7 @@ function AssistantMessage({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case 'prompt':
|
case 'prompt':
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'add_prompt',
|
type: 'add_prompt',
|
||||||
|
|
@ -276,7 +286,7 @@ function AssistantMessage({
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [dispatch]);
|
}, [dispatch, workflow.agents, workflow.tools]);
|
||||||
|
|
||||||
// Memoized handleApplyAll for useEffect dependencies
|
// Memoized handleApplyAll for useEffect dependencies
|
||||||
const handleApplyAll = useCallback(() => {
|
const handleApplyAll = useCallback(() => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue