mirror of
https://github.com/docmost/docmost.git
synced 2025-11-18 01:51:12 +10:00
WIP
This commit is contained in:
@ -30,6 +30,10 @@
|
||||
"test:e2e": "jest --config test/jest-e2e.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ai-sdk/amazon-bedrock": "^3.0.35",
|
||||
"@ai-sdk/azure": "^2.0.47",
|
||||
"@ai-sdk/google": "^2.0.18",
|
||||
"@ai-sdk/openai": "^2.0.46",
|
||||
"@aws-sdk/client-s3": "3.701.0",
|
||||
"@aws-sdk/lib-storage": "3.701.0",
|
||||
"@aws-sdk/s3-request-presigner": "3.701.0",
|
||||
@ -56,6 +60,8 @@
|
||||
"@react-email/components": "0.0.28",
|
||||
"@react-email/render": "1.0.2",
|
||||
"@socket.io/redis-adapter": "^8.3.0",
|
||||
"ai": "^5.0.65",
|
||||
"ai-sdk-ollama": "^0.12.0",
|
||||
"bcrypt": "^5.1.1",
|
||||
"bullmq": "^5.61.0",
|
||||
"cache-manager": "^6.4.3",
|
||||
@ -75,7 +81,6 @@
|
||||
"nanoid": "3.3.11",
|
||||
"nestjs-kysely": "^1.2.0",
|
||||
"nodemailer": "^7.0.3",
|
||||
"openai": "^5.12.2",
|
||||
"openid-client": "^5.7.1",
|
||||
"otpauth": "^9.4.0",
|
||||
"p-limit": "^6.2.0",
|
||||
|
||||
@ -20,7 +20,7 @@ import {
|
||||
WorkspaceInvitations,
|
||||
Workspaces,
|
||||
} from '@docmost/db/types/db';
|
||||
import { Embeddings } from '@docmost/db/types/embeddings.types';
|
||||
import { PageEmbeddings } from '@docmost/db/types/embeddings.types';
|
||||
|
||||
export interface DbInterface {
|
||||
attachments: Attachments;
|
||||
@ -32,7 +32,7 @@ export interface DbInterface {
|
||||
fileTasks: FileTasks;
|
||||
groups: Groups;
|
||||
groupUsers: GroupUsers;
|
||||
embeddings: Embeddings;
|
||||
pageEmbeddings: PageEmbeddings;
|
||||
pageHistory: PageHistory;
|
||||
pages: Pages;
|
||||
shares: Shares;
|
||||
|
||||
@ -1,13 +1,15 @@
|
||||
import { Json, Timestamp, Generated } from '@docmost/db/types/db';
|
||||
|
||||
// embeddings type
|
||||
export interface Embeddings {
|
||||
export interface PageEmbeddings {
|
||||
id: Generated<string>;
|
||||
pageId: string;
|
||||
spaceId: string;
|
||||
modelName: string;
|
||||
modelDimensions: number;
|
||||
workspaceId: string;
|
||||
attachmentId: string;
|
||||
embedding: number[] | Buffer | string;
|
||||
embedding: number[];
|
||||
chunkIndex: Generated<number>;
|
||||
chunkStart: Generated<number>;
|
||||
chunkLength: Generated<number>;
|
||||
|
||||
@ -21,7 +21,7 @@ import {
|
||||
UserMfa as _UserMFA,
|
||||
ApiKeys,
|
||||
} from './db';
|
||||
import { Embeddings } from '@docmost/db/types/embeddings.types';
|
||||
import { PageEmbeddings } from '@docmost/db/types/embeddings.types';
|
||||
|
||||
// Workspace
|
||||
export type Workspace = Selectable<Workspaces>;
|
||||
@ -128,6 +128,6 @@ export type InsertableApiKey = Insertable<ApiKeys>;
|
||||
export type UpdatableApiKey = Updateable<Omit<ApiKeys, 'id'>>;
|
||||
|
||||
// Page Embedding
|
||||
export type Embedding = Selectable<Embeddings>;
|
||||
export type InsertableEmbedding = Insertable<Embeddings>;
|
||||
export type UpdatableEmbedding = Updateable<Omit<Embeddings, 'id'>>;
|
||||
export type PageEmbedding = Selectable<PageEmbeddings>;
|
||||
export type InsertablePageEmbedding = Insertable<PageEmbeddings>;
|
||||
export type UpdatablePageEmbedding = Updateable<Omit<PageEmbeddings, 'id'>>;
|
||||
|
||||
Submodule apps/server/src/ee updated: 9525907c63...d34e59d708
@ -231,7 +231,31 @@ export class EnvironmentService {
|
||||
}
|
||||
|
||||
getTypesenseLocale(): string {
|
||||
return this.configService.get<string>('TYPESENSE_LOCALE', 'en').toLowerCase();
|
||||
return this.configService
|
||||
.get<string>('TYPESENSE_LOCALE', 'en')
|
||||
.toLowerCase();
|
||||
}
|
||||
|
||||
getAiDriver(): string {
|
||||
return this.configService.get<string>('AI_DRIVER', 'openai');
|
||||
}
|
||||
|
||||
getAiEmbeddingModel(): string {
|
||||
return this.configService.get<string>(
|
||||
'AI_EMBEDDING_MODEL',
|
||||
'text-embedding-3-small',
|
||||
);
|
||||
}
|
||||
|
||||
getAiCompletionModel(): string {
|
||||
return this.configService.get<string>('AI_COMPLETION_MODEL', 'gpt-4o-mini');
|
||||
}
|
||||
|
||||
getAiEmbeddingDimension(): number {
|
||||
return parseInt(
|
||||
this.configService.get<string>('AI_EMBEDDING_DIMENSION', '1536'),
|
||||
10,
|
||||
);
|
||||
}
|
||||
|
||||
getOpenAiApiKey(): string {
|
||||
@ -242,18 +266,27 @@ export class EnvironmentService {
|
||||
return this.configService.get<string>('OPENAI_API_URL');
|
||||
}
|
||||
|
||||
getOpenAiEmbeddingModel(): string {
|
||||
getGoogleAiApiKey(): string {
|
||||
return this.configService.get<string>('GOOGLE_AI_API_KEY');
|
||||
}
|
||||
|
||||
getOllamaApiUrl(): string {
|
||||
return this.configService.get<string>(
|
||||
'OPENAI_EMBEDDING_MODEL',
|
||||
'text-embedding-3-small',
|
||||
'OLLAMA_API_URL',
|
||||
'http://localhost:11434',
|
||||
);
|
||||
}
|
||||
|
||||
getOpenAiCompletionModel(): string {
|
||||
return this.configService.get<string>(
|
||||
'OPENAI_COMPLETION_MODEL',
|
||||
'gpt-4o-mini',
|
||||
);
|
||||
getAwsAccessKeyId(): string {
|
||||
return this.configService.get<string>('AWS_ACCESS_KEY_ID');
|
||||
}
|
||||
|
||||
getAwsSecretAccessKey(): string {
|
||||
return this.configService.get<string>('AWS_SECRET_ACCESS_KEY');
|
||||
}
|
||||
|
||||
getAwsBedrockRegion(): string {
|
||||
return this.configService.get<string>('AWS_BEDROCK_REGION');
|
||||
}
|
||||
|
||||
isAIEnabled(): string {
|
||||
|
||||
Reference in New Issue
Block a user