Hotfix tests after AI PR (#6124)
I merged https://github.com/twentyhq/twenty/pull/5788 too quickly and didn't noticed it was broken with https://github.com/twentyhq/twenty/pull/6069
This commit is contained in:
@@ -8,8 +8,6 @@ import { zodToJsonSchema } from 'zod-to-json-schema';
|
|||||||
import { PostgresConnectionOptions } from 'typeorm/driver/postgres/PostgresConnectionOptions';
|
import { PostgresConnectionOptions } from 'typeorm/driver/postgres/PostgresConnectionOptions';
|
||||||
import groupBy from 'lodash.groupby';
|
import groupBy from 'lodash.groupby';
|
||||||
|
|
||||||
import { PartialFieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/partial-field-metadata.interface';
|
|
||||||
|
|
||||||
import { WorkspaceDataSourceService } from 'src/engine/workspace-datasource/workspace-datasource.service';
|
import { WorkspaceDataSourceService } from 'src/engine/workspace-datasource/workspace-datasource.service';
|
||||||
import { WorkspaceQueryRunnerService } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service';
|
import { WorkspaceQueryRunnerService } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service';
|
||||||
import { LLMChatModelService } from 'src/engine/integrations/llm-chat-model/llm-chat-model.service';
|
import { LLMChatModelService } from 'src/engine/integrations/llm-chat-model/llm-chat-model.service';
|
||||||
@@ -17,7 +15,6 @@ import { LLMTracingService } from 'src/engine/integrations/llm-tracing/llm-traci
|
|||||||
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||||
import { DEFAULT_LABEL_IDENTIFIER_FIELD_NAME } from 'src/engine/metadata-modules/object-metadata/object-metadata.constants';
|
import { DEFAULT_LABEL_IDENTIFIER_FIELD_NAME } from 'src/engine/metadata-modules/object-metadata/object-metadata.constants';
|
||||||
import { StandardObjectFactory } from 'src/engine/workspace-manager/workspace-sync-metadata/factories/standard-object.factory';
|
import { StandardObjectFactory } from 'src/engine/workspace-manager/workspace-sync-metadata/factories/standard-object.factory';
|
||||||
import { standardObjectMetadataDefinitions } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects';
|
|
||||||
import { AISQLQueryResult } from 'src/engine/core-modules/ai-sql-query/dtos/ai-sql-query-result.dto';
|
import { AISQLQueryResult } from 'src/engine/core-modules/ai-sql-query/dtos/ai-sql-query-result.dto';
|
||||||
import { sqlGenerationPromptTemplate } from 'src/engine/core-modules/ai-sql-query/ai-sql-query.prompt-templates';
|
import { sqlGenerationPromptTemplate } from 'src/engine/core-modules/ai-sql-query/ai-sql-query.prompt-templates';
|
||||||
|
|
||||||
@@ -43,7 +40,7 @@ export class AISQLQueryService {
|
|||||||
fieldMetadata.id === objectMetadata.labelIdentifierFieldMetadataId,
|
fieldMetadata.id === objectMetadata.labelIdentifierFieldMetadataId,
|
||||||
);
|
);
|
||||||
|
|
||||||
const standardObjectMetadataCollection = this.standardObjectFactory.create(
|
/* const standardObjectMetadataCollection = this.standardObjectFactory.create(
|
||||||
standardObjectMetadataDefinitions,
|
standardObjectMetadataDefinitions,
|
||||||
{ workspaceId, dataSourceId },
|
{ workspaceId, dataSourceId },
|
||||||
workspaceFeatureFlagsMap,
|
workspaceFeatureFlagsMap,
|
||||||
@@ -58,11 +55,11 @@ export class AISQLQueryService {
|
|||||||
?.fields.find(
|
?.fields.find(
|
||||||
(field: PartialFieldMetadata) =>
|
(field: PartialFieldMetadata) =>
|
||||||
field.name === DEFAULT_LABEL_IDENTIFIER_FIELD_NAME,
|
field.name === DEFAULT_LABEL_IDENTIFIER_FIELD_NAME,
|
||||||
) as PartialFieldMetadata;
|
) as PartialFieldMetadata; */
|
||||||
|
|
||||||
const labelIdentifierFieldMetadata =
|
const labelIdentifierFieldMetadata =
|
||||||
customObjectLabelIdentifierFieldMetadata ??
|
customObjectLabelIdentifierFieldMetadata; /*??
|
||||||
standardObjectLabelIdentifierFieldMetadata;
|
standardObjectLabelIdentifierFieldMetadata*/
|
||||||
|
|
||||||
return (
|
return (
|
||||||
labelIdentifierFieldMetadata?.name ?? DEFAULT_LABEL_IDENTIFIER_FIELD_NAME
|
labelIdentifierFieldMetadata?.name ?? DEFAULT_LABEL_IDENTIFIER_FIELD_NAME
|
||||||
|
|||||||
@@ -371,7 +371,7 @@ export class EnvironmentVariables {
|
|||||||
|
|
||||||
OPENROUTER_API_KEY: string;
|
OPENROUTER_API_KEY: string;
|
||||||
|
|
||||||
LLM_CHAT_MODEL_DRIVER: LLMChatModelDriver = LLMChatModelDriver.OpenAI;
|
LLM_CHAT_MODEL_DRIVER: LLMChatModelDriver;
|
||||||
|
|
||||||
OPENAI_API_KEY: string;
|
OPENAI_API_KEY: string;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -9,6 +9,6 @@ export interface LLMChatModelModuleOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type LLMChatModelModuleAsyncOptions = {
|
export type LLMChatModelModuleAsyncOptions = {
|
||||||
useFactory: (...args: any[]) => LLMChatModelModuleOptions;
|
useFactory: (...args: any[]) => LLMChatModelModuleOptions | undefined;
|
||||||
} & Pick<ModuleMetadata, 'imports'> &
|
} & Pick<ModuleMetadata, 'imports'> &
|
||||||
Pick<FactoryProvider, 'inject'>;
|
Pick<FactoryProvider, 'inject'>;
|
||||||
|
|||||||
+1
-3
@@ -12,8 +12,6 @@ export const llmChatModelModuleFactory = (
|
|||||||
return { type: LLMChatModelDriver.OpenAI };
|
return { type: LLMChatModelDriver.OpenAI };
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
throw new Error(
|
// `No LLM chat model driver (${driver})`);
|
||||||
`Invalid LLM chat model driver (${driver}), check your .env file`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ export class LLMChatModelModule {
|
|||||||
useFactory: (...args: any[]) => {
|
useFactory: (...args: any[]) => {
|
||||||
const config = options.useFactory(...args);
|
const config = options.useFactory(...args);
|
||||||
|
|
||||||
switch (config.type) {
|
switch (config?.type) {
|
||||||
case LLMChatModelDriver.OpenAI: {
|
case LLMChatModelDriver.OpenAI: {
|
||||||
return new OpenAIDriver();
|
return new OpenAIDriver();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user