Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async Chat Guidance engine using Matrix rooms instead of direct querying #7188

Merged
merged 29 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2954d6c
update GQL schema
valeksiev Nov 13, 2024
5f85c40
Guidance room usage for chat widget
ccanos Nov 14, 2024
54c60d8
Asyncronous chat guidance - matrix room
ccanos Nov 14, 2024
9b9904a
Merge remote-tracking branch 'origin/develop' into alkemio-1456/async…
valeksiev Nov 18, 2024
d9e9e41
Merge remote-tracking branch 'origin/develop' into alkemio-1456/async…
ccanos Nov 18, 2024
042c2c9
Merge remote-tracking branch 'origin/develop' into alkemio-1456/async…
ccanos Nov 18, 2024
a096171
Create guidance room on demand
ccanos Nov 18, 2024
5cc1773
Merge branch 'alkemio-1456/async-guidance' of github.com:alkem-io/cli…
valeksiev Nov 19, 2024
9d4c52c
Wrapping up
ccanos Nov 19, 2024
d50c241
Merge branch 'develop' into alkemio-1456/async-guidance
ccanos Nov 19, 2024
1e66801
graphql files tweaks
ccanos Nov 19, 2024
26f1bd5
fix some race condition
ccanos Nov 19, 2024
a20fd07
Address coderabbit comment
ccanos Nov 19, 2024
46ccdf2
Merge branch 'alkemio-1456/async-guidance' of github.com:alkem-io/cli…
valeksiev Nov 20, 2024
21ad5de
Merge remote-tracking branch 'origin/develop' into alkemio-1456/async…
valeksiev Nov 20, 2024
dafe3d2
Merge remote-tracking branch 'origin/develop' into alkemio-1456/async…
valeksiev Nov 22, 2024
5ce378f
fix global import
valeksiev Nov 22, 2024
1c96b02
Merge remote-tracking branch 'origin/develop' into alkemio-1456/async…
ccanos Nov 22, 2024
2f36dae
clean up
ccanos Nov 22, 2024
f7cf9f8
Fix badge count
ccanos Nov 22, 2024
58c3cc6
Merge branch 'alkemio-1456/async-guidance' of github.com:alkem-io/cli…
valeksiev Nov 26, 2024
bfd0f3a
Merge branch 'alkemio-1456/async-guidance' of github.com:alkem-io/cli…
valeksiev Nov 26, 2024
f5cc2bd
Merge remote-tracking branch 'origin/develop' into alkemio-1456/async…
valeksiev Nov 26, 2024
2bec901
Merge remote-tracking branch 'origin/develop' into alkemio-1456/async…
valeksiev Nov 27, 2024
fbc8ec6
Merge remote-tracking branch 'origin/develop' into alkemio-1456/async…
valeksiev Dec 2, 2024
bb15ddd
Merge branch 'develop' into alkemio-1456/async-guidance
ccanos Dec 3, 2024
f4df8eb
Merge branch 'develop' into alkemio-1456/async-guidance
ccanos Dec 4, 2024
c3ea3f4
Merge branch 'develop' into alkemio-1456/async-guidance
valentinyanakiev Dec 6, 2024
9e99937
Merge branch 'develop' into alkemio-1456/async-guidance
valentinyanakiev Dec 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 10 additions & 22 deletions src/core/apollo/generated/apollo-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,6 @@ export type AiPersonaServiceFieldPolicy = {
export type AiServerKeySpecifier = (
| 'aiPersonaService'
| 'aiPersonaServices'
| 'askAiPersonaServiceQuestion'
| 'authorization'
| 'createdDate'
| 'defaultAiPersonaService'
Expand All @@ -567,7 +566,6 @@ export type AiServerKeySpecifier = (
export type AiServerFieldPolicy = {
aiPersonaService?: FieldPolicy<any> | FieldReadFunction<any>;
aiPersonaServices?: FieldPolicy<any> | FieldReadFunction<any>;
askAiPersonaServiceQuestion?: FieldPolicy<any> | FieldReadFunction<any>;
authorization?: FieldPolicy<any> | FieldReadFunction<any>;
createdDate?: FieldPolicy<any> | FieldReadFunction<any>;
defaultAiPersonaService?: FieldPolicy<any> | FieldReadFunction<any>;
Expand Down Expand Up @@ -1918,22 +1916,17 @@ export type MessageFieldPolicy = {
timestamp?: FieldPolicy<any> | FieldReadFunction<any>;
};
export type MessageAnswerQuestionKeySpecifier = (
| 'answer'
| 'error'
| 'id'
| 'question'
| 'sources'
| 'success'
| MessageAnswerQuestionKeySpecifier
)[];
export type MessageAnswerQuestionFieldPolicy = {
answer?: FieldPolicy<any> | FieldReadFunction<any>;
error?: FieldPolicy<any> | FieldReadFunction<any>;
id?: FieldPolicy<any> | FieldReadFunction<any>;
question?: FieldPolicy<any> | FieldReadFunction<any>;
sources?: FieldPolicy<any> | FieldReadFunction<any>;
};
export type MessageAnswerToQuestionSourceKeySpecifier = ('title' | 'uri' | MessageAnswerToQuestionSourceKeySpecifier)[];
export type MessageAnswerToQuestionSourceFieldPolicy = {
title?: FieldPolicy<any> | FieldReadFunction<any>;
uri?: FieldPolicy<any> | FieldReadFunction<any>;
success?: FieldPolicy<any> | FieldReadFunction<any>;
};
export type MetadataKeySpecifier = ('services' | MetadataKeySpecifier)[];
export type MetadataFieldPolicy = {
Expand All @@ -1957,6 +1950,7 @@ export type MutationKeySpecifier = (
| 'aiServerPersonaServiceIngest'
| 'aiServerUpdateAiPersonaService'
| 'applyForEntryRoleOnRoleSet'
| 'askChatGuidanceQuestion'
| 'assignLicensePlanToAccount'
| 'assignLicensePlanToSpace'
| 'assignOrganizationRoleToUser'
Expand All @@ -1980,6 +1974,7 @@ export type MutationKeySpecifier = (
| 'createActor'
| 'createActorGroup'
| 'createCalloutOnCollaboration'
| 'createChatGuidanceRoom'
| 'createContributionOnCallout'
| 'createDiscussion'
| 'createEventOnCalendar'
Expand Down Expand Up @@ -2120,6 +2115,7 @@ export type MutationFieldPolicy = {
aiServerPersonaServiceIngest?: FieldPolicy<any> | FieldReadFunction<any>;
aiServerUpdateAiPersonaService?: FieldPolicy<any> | FieldReadFunction<any>;
applyForEntryRoleOnRoleSet?: FieldPolicy<any> | FieldReadFunction<any>;
askChatGuidanceQuestion?: FieldPolicy<any> | FieldReadFunction<any>;
assignLicensePlanToAccount?: FieldPolicy<any> | FieldReadFunction<any>;
assignLicensePlanToSpace?: FieldPolicy<any> | FieldReadFunction<any>;
assignOrganizationRoleToUser?: FieldPolicy<any> | FieldReadFunction<any>;
Expand All @@ -2143,6 +2139,7 @@ export type MutationFieldPolicy = {
createActor?: FieldPolicy<any> | FieldReadFunction<any>;
createActorGroup?: FieldPolicy<any> | FieldReadFunction<any>;
createCalloutOnCollaboration?: FieldPolicy<any> | FieldReadFunction<any>;
createChatGuidanceRoom?: FieldPolicy<any> | FieldReadFunction<any>;
createContributionOnCallout?: FieldPolicy<any> | FieldReadFunction<any>;
createDiscussion?: FieldPolicy<any> | FieldReadFunction<any>;
createEventOnCalendar?: FieldPolicy<any> | FieldReadFunction<any>;
Expand Down Expand Up @@ -2630,8 +2627,6 @@ export type QueryKeySpecifier = (
| 'adminCommunicationMembership'
| 'adminCommunicationOrphanedUsage'
| 'aiServer'
| 'askChatGuidanceQuestion'
| 'askVirtualContributorQuestion'
| 'exploreSpaces'
| 'getSupportedVerifiedCredentialMetadata'
| 'inputCreator'
Expand Down Expand Up @@ -2669,8 +2664,6 @@ export type QueryFieldPolicy = {
adminCommunicationMembership?: FieldPolicy<any> | FieldReadFunction<any>;
adminCommunicationOrphanedUsage?: FieldPolicy<any> | FieldReadFunction<any>;
aiServer?: FieldPolicy<any> | FieldReadFunction<any>;
askChatGuidanceQuestion?: FieldPolicy<any> | FieldReadFunction<any>;
askVirtualContributorQuestion?: FieldPolicy<any> | FieldReadFunction<any>;
exploreSpaces?: FieldPolicy<any> | FieldReadFunction<any>;
getSupportedVerifiedCredentialMetadata?: FieldPolicy<any> | FieldReadFunction<any>;
inputCreator?: FieldPolicy<any> | FieldReadFunction<any>;
Expand Down Expand Up @@ -3533,6 +3526,7 @@ export type UserKeySpecifier = (
| 'directRooms'
| 'email'
| 'firstName'
| 'guidanceRoom'
| 'id'
| 'isContactable'
| 'lastName'
Expand All @@ -3555,6 +3549,7 @@ export type UserFieldPolicy = {
directRooms?: FieldPolicy<any> | FieldReadFunction<any>;
email?: FieldPolicy<any> | FieldReadFunction<any>;
firstName?: FieldPolicy<any> | FieldReadFunction<any>;
guidanceRoom?: FieldPolicy<any> | FieldReadFunction<any>;
id?: FieldPolicy<any> | FieldReadFunction<any>;
isContactable?: FieldPolicy<any> | FieldReadFunction<any>;
lastName?: FieldPolicy<any> | FieldReadFunction<any>;
Expand Down Expand Up @@ -4270,13 +4265,6 @@ export type StrictTypedTypePolicies = {
keyFields?: false | MessageAnswerQuestionKeySpecifier | (() => undefined | MessageAnswerQuestionKeySpecifier);
fields?: MessageAnswerQuestionFieldPolicy;
};
MessageAnswerToQuestionSource?: Omit<TypePolicy, 'fields' | 'keyFields'> & {
keyFields?:
| false
| MessageAnswerToQuestionSourceKeySpecifier
| (() => undefined | MessageAnswerToQuestionSourceKeySpecifier);
fields?: MessageAnswerToQuestionSourceFieldPolicy;
};
Metadata?: Omit<TypePolicy, 'fields' | 'keyFields'> & {
keyFields?: false | MetadataKeySpecifier | (() => undefined | MetadataKeySpecifier);
fields?: MetadataFieldPolicy;
Expand Down
211 changes: 181 additions & 30 deletions src/core/apollo/generated/apollo-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21653,70 +21653,221 @@ export type ResetChatGuidanceMutationOptions = Apollo.BaseMutationOptions<
SchemaTypes.ResetChatGuidanceMutation,
SchemaTypes.ResetChatGuidanceMutationVariables
>;
export const CreateGuidanceRoomDocument = gql`
mutation createGuidanceRoom {
createChatGuidanceRoom {
id
}
}
`;
export type CreateGuidanceRoomMutationFn = Apollo.MutationFunction<
SchemaTypes.CreateGuidanceRoomMutation,
SchemaTypes.CreateGuidanceRoomMutationVariables
>;

/**
* __useCreateGuidanceRoomMutation__
*
* To run a mutation, you first call `useCreateGuidanceRoomMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useCreateGuidanceRoomMutation` returns a tuple that includes:
* - A mutate function that you can call at any time to execute the mutation
* - An object with fields that represent the current status of the mutation's execution
*
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
*
* @example
* const [createGuidanceRoomMutation, { data, loading, error }] = useCreateGuidanceRoomMutation({
* variables: {
* },
* });
*/
export function useCreateGuidanceRoomMutation(
baseOptions?: Apollo.MutationHookOptions<
SchemaTypes.CreateGuidanceRoomMutation,
SchemaTypes.CreateGuidanceRoomMutationVariables
>
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useMutation<SchemaTypes.CreateGuidanceRoomMutation, SchemaTypes.CreateGuidanceRoomMutationVariables>(
CreateGuidanceRoomDocument,
options
);
}

export type CreateGuidanceRoomMutationHookResult = ReturnType<typeof useCreateGuidanceRoomMutation>;
export type CreateGuidanceRoomMutationResult = Apollo.MutationResult<SchemaTypes.CreateGuidanceRoomMutation>;
export type CreateGuidanceRoomMutationOptions = Apollo.BaseMutationOptions<
SchemaTypes.CreateGuidanceRoomMutation,
SchemaTypes.CreateGuidanceRoomMutationVariables
>;
export const AskChatGuidanceQuestionDocument = gql`
query askChatGuidanceQuestion($chatData: ChatGuidanceInput!) {
mutation askChatGuidanceQuestion($chatData: ChatGuidanceInput!) {
askChatGuidanceQuestion(chatData: $chatData) {
id
answer
question
sources {
uri
title
success
}
}
`;
export type AskChatGuidanceQuestionMutationFn = Apollo.MutationFunction<
SchemaTypes.AskChatGuidanceQuestionMutation,
SchemaTypes.AskChatGuidanceQuestionMutationVariables
>;

/**
* __useAskChatGuidanceQuestionMutation__
*
* To run a mutation, you first call `useAskChatGuidanceQuestionMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useAskChatGuidanceQuestionMutation` returns a tuple that includes:
* - A mutate function that you can call at any time to execute the mutation
* - An object with fields that represent the current status of the mutation's execution
*
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
*
* @example
* const [askChatGuidanceQuestionMutation, { data, loading, error }] = useAskChatGuidanceQuestionMutation({
* variables: {
* chatData: // value for 'chatData'
* },
* });
*/
export function useAskChatGuidanceQuestionMutation(
baseOptions?: Apollo.MutationHookOptions<
SchemaTypes.AskChatGuidanceQuestionMutation,
SchemaTypes.AskChatGuidanceQuestionMutationVariables
>
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useMutation<
SchemaTypes.AskChatGuidanceQuestionMutation,
SchemaTypes.AskChatGuidanceQuestionMutationVariables
>(AskChatGuidanceQuestionDocument, options);
}

export type AskChatGuidanceQuestionMutationHookResult = ReturnType<typeof useAskChatGuidanceQuestionMutation>;
export type AskChatGuidanceQuestionMutationResult = Apollo.MutationResult<SchemaTypes.AskChatGuidanceQuestionMutation>;
export type AskChatGuidanceQuestionMutationOptions = Apollo.BaseMutationOptions<
SchemaTypes.AskChatGuidanceQuestionMutation,
SchemaTypes.AskChatGuidanceQuestionMutationVariables
>;
export const GuidanceRoomIdDocument = gql`
query GuidanceRoomId {
me {
user {
id
guidanceRoom {
id
}
}
}
}
`;

/**
* __useAskChatGuidanceQuestionQuery__
* __useGuidanceRoomIdQuery__
*
* To run a query within a React component, call `useAskChatGuidanceQuestionQuery` and pass it any options that fit your needs.
* When your component renders, `useAskChatGuidanceQuestionQuery` returns an object from Apollo Client that contains loading, error, and data properties
* To run a query within a React component, call `useGuidanceRoomIdQuery` and pass it any options that fit your needs.
* When your component renders, `useGuidanceRoomIdQuery` returns an object from Apollo Client that contains loading, error, and data properties
* you can use to render your UI.
*
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
*
* @example
* const { data, loading, error } = useAskChatGuidanceQuestionQuery({
* const { data, loading, error } = useGuidanceRoomIdQuery({
* variables: {
* chatData: // value for 'chatData'
* },
* });
*/
export function useAskChatGuidanceQuestionQuery(
export function useGuidanceRoomIdQuery(
baseOptions?: Apollo.QueryHookOptions<SchemaTypes.GuidanceRoomIdQuery, SchemaTypes.GuidanceRoomIdQueryVariables>
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useQuery<SchemaTypes.GuidanceRoomIdQuery, SchemaTypes.GuidanceRoomIdQueryVariables>(
GuidanceRoomIdDocument,
options
);
}

export function useGuidanceRoomIdLazyQuery(
baseOptions?: Apollo.LazyQueryHookOptions<SchemaTypes.GuidanceRoomIdQuery, SchemaTypes.GuidanceRoomIdQueryVariables>
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<SchemaTypes.GuidanceRoomIdQuery, SchemaTypes.GuidanceRoomIdQueryVariables>(
GuidanceRoomIdDocument,
options
);
}

export type GuidanceRoomIdQueryHookResult = ReturnType<typeof useGuidanceRoomIdQuery>;
export type GuidanceRoomIdLazyQueryHookResult = ReturnType<typeof useGuidanceRoomIdLazyQuery>;
export type GuidanceRoomIdQueryResult = Apollo.QueryResult<
SchemaTypes.GuidanceRoomIdQuery,
SchemaTypes.GuidanceRoomIdQueryVariables
>;
export function refetchGuidanceRoomIdQuery(variables?: SchemaTypes.GuidanceRoomIdQueryVariables) {
return { query: GuidanceRoomIdDocument, variables: variables };
}

export const GuidanceRoomMessagesDocument = gql`
query GuidanceRoomMessages($roomId: UUID!) {
lookup {
room(ID: $roomId) {
...CommentsWithMessages
}
}
}
${CommentsWithMessagesFragmentDoc}
`;

/**
* __useGuidanceRoomMessagesQuery__
*
* To run a query within a React component, call `useGuidanceRoomMessagesQuery` and pass it any options that fit your needs.
* When your component renders, `useGuidanceRoomMessagesQuery` returns an object from Apollo Client that contains loading, error, and data properties
* you can use to render your UI.
*
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
*
* @example
* const { data, loading, error } = useGuidanceRoomMessagesQuery({
* variables: {
* roomId: // value for 'roomId'
* },
* });
*/
export function useGuidanceRoomMessagesQuery(
baseOptions: Apollo.QueryHookOptions<
SchemaTypes.AskChatGuidanceQuestionQuery,
SchemaTypes.AskChatGuidanceQuestionQueryVariables
SchemaTypes.GuidanceRoomMessagesQuery,
SchemaTypes.GuidanceRoomMessagesQueryVariables
>
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useQuery<SchemaTypes.AskChatGuidanceQuestionQuery, SchemaTypes.AskChatGuidanceQuestionQueryVariables>(
AskChatGuidanceQuestionDocument,
return Apollo.useQuery<SchemaTypes.GuidanceRoomMessagesQuery, SchemaTypes.GuidanceRoomMessagesQueryVariables>(
GuidanceRoomMessagesDocument,
options
);
}

export function useAskChatGuidanceQuestionLazyQuery(
export function useGuidanceRoomMessagesLazyQuery(
baseOptions?: Apollo.LazyQueryHookOptions<
SchemaTypes.AskChatGuidanceQuestionQuery,
SchemaTypes.AskChatGuidanceQuestionQueryVariables
SchemaTypes.GuidanceRoomMessagesQuery,
SchemaTypes.GuidanceRoomMessagesQueryVariables
>
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<
SchemaTypes.AskChatGuidanceQuestionQuery,
SchemaTypes.AskChatGuidanceQuestionQueryVariables
>(AskChatGuidanceQuestionDocument, options);
return Apollo.useLazyQuery<SchemaTypes.GuidanceRoomMessagesQuery, SchemaTypes.GuidanceRoomMessagesQueryVariables>(
GuidanceRoomMessagesDocument,
options
);
}

export type AskChatGuidanceQuestionQueryHookResult = ReturnType<typeof useAskChatGuidanceQuestionQuery>;
export type AskChatGuidanceQuestionLazyQueryHookResult = ReturnType<typeof useAskChatGuidanceQuestionLazyQuery>;
export type AskChatGuidanceQuestionQueryResult = Apollo.QueryResult<
SchemaTypes.AskChatGuidanceQuestionQuery,
SchemaTypes.AskChatGuidanceQuestionQueryVariables
export type GuidanceRoomMessagesQueryHookResult = ReturnType<typeof useGuidanceRoomMessagesQuery>;
export type GuidanceRoomMessagesLazyQueryHookResult = ReturnType<typeof useGuidanceRoomMessagesLazyQuery>;
export type GuidanceRoomMessagesQueryResult = Apollo.QueryResult<
SchemaTypes.GuidanceRoomMessagesQuery,
SchemaTypes.GuidanceRoomMessagesQueryVariables
>;
export function refetchAskChatGuidanceQuestionQuery(variables: SchemaTypes.AskChatGuidanceQuestionQueryVariables) {
return { query: AskChatGuidanceQuestionDocument, variables: variables };
export function refetchGuidanceRoomMessagesQuery(variables: SchemaTypes.GuidanceRoomMessagesQueryVariables) {
return { query: GuidanceRoomMessagesDocument, variables: variables };
}

export const JourneyRouteResolverDocument = gql`
Expand Down
Loading