mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-31 19:15:17 +02:00
fix chat reset bug on workflow save
This commit is contained in:
parent
17be8faf9e
commit
c08b82b6ad
1 changed files with 7 additions and 2 deletions
|
|
@ -39,6 +39,7 @@ interface StateItem {
|
||||||
publishSuccess: boolean;
|
publishSuccess: boolean;
|
||||||
pendingChanges: boolean;
|
pendingChanges: boolean;
|
||||||
chatKey: number;
|
chatKey: number;
|
||||||
|
lastUpdatedAt: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
|
|
@ -194,7 +195,7 @@ function reducer(state: State, action: Action): State {
|
||||||
newState = produce(state, draft => {
|
newState = produce(state, draft => {
|
||||||
draft.present.saving = action.saving;
|
draft.present.saving = action.saving;
|
||||||
draft.present.pendingChanges = action.saving;
|
draft.present.pendingChanges = action.saving;
|
||||||
draft.present.workflow.lastUpdatedAt = !action.saving ? new Date().toISOString() : state.present.workflow.lastUpdatedAt;
|
draft.present.lastUpdatedAt = !action.saving ? new Date().toISOString() : state.present.workflow.lastUpdatedAt;
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -257,6 +258,7 @@ function reducer(state: State, action: Action): State {
|
||||||
name: action.agent.name || newAgentName
|
name: action.agent.name || newAgentName
|
||||||
};
|
};
|
||||||
draft.pendingChanges = true;
|
draft.pendingChanges = true;
|
||||||
|
draft.chatKey++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "add_tool": {
|
case "add_tool": {
|
||||||
|
|
@ -281,6 +283,7 @@ function reducer(state: State, action: Action): State {
|
||||||
name: action.tool.name || newToolName
|
name: action.tool.name || newToolName
|
||||||
};
|
};
|
||||||
draft.pendingChanges = true;
|
draft.pendingChanges = true;
|
||||||
|
draft.chatKey++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "add_prompt": {
|
case "add_prompt": {
|
||||||
|
|
@ -303,6 +306,7 @@ function reducer(state: State, action: Action): State {
|
||||||
name: action.prompt.name || newPromptName
|
name: action.prompt.name || newPromptName
|
||||||
};
|
};
|
||||||
draft.pendingChanges = true;
|
draft.pendingChanges = true;
|
||||||
|
draft.chatKey++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "delete_agent":
|
case "delete_agent":
|
||||||
|
|
@ -493,6 +497,7 @@ export function WorkflowEditor({
|
||||||
publishSuccess: false,
|
publishSuccess: false,
|
||||||
pendingChanges: false,
|
pendingChanges: false,
|
||||||
chatKey: 0,
|
chatKey: 0,
|
||||||
|
lastUpdatedAt: workflow.lastUpdatedAt,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const [chatMessages, setChatMessages] = useState<z.infer<typeof apiV1.ChatMessage>[]>([]);
|
const [chatMessages, setChatMessages] = useState<z.infer<typeof apiV1.ChatMessage>[]>([]);
|
||||||
|
|
@ -726,7 +731,7 @@ export function WorkflowEditor({
|
||||||
<div>Saving...</div>
|
<div>Saving...</div>
|
||||||
</div>}
|
</div>}
|
||||||
{!state.present.saving && state.present.workflow && <div>
|
{!state.present.saving && state.present.workflow && <div>
|
||||||
Updated <RelativeTime date={new Date(state.present.workflow.lastUpdatedAt)} />
|
Updated <RelativeTime date={new Date(state.present.lastUpdatedAt)} />
|
||||||
</div>}
|
</div>}
|
||||||
</div>}
|
</div>}
|
||||||
{!isLive && <>
|
{!isLive && <>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue