diff --git a/argilla-frontend/v1/domain/entities/hub/DatasetCreation.test.ts b/argilla-frontend/v1/domain/entities/hub/DatasetCreation.test.ts index ff21d2aedf..802a863dc7 100644 --- a/argilla-frontend/v1/domain/entities/hub/DatasetCreation.test.ts +++ b/argilla-frontend/v1/domain/entities/hub/DatasetCreation.test.ts @@ -29,6 +29,10 @@ const datasetInfo = { dtype: "string", _type: "Value", }, + extra: { + dtype: "int32", + _type: "Value", + }, }, ], metadata: { @@ -160,6 +164,35 @@ describe("DatasetCreation", () => { expect(chatField.required).toBeFalsy(); }); + it("skip other list feature from chat fields", () => { + const builder = new DatasetCreationBuilder("FAKE", { + default: { + ...datasetInfo.default, + features: { + some_list_feature: [ + { + other: { + dtype: "string", + _type: "Value", + }, + value: { + dtype: "string", + _type: "Value", + }, + }, + ], + }, + }, + }); + + const datasetCreation = builder.build(); + + expect( + datasetCreation.fields.filter((f) => f.type.value === "no mapping") + .length + ).toBe(1); + }); + it("get no mapped feature", () => { const builder = new DatasetCreationBuilder("FAKE", { default: { diff --git a/argilla-frontend/v1/domain/entities/hub/Subset.ts b/argilla-frontend/v1/domain/entities/hub/Subset.ts index f0cc82b0b7..de02ff89b5 100644 --- a/argilla-frontend/v1/domain/entities/hub/Subset.ts +++ b/argilla-frontend/v1/domain/entities/hub/Subset.ts @@ -7,6 +7,8 @@ import { QuestionCreation } from "./QuestionCreation"; type Structure = { name: string; options?: string[]; + role?: string; + content?: string; structure?: Structure[]; kindObject?: "Value" | "Image" | "ClassLabel" | "Sequence"; type?: "string" | MetadataTypes; @@ -33,6 +35,7 @@ export class Subset { for (const [name, value] of Object.entries(datasetInfo.features)) { if (Array.isArray(value)) { + const { role, content } = value[0]; this.structures.push({ name, structure: value.map((v) => { @@ -42,6 +45,8 @@ export class Subset { name: key, kindObject: value._type, type: value.dtype, + role, + content, }; }), }); @@ -134,8 +139,12 @@ export class Subset { return "text"; if (structure.kindObject === "Image") return "image"; - - if (structure.structure?.length > 0) return "chat"; + if ( + structure.structure?.length > 0 && + structure.structure[0].content && + structure.structure[0].role + ) + return "chat"; }; const field = FieldCreation.from(