59672e3e34
# Introduction Closes https://github.com/twentyhq/core-team-issues/issues/1980 In this PR we migrate the agent from v1 to v2. ## New FlatRoleTargetByAgentIdMaps Derivated the `flatRoleTargetMaps` to be building a `flatRoleTargetByAgentIdMaps` to ease retrieving a roleId to associate to an agent ## Coverage Added strong coverage on both failing and successful CRU agents operations --------- Co-authored-by: Weiko <corentin@twenty.com>
41 lines
859 B
TypeScript
41 lines
859 B
TypeScript
import { type AgentDTO } from 'src/engine/metadata-modules/ai/ai-agent/dtos/agent.dto';
|
|
import { type FlatAgentWithRoleId } from 'src/engine/metadata-modules/flat-agent/types/flat-agent.type';
|
|
|
|
export const fromFlatAgentWithRoleIdToAgentDto = ({
|
|
applicationId,
|
|
createdAt,
|
|
description,
|
|
evaluationInputs,
|
|
icon,
|
|
id,
|
|
isCustom,
|
|
label,
|
|
modelConfiguration,
|
|
modelId,
|
|
name,
|
|
prompt,
|
|
responseFormat,
|
|
standardId,
|
|
updatedAt,
|
|
workspaceId,
|
|
roleId,
|
|
}: FlatAgentWithRoleId): AgentDTO => ({
|
|
createdAt,
|
|
description: description ?? undefined,
|
|
evaluationInputs,
|
|
id,
|
|
isCustom,
|
|
label,
|
|
modelConfiguration: modelConfiguration ?? undefined,
|
|
modelId,
|
|
name,
|
|
prompt,
|
|
responseFormat,
|
|
standardId,
|
|
updatedAt,
|
|
workspaceId,
|
|
applicationId: applicationId ?? undefined,
|
|
icon: icon ?? undefined,
|
|
roleId: roleId ?? undefined,
|
|
});
|