Skip to content

Commit

Permalink
add unique filter
Browse files Browse the repository at this point in the history
  • Loading branch information
zlalvani committed May 6, 2024
1 parent b2ee156 commit ef715e3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/bumpgen-core/src/services/llm/openai.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { OpenAI } from "openai";
import { unique } from "radash";

import type { DependencyGraphNode } from "../../models/graph/dependency";
import type { PlanGraphNode } from "../../models/graph/plan";
Expand All @@ -18,9 +19,13 @@ const makePlanNodeMessage = (
importContext: DependencyGraphNode[],
bumpedPackage: string,
) => {
const importMessages = importContext.map((context) => {
return context.block;
});
// We need to do this because we only store nodes for the specific identifiers in an import, so
// multiple can be in the same code block.
const importMessages = unique(
importContext.map((context) => {
return context.block;
}),
);
return {
role: "user" as const,
content: [
Expand Down

0 comments on commit ef715e3

Please sign in to comment.