feat(core): Update LLM applications building support (no-changelog) (#7710)

extracted out of #7336

---------

Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
Co-authored-by: Oleg Ivaniv <me@olegivaniv.com>
Co-authored-by: Alex Grozav <alex@grozav.com>
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-11-28 16:47:28 +01:00
committed by GitHub
parent 4a89504d54
commit 117962d473
58 changed files with 1135 additions and 183 deletions

View File

@@ -1,5 +1,5 @@
import { Request } from 'express';
import { Service } from 'typedi';
import { Container, Service } from 'typedi';
import { v4 as uuid } from 'uuid';
import config from '@/config';
import type { Role } from '@db/entities/Role';
@@ -13,8 +13,9 @@ import { License } from '@/License';
import { LICENSE_FEATURES, inE2ETests } from '@/constants';
import { NoAuthRequired, Patch, Post, RestController } from '@/decorators';
import type { UserSetupPayload } from '@/requests';
import type { BooleanLicenseFeature } from '@/Interfaces';
import type { BooleanLicenseFeature, IPushDataType } from '@/Interfaces';
import { MfaService } from '@/Mfa/mfa.service';
import { Push } from '@/push';
if (!inE2ETests) {
console.error('E2E endpoints only allowed during E2E tests');
@@ -51,6 +52,16 @@ type ResetRequest = Request<
}
>;
type PushRequest = Request<
{},
{},
{
type: IPushDataType;
sessionId: string;
data: object;
}
>;
@Service()
@NoAuthRequired()
@RestController('/e2e')
@@ -95,6 +106,17 @@ export class E2EController {
await this.setupUserManagement(req.body.owner, req.body.members);
}
@Post('/push')
async push(req: PushRequest) {
const pushInstance = Container.get(Push);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const sessionId = Object.keys(pushInstance.getBackend().connections as object)[0];
pushInstance.send(req.body.type, req.body.data, sessionId);
}
@Patch('/feature')
setFeature(req: Request<{}, {}, { feature: BooleanLicenseFeature; enabled: boolean }>) {
const { enabled, feature } = req.body;