Skip to content

Commit

Permalink
fix: correct the call for fields in advanced mode (#826)
Browse files Browse the repository at this point in the history
* fix: correct the call for fields in advanced mode

* fix: add test
  • Loading branch information
paulgerold authored May 29, 2024
1 parent bd330ef commit 25b4b17
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,30 @@ export interface CaseClassificationDocumentGroupPreview {
numberOfValidDocuments: number;
}

export interface CaseClassificationContentFieldsParams {
export interface CaseClassificationContentFieldsAdvancedMode {
/**
* The query to use when building the model.
*/
advancedQuery: string;
/**
* The case creation date range for the cases the model will use.
*/
caseExtractionPeriod?: never;
/**
* An array of filtering conditions.
*/
caseFilterConditions?: never;
/**
* The field value to use as language.
*/
languageField?: never;
/**
* The names of the sources that contain the cases that the model will use.
*/
sources?: never;
}

export interface CaseClassificationContentFieldsStandardMode {
/**
* The case creation date range for the cases the model will use.
*/
Expand All @@ -145,8 +168,16 @@ export interface CaseClassificationContentFieldsParams {
* The names of the sources that contain the cases that the model will use.
*/
sources: string[];
/**
* The query to use when building the model.
*/
advancedQuery?: never;
}

export type CaseClassificationContentFieldsParams =
| CaseClassificationContentFieldsStandardMode
| CaseClassificationContentFieldsAdvancedMode;

export interface CaseClassificationContentField {
name: string;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,15 @@ describe('CaseClassificationConfiguration', () => {
expect(api.post).toHaveBeenCalledTimes(1);
expect(api.post).toHaveBeenCalledWith(CaseClassificationConfiguration.fieldsUrl, params);
});

it('should make a POST call to retrieve valid content field candidates for the Case Classification model configuration with an advancedQuery', () => {
const params = {advancedQuery: "@source='some source'"};

ccConfig.fields(params);

expect(api.post).toHaveBeenCalledTimes(1);
expect(api.post).toHaveBeenCalledWith(CaseClassificationConfiguration.fieldsUrl, params);
});
});

describe('preview', () => {
Expand Down

0 comments on commit 25b4b17

Please sign in to comment.