Merge branch 'dev' into feat/Multitenant-login-OIDC

This commit is contained in:
Ruben Talstra 2025-05-22 10:50:18 +02:00 committed by GitHub
commit edaa357e9d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 2362 additions and 16 deletions

View file

@ -187,6 +187,8 @@ export const agents = ({ path = '', options }: { path?: string; options?: object
return url;
};
export const revertAgentVersion = (agent_id: string) => `${agents({ path: `${agent_id}/revert` })}`;
export const files = () => '/api/files';
export const images = () => `${files()}/images`;

View file

@ -431,6 +431,14 @@ export const listAgents = (params: a.AgentListParams): Promise<a.AgentListRespon
);
};
export const revertAgentVersion = ({
agent_id,
version_index,
}: {
agent_id: string;
version_index: number;
}): Promise<a.Agent> => request.post(endpoints.revertAgentVersion(agent_id), { version_index });
/* Tools */
export const getAvailableAgentTools = (): Promise<s.TPlugin[]> => {

View file

@ -65,6 +65,7 @@ export enum MutationKeys {
updateAgentAction = 'updateAgentAction',
deleteAction = 'deleteAction',
deleteAgentAction = 'deleteAgentAction',
revertAgentVersion = 'revertAgentVersion',
deleteUser = 'deleteUser',
updateRole = 'updateRole',
enableTwoFactor = 'enableTwoFactor',

View file

@ -222,6 +222,7 @@ export type Agent = {
hide_sequential_outputs?: boolean;
artifacts?: ArtifactModes;
recursion_limit?: number;
version?: number;
};
export type TAgentsMap = Record<string, Agent | undefined>;

View file

@ -129,7 +129,20 @@ export type UpdateAgentVariables = {
data: AgentUpdateParams;
};
export type UpdateAgentMutationOptions = MutationOptions<Agent, UpdateAgentVariables>;
export type DuplicateVersionError = Error & {
statusCode?: number;
details?: {
duplicateVersion?: any;
versionIndex?: number
}
};
export type UpdateAgentMutationOptions = MutationOptions<
Agent,
UpdateAgentVariables,
unknown,
DuplicateVersionError
>;
export type DuplicateAgentBody = {
agent_id: string;
@ -159,6 +172,13 @@ export type DeleteAgentActionVariables = {
export type DeleteAgentActionOptions = MutationOptions<void, DeleteAgentActionVariables>;
export type RevertAgentVersionVariables = {
agent_id: string;
version_index: number;
};
export type RevertAgentVersionOptions = MutationOptions<Agent, RevertAgentVersionVariables>;
export type DeleteConversationOptions = MutationOptions<
types.TDeleteConversationResponse,
types.TDeleteConversationRequest

View file

@ -26,6 +26,7 @@ export interface IAgent extends Omit<Document, 'model'> {
conversation_starters?: string[];
tool_resources?: unknown;
projectIds?: Types.ObjectId[];
versions?: Omit<IAgent, 'versions'>[];
}
const agentSchema = new Schema<IAgent>(
@ -115,6 +116,10 @@ const agentSchema = new Schema<IAgent>(
ref: 'Project',
index: true,
},
versions: {
type: [Schema.Types.Mixed],
default: [],
},
},
{
timestamps: true,