-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4468 from alkem-io/server-4401-ingest-space-feedback
Server 4401 ingest space feedback
- Loading branch information
Showing
39 changed files
with
580 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,12 @@ RABBITMQ_HOST=rabbitmq | |
RABBITMQ_USER=alkemio-admin | ||
RABBITMQ_PASSWORD=alkemio! | ||
RABBITMQ_PORT=5672 | ||
|
||
|
||
RABBITMQ_INGEST_SPACE_QUEUE=virtual-contributor-ingest-space | ||
RABBITMQ_INGEST_SPACE_RESULT_QUEUE=virtual-contributor-ingest-space-result | ||
RABBITMQ_EVENT_BUS_EXCHANGE=event-bus | ||
|
||
ALKEMIO_SERVER_ENDPOINT=http://host.docker.internal:4000/graphql | ||
KRATOS_API_PUBLIC_ENDPOINT=http://kratos:4433/ | ||
[email protected] | ||
|
@@ -61,5 +67,4 @@ VECTOR_DB_PORT=8000 | |
[email protected] | ||
AUTH_ADMIN_PASSWORD=password | ||
|
||
|
||
LOCAL_STORAGE_PATH=/storage | ||
LOCAL_STORAGE_PATH=/storage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { registerEnumType } from '@nestjs/graphql'; | ||
|
||
export enum VirtualContributorStatus { | ||
INITIALIZING = 'initializing', | ||
READY = 'ready', | ||
} | ||
|
||
registerEnumType(VirtualContributorStatus, { | ||
name: 'VirtualContributorStatus', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...domain/community/virtual-contributor/dto/virtual.contributor.updated.subscription.args.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { ArgsType, Field } from '@nestjs/graphql'; | ||
import { UUID_NAMEID } from '@domain/common/scalars'; | ||
|
||
@ArgsType() | ||
export class VirtualContributorUpdatedSubscriptionArgs { | ||
@Field(() => UUID_NAMEID, { | ||
description: 'The Virtual Contributor to receive the events for.', | ||
nullable: false, | ||
}) | ||
virtualContributorID!: string; | ||
} |
13 changes: 13 additions & 0 deletions
13
...main/community/virtual-contributor/dto/virtual.contributor.updated.subscription.result.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Field, ObjectType } from '@nestjs/graphql'; | ||
import { IVirtualContributor } from '../virtual.contributor.interface'; | ||
|
||
@ObjectType('VirtualContributorUpdatedSubscriptionResult', { | ||
description: 'The result from a Virtual Contributor update', | ||
}) | ||
export class VirtualContributorUpdatedSubscriptionResult { | ||
@Field(() => IVirtualContributor, { | ||
description: 'The Virtual Contributor that was updated', | ||
nullable: false, | ||
}) | ||
virtualContributor!: IVirtualContributor; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
src/domain/community/virtual-contributor/virtual.contributor.resolver.subscriptions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { Args, Resolver } from '@nestjs/graphql'; | ||
import { CurrentUser, TypedSubscription } from '@src/common/decorators'; | ||
import { VirtualContributorService } from './virtual.contributor.service'; | ||
import { AgentInfo } from '@core/authentication.agent.info/agent.info'; | ||
import { AuthorizationService } from '@core/authorization/authorization.service'; | ||
import { AuthorizationPrivilege, LogContext } from '@common/enums'; | ||
import { Inject, LoggerService, UseGuards } from '@nestjs/common'; | ||
import { GraphqlGuard } from '@core/authorization'; | ||
import { SubscriptionReadService } from '@services/subscriptions/subscription-service'; | ||
import { WINSTON_MODULE_NEST_PROVIDER } from 'nest-winston'; | ||
import { VirtualContributorUpdatedSubscriptionArgs } from './dto/virtual.contributor.updated.subscription.args'; | ||
import { VirtualContributorUpdatedSubscriptionResult } from './dto/virtual.contributor.updated.subscription.result'; | ||
import { VirtualContributorUpdatedSubscriptionPayload } from '@services/subscriptions/subscription-service/dto'; | ||
|
||
@Resolver() | ||
export class VirtualContributorResolverSubscriptions { | ||
constructor( | ||
private virtualContributorService: VirtualContributorService, | ||
private authorizationService: AuthorizationService, | ||
private subscriptionService: SubscriptionReadService, | ||
@Inject(WINSTON_MODULE_NEST_PROVIDER) | ||
private readonly logger: LoggerService | ||
) {} | ||
|
||
@UseGuards(GraphqlGuard) | ||
@TypedSubscription< | ||
VirtualContributorUpdatedSubscriptionPayload, | ||
VirtualContributorUpdatedSubscriptionArgs | ||
>(() => VirtualContributorUpdatedSubscriptionResult, { | ||
description: 'Receive updates on virtual contributors', | ||
resolve(this: VirtualContributorResolverSubscriptions, payload) { | ||
return payload; | ||
}, | ||
async filter( | ||
this: VirtualContributorResolverSubscriptions, | ||
payload, | ||
variables | ||
) { | ||
const isMatch = | ||
variables.virtualContributorID === payload.virtualContributor.nameID; | ||
|
||
this.logger.verbose?.( | ||
`[Filtering VirtualContribuor updated event id '${payload.eventID}'; VC id ${payload.virtualContributor.nameID}- match=${isMatch}`, | ||
LogContext.SUBSCRIPTIONS | ||
); | ||
return isMatch; | ||
}, | ||
}) | ||
async virtualContributorUpdated( | ||
@CurrentUser() agentInfo: AgentInfo, | ||
@Args({ nullable: false }) | ||
{ virtualContributorID }: VirtualContributorUpdatedSubscriptionArgs | ||
) { | ||
const vc = | ||
await this.virtualContributorService.getVirtualContributorOrFail( | ||
virtualContributorID | ||
); | ||
|
||
this.authorizationService.grantAccessOrFail( | ||
agentInfo, | ||
vc.authorization, | ||
AuthorizationPrivilege.READ, | ||
`subscription to Virtual Contributor updates on: ${vc.id}` | ||
); | ||
|
||
this.logger.verbose?.( | ||
`Subscribing for updates for VC ${virtualContributorID}`, | ||
LogContext.SUBSCRIPTIONS | ||
); | ||
|
||
return this.subscriptionService.subscribeToVirtualContributorUpdated(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/migrations/1724333243087-addBoKLastUpdateToAiPersonaService.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class AddBoKLastUpdateToAiPersonaService1724333243087 | ||
implements MigrationInterface | ||
{ | ||
name = 'AddBoKLastUpdateToAiPersonaService1724333243087'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`ALTER TABLE \`ai_persona_service\` ADD \`bodyOfKnowledgeLastUpdated\` datetime DEFAULT NULL` | ||
); | ||
|
||
await queryRunner.query( | ||
`UPDATE \`ai_persona_service\` SET \`bodyOfKnowledgeLastUpdated\`= NOW()` | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`ALTER TABLE \`ai_persona_service\` DROP COLUMN \`bodyOfKnowledgeLastUpdated\`` | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.