Skip to content

Commit

Permalink
Removed prompt from the New Virtual Persona Form
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinyanakiev committed May 29, 2024
1 parent 176fcf9 commit 13533ef
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 42 deletions.
23 changes: 22 additions & 1 deletion src/core/apollo/generated/apollo-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type AccountKeySpecifier = (
| 'library'
| 'license'
| 'spaceID'
| 'subscriptions'
| AccountKeySpecifier
)[];
export type AccountFieldPolicy = {
Expand All @@ -24,6 +25,12 @@ export type AccountFieldPolicy = {
library?: FieldPolicy<any> | FieldReadFunction<any>;
license?: FieldPolicy<any> | FieldReadFunction<any>;
spaceID?: FieldPolicy<any> | FieldReadFunction<any>;
subscriptions?: FieldPolicy<any> | FieldReadFunction<any>;
};
export type AccountSubscriptionKeySpecifier = ('expires' | 'name' | AccountSubscriptionKeySpecifier)[];
export type AccountSubscriptionFieldPolicy = {
expires?: FieldPolicy<any> | FieldReadFunction<any>;
name?: FieldPolicy<any> | FieldReadFunction<any>;
};
export type ActivityCreatedSubscriptionResultKeySpecifier = (
| 'activity'
Expand Down Expand Up @@ -1345,6 +1352,7 @@ export type LicensePlanKeySpecifier = (
| 'enabled'
| 'id'
| 'isFree'
| 'licenseCredential'
| 'name'
| 'pricePerMonth'
| 'requiresContactSupport'
Expand All @@ -1357,6 +1365,7 @@ export type LicensePlanFieldPolicy = {
enabled?: FieldPolicy<any> | FieldReadFunction<any>;
id?: FieldPolicy<any> | FieldReadFunction<any>;
isFree?: FieldPolicy<any> | FieldReadFunction<any>;
licenseCredential?: FieldPolicy<any> | FieldReadFunction<any>;
name?: FieldPolicy<any> | FieldReadFunction<any>;
pricePerMonth?: FieldPolicy<any> | FieldReadFunction<any>;
requiresContactSupport?: FieldPolicy<any> | FieldReadFunction<any>;
Expand All @@ -1381,9 +1390,17 @@ export type LicensePolicyRuleFeatureFlagFieldPolicy = {
grantedPrivileges?: FieldPolicy<any> | FieldReadFunction<any>;
name?: FieldPolicy<any> | FieldReadFunction<any>;
};
export type LicensingKeySpecifier = ('authorization' | 'id' | 'plans' | 'policy' | LicensingKeySpecifier)[];
export type LicensingKeySpecifier = (
| 'authorization'
| 'basePlan'
| 'id'
| 'plans'
| 'policy'
| LicensingKeySpecifier
)[];
export type LicensingFieldPolicy = {
authorization?: FieldPolicy<any> | FieldReadFunction<any>;
basePlan?: FieldPolicy<any> | FieldReadFunction<any>;
id?: FieldPolicy<any> | FieldReadFunction<any>;
plans?: FieldPolicy<any> | FieldReadFunction<any>;
policy?: FieldPolicy<any> | FieldReadFunction<any>;
Expand Down Expand Up @@ -2992,6 +3009,10 @@ export type StrictTypedTypePolicies = {
keyFields?: false | AccountKeySpecifier | (() => undefined | AccountKeySpecifier);
fields?: AccountFieldPolicy;
};
AccountSubscription?: Omit<TypePolicy, 'fields' | 'keyFields'> & {
keyFields?: false | AccountSubscriptionKeySpecifier | (() => undefined | AccountSubscriptionKeySpecifier);
fields?: AccountSubscriptionFieldPolicy;
};
ActivityCreatedSubscriptionResult?: Omit<TypePolicy, 'fields' | 'keyFields'> & {
keyFields?:
| false
Expand Down
2 changes: 1 addition & 1 deletion src/core/apollo/generated/apollo-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15853,7 +15853,7 @@ export function refetchLegacySubspaceDashboardPageQuery(

export const CreateNewSpaceDocument = gql`
mutation CreateNewSpace($hostId: UUID_NAMEID!, $spaceData: CreateSpaceInput!, $planId: UUID) {
createAccount(accountData: { hostID: $hostId, spaceData: $spaceData, planID: $planId }) {
createAccount(accountData: { hostID: $hostId, spaceData: $spaceData, licensePlanID: $planId }) {
id
spaceID
}
Expand Down
82 changes: 63 additions & 19 deletions src/core/apollo/generated/graphql-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,23 @@ export type Account = {
license: License;
/** The ID for the root space for the Account . */
spaceID: Scalars['String'];
/** The subscriptions active for this Account. */
subscriptions: Array<AccountSubscription>;
};

export type AccountAuthorizationResetInput = {
/** The identifier of the Account whose Authorization Policy should be reset. */
accountID: Scalars['UUID_NAMEID'];
};

export type AccountSubscription = {
__typename?: 'AccountSubscription';
/** The expiry date of this subscription, null if it does never expire. */
expires?: Maybe<Scalars['DateTime']>;
/** The name of the Subscription. */
name: Scalars['String'];
};

export type ActivityCreatedSubscriptionInput = {
/** The collaboration on which to subscribe for new activity */
collaborationID: Scalars['UUID'];
Expand Down Expand Up @@ -1407,8 +1417,8 @@ export type ConvertSubsubspaceToSubspaceInput = {
export type CreateAccountInput = {
/** The host Organization or User for the account */
hostID: Scalars['UUID_NAMEID'];
/** The plan selected for the account */
planID?: InputMaybe<Scalars['UUID']>;
/** The license plan selected for the account */
licensePlanID?: InputMaybe<Scalars['UUID']>;
/** The root Space to be created. */
spaceData: CreateSpaceInput;
};
Expand Down Expand Up @@ -1738,7 +1748,6 @@ export type CreateVirtualPersonaInput = {
/** A readable identifier, unique within the containing scope. */
nameID: Scalars['NameID'];
profileData: CreateProfileInput;
prompt: Scalars['JSON'];
};

export type CreateWhiteboardInput = {
Expand Down Expand Up @@ -1768,7 +1777,7 @@ export type Credential = {
/** The User issuing the credential */
issuer?: Maybe<Scalars['UUID']>;
resourceID: Scalars['String'];
type: AuthorizationCredential;
type: CredentialType;
};

export type CredentialDefinition = {
Expand All @@ -1795,6 +1804,31 @@ export type CredentialMetadataOutput = {
uniqueType: Scalars['String'];
};

export enum CredentialType {
AccountHost = 'ACCOUNT_HOST',
BetaTester = 'BETA_TESTER',
GlobalAdmin = 'GLOBAL_ADMIN',
GlobalCommunityRead = 'GLOBAL_COMMUNITY_READ',
GlobalLicenseManager = 'GLOBAL_LICENSE_MANAGER',
GlobalRegistered = 'GLOBAL_REGISTERED',
GlobalSpacesReader = 'GLOBAL_SPACES_READER',
GlobalSupport = 'GLOBAL_SUPPORT',
InnovationPackProvider = 'INNOVATION_PACK_PROVIDER',
LicenseSpaceEnterprise = 'LICENSE_SPACE_ENTERPRISE',
LicenseSpaceFree = 'LICENSE_SPACE_FREE',
LicenseSpacePlus = 'LICENSE_SPACE_PLUS',
LicenseSpacePremium = 'LICENSE_SPACE_PREMIUM',
OrganizationAdmin = 'ORGANIZATION_ADMIN',
OrganizationAssociate = 'ORGANIZATION_ASSOCIATE',
OrganizationOwner = 'ORGANIZATION_OWNER',
SpaceAdmin = 'SPACE_ADMIN',
SpaceLead = 'SPACE_LEAD',
SpaceMember = 'SPACE_MEMBER',
SpaceSubspaceAdmin = 'SPACE_SUBSPACE_ADMIN',
UserGroupMember = 'USER_GROUP_MEMBER',
UserSelfManagement = 'USER_SELF_MANAGEMENT',
}

export type DeleteActorGroupInput = {
ID: Scalars['UUID'];
};
Expand Down Expand Up @@ -2299,6 +2333,13 @@ export type License = {
visibility: SpaceVisibility;
};

export enum LicenseCredential {
LicenseSpaceEnterprise = 'LICENSE_SPACE_ENTERPRISE',
LicenseSpaceFree = 'LICENSE_SPACE_FREE',
LicenseSpacePlus = 'LICENSE_SPACE_PLUS',
LicenseSpacePremium = 'LICENSE_SPACE_PREMIUM',
}

export type LicenseFeatureFlag = {
__typename?: 'LicenseFeatureFlag';
/** Is this feature flag enabled? */
Expand All @@ -2321,6 +2362,8 @@ export type LicensePlan = {
id: Scalars['UUID'];
/** Is this plan free? */
isFree: Scalars['Boolean'];
/** The credential to represent this plan */
licenseCredential: LicenseCredential;
/** The name of the License Plan */
name: Scalars['String'];
/** The price per month of this plan. */
Expand Down Expand Up @@ -2362,6 +2405,8 @@ export type Licensing = {
__typename?: 'Licensing';
/** The authorization rules for the entity */
authorization?: Maybe<Authorization>;
/** The base License Plan assigned to all Accounts in use on the platform. */
basePlan: LicensePlan;
/** The ID of the entity */
id: Scalars['UUID'];
/** The License Plans in use on the platform. */
Expand Down Expand Up @@ -5478,7 +5523,6 @@ export type UpdateVirtualPersonaInput = {
nameID?: InputMaybe<Scalars['NameID']>;
/** The Profile of this entity. */
profileData?: InputMaybe<UpdateProfileInput>;
prompt: Scalars['JSON'];
};

export type UpdateVisualInput = {
Expand Down Expand Up @@ -5939,7 +5983,7 @@ export type UserAgentSsiFragment = {
id: string;
did?: string | undefined;
credentials?:
| Array<{ __typename?: 'Credential'; id: string; resourceID: string; type: AuthorizationCredential }>
| Array<{ __typename?: 'Credential'; id: string; resourceID: string; type: CredentialType }>
| undefined;
verifiedCredentials?:
| Array<{
Expand Down Expand Up @@ -5972,7 +6016,7 @@ export type UserSsiQuery = {
id: string;
did?: string | undefined;
credentials?:
| Array<{ __typename?: 'Credential'; id: string; resourceID: string; type: AuthorizationCredential }>
| Array<{ __typename?: 'Credential'; id: string; resourceID: string; type: CredentialType }>
| undefined;
verifiedCredentials?:
| Array<{
Expand Down Expand Up @@ -14324,7 +14368,7 @@ export type CommunityPageMembersFragment = {
__typename?: 'Agent';
id: string;
credentials?:
| Array<{ __typename?: 'Credential'; id: string; type: AuthorizationCredential; resourceID: string }>
| Array<{ __typename?: 'Credential'; id: string; type: CredentialType; resourceID: string }>
| undefined;
};
profile: {
Expand Down Expand Up @@ -15087,7 +15131,7 @@ export type ContributorsPageUsersQuery = {
__typename?: 'Agent';
id: string;
credentials?:
| Array<{ __typename?: 'Credential'; id: string; type: AuthorizationCredential; resourceID: string }>
| Array<{ __typename?: 'Credential'; id: string; type: CredentialType; resourceID: string }>
| undefined;
};
userProfile: {
Expand Down Expand Up @@ -15167,7 +15211,7 @@ export type UserContributorPaginatedFragment = {
__typename?: 'Agent';
id: string;
credentials?:
| Array<{ __typename?: 'Credential'; id: string; type: AuthorizationCredential; resourceID: string }>
| Array<{ __typename?: 'Credential'; id: string; type: CredentialType; resourceID: string }>
| undefined;
};
userProfile: {
Expand Down Expand Up @@ -15205,7 +15249,7 @@ export type UserContributorFragment = {
__typename?: 'Agent';
id: string;
credentials?:
| Array<{ __typename?: 'Credential'; id: string; type: AuthorizationCredential; resourceID: string }>
| Array<{ __typename?: 'Credential'; id: string; type: CredentialType; resourceID: string }>
| undefined;
};
userProfile: {
Expand Down Expand Up @@ -16334,7 +16378,7 @@ export type UserAgentFragment = {
id: string;
did?: string | undefined;
credentials?:
| Array<{ __typename?: 'Credential'; id: string; resourceID: string; type: AuthorizationCredential }>
| Array<{ __typename?: 'Credential'; id: string; resourceID: string; type: CredentialType }>
| undefined;
};
};
Expand All @@ -16351,7 +16395,7 @@ export type UserDetailsFragment = {
accountUpn: string;
agent: {
__typename?: 'Agent';
credentials?: Array<{ __typename?: 'Credential'; type: AuthorizationCredential; resourceID: string }> | undefined;
credentials?: Array<{ __typename?: 'Credential'; type: CredentialType; resourceID: string }> | undefined;
};
profile: {
__typename?: 'Profile';
Expand Down Expand Up @@ -16464,7 +16508,7 @@ export type CreateUserMutation = {
accountUpn: string;
agent: {
__typename?: 'Agent';
credentials?: Array<{ __typename?: 'Credential'; type: AuthorizationCredential; resourceID: string }> | undefined;
credentials?: Array<{ __typename?: 'Credential'; type: CredentialType; resourceID: string }> | undefined;
};
profile: {
__typename?: 'Profile';
Expand Down Expand Up @@ -16521,7 +16565,7 @@ export type CreateUserNewRegistrationMutation = {
accountUpn: string;
agent: {
__typename?: 'Agent';
credentials?: Array<{ __typename?: 'Credential'; type: AuthorizationCredential; resourceID: string }> | undefined;
credentials?: Array<{ __typename?: 'Credential'; type: CredentialType; resourceID: string }> | undefined;
};
profile: {
__typename?: 'Profile';
Expand Down Expand Up @@ -16656,7 +16700,7 @@ export type UpdateUserMutation = {
accountUpn: string;
agent: {
__typename?: 'Agent';
credentials?: Array<{ __typename?: 'Credential'; type: AuthorizationCredential; resourceID: string }> | undefined;
credentials?: Array<{ __typename?: 'Credential'; type: CredentialType; resourceID: string }> | undefined;
};
profile: {
__typename?: 'Profile';
Expand Down Expand Up @@ -16727,7 +16771,7 @@ export type UserQuery = {
id: string;
did?: string | undefined;
credentials?:
| Array<{ __typename?: 'Credential'; type: AuthorizationCredential; resourceID: string; id: string }>
| Array<{ __typename?: 'Credential'; type: CredentialType; resourceID: string; id: string }>
| undefined;
};
profile: {
Expand Down Expand Up @@ -16817,7 +16861,7 @@ export type UserProfileQuery = {
id: string;
did?: string | undefined;
credentials?:
| Array<{ __typename?: 'Credential'; type: AuthorizationCredential; resourceID: string; id: string }>
| Array<{ __typename?: 'Credential'; type: CredentialType; resourceID: string; id: string }>
| undefined;
};
profile: {
Expand Down Expand Up @@ -16952,7 +16996,7 @@ export type UserProviderQuery = {
id: string;
did?: string | undefined;
credentials?:
| Array<{ __typename?: 'Credential'; type: AuthorizationCredential; resourceID: string; id: string }>
| Array<{ __typename?: 'Credential'; type: CredentialType; resourceID: string; id: string }>
| undefined;
};
profile: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mutation CreateNewSpace($hostId: UUID_NAMEID!, $spaceData: CreateSpaceInput!, $planId: UUID) {
createAccount(accountData: { hostID: $hostId, spaceData: $spaceData, planID: $planId }) {
createAccount(accountData: { hostID: $hostId, spaceData: $spaceData, licensePlanID: $planId }) {
id
spaceID
}
Expand Down
34 changes: 14 additions & 20 deletions src/domain/platform/admin/virtual-contributors/NewPersonaForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ interface NewPersonaFormValues {
displayName: string;
nameId: string;
description: string;
prompt: string;
engine: VirtualContributorEngine;
}

Expand All @@ -41,7 +40,6 @@ const NewPersonaForm = ({ parentPagePath }: NewPersonaFormProps) => {
const initialValues = {
displayName: '',
nameId: '',
prompt: '',
description: '',
engine: VirtualContributorEngine.Expert,
};
Expand All @@ -53,25 +51,22 @@ const NewPersonaForm = ({ parentPagePath }: NewPersonaFormProps) => {
navigateBack();
};

const [handleSubmit] = useLoadingState(
async ({ displayName, prompt, engine, nameId, description }: NewPersonaFormValues) => {
await createPersona({
variables: {
virtualPersonaData: {
prompt,
nameID: nameId,
profileData: {
displayName,
description,
},
engine,
const [handleSubmit] = useLoadingState(async ({ displayName, engine, nameId, description }: NewPersonaFormValues) => {
await createPersona({
variables: {
virtualPersonaData: {
nameID: nameId,
profileData: {
displayName,
description,
},
engine,
},
});
notify('Persona Created Successfully!', 'success');
navigateBack();
}
);
},
});
notify('Persona Created Successfully!', 'success');
navigateBack();
});

const engines = useMemo(
() =>
Expand All @@ -93,7 +88,6 @@ const NewPersonaForm = ({ parentPagePath }: NewPersonaFormProps) => {
<Gutters>
<FormikInputField title={t('common.title')} name="displayName" />
<FormikInputField title={t('components.nameSegment.nameID.title')} name="nameId" />
<FormikInputField multiline title={t('common.prompt')} name="prompt" rows={10} />
<FormikMarkdownField title={t('common.description')} name="description" />
<FormikSelect
title={t('pages.admin.virtualContributors.virtualPersonas.selectEngine')}
Expand Down

0 comments on commit 13533ef

Please sign in to comment.