Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace custom groupBy implementation with Object.groupBy and remove … #498

Merged
merged 1 commit into from
Feb 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion application/OrganizationInteractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ export class OrganizationInteractor extends Interactor<req.Organization> {
})

// Group the results by the requirement type
return groupBy(requirements, ({ req_type }) => req_type)
return Object.groupBy(requirements, ({ req_type }) => req_type)
}
*/

Expand Down
4 changes: 2 additions & 2 deletions server/data/services/NaturalLanguageToRequirementService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { v7 as uuidv7 } from 'uuid';
import zodToJsonSchema from "zod-to-json-schema";
import zodSchema from '../llm-zod-schemas/index.js'
import { zodResponseFormat } from "openai/helpers/zod";
import { dedent, groupBy } from "#shared/utils";
import { dedent } from "#shared/utils";

type LLMResponseType = typeof zodSchema['_type']['requirements']
type ArrayToUnion<T> = T extends (infer U)[] ? U : never
Expand Down Expand Up @@ -53,6 +53,6 @@ export default class NaturalLanguageToRequirementService {
const result = (completion.choices[0].message.parsed?.requirements ?? [])
.map((req) => ({ ...req, id: uuidv7() }));

return groupBy(result, ({ type }) => type) as ParsedRequirementGroup
return Object.groupBy(result, ({ type }) => type) as ParsedRequirementGroup
}
}
46 changes: 0 additions & 46 deletions shared/utils/groupBy.test.ts

This file was deleted.

12 changes: 0 additions & 12 deletions shared/utils/groupBy.ts

This file was deleted.

1 change: 0 additions & 1 deletion shared/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export * from './camelCaseToTitleCase';
export * from './debounce';
export * from './dedent';
export * from './deSlugify';
export * from './groupBy';
export * from './pascalCaseToSnakeCase'
export * from './slugify';
export * from './snakeCaseToCamelCase';
Expand Down