diff --git a/apps/color-buddy/src/controls/SuggestionModificationToSelection.svelte b/apps/color-buddy/src/controls/SuggestionModificationToSelection.svelte
index abeec14..54f57f3 100644
--- a/apps/color-buddy/src/controls/SuggestionModificationToSelection.svelte
+++ b/apps/color-buddy/src/controls/SuggestionModificationToSelection.svelte
@@ -96,77 +96,75 @@
>
-
-
-
diff --git a/apps/color-buddy/src/linting/EvalResponse.svelte b/apps/color-buddy/src/linting/EvalResponse.svelte
index f4d9f6c..48c670b 100644
--- a/apps/color-buddy/src/linting/EvalResponse.svelte
+++ b/apps/color-buddy/src/linting/EvalResponse.svelte
@@ -26,12 +26,12 @@
$: palette = $colorStore.palettes[$colorStore.currentPal];
$: engine = $configStore.engine;
- $: suggestions = [] as { pal: Palette; label: string }[];
+ type FixSuggestion = { pal: Palette; label: string; fixesIssue: boolean };
+ $: suggestions = [] as FixSuggestion[];
$: colorSpace = palette.colorSpace;
$: lintProgram = lintResult.lintProgram;
function proposeFix(fixType: "ai" | "monte" | "heuristic", label: string) {
- requestState = "loading";
let hasRetried = false;
const getFix = () => {
let fix;
@@ -42,22 +42,25 @@
} else {
fix = suggestLintFix(palette, lintResult);
}
- return fix.then((x) => {
- suggestions = [...suggestions, ...x.map((pal) => ({ pal, label }))];
- requestState = "loaded";
- logEvent(
- "lint-fix",
- {
- fixType,
- errorName: lintProgram.name,
- lintProgram: lintProgram.program,
- palette: palette.colors.map((x) => x.toDisplay()),
- background: palette.background.toDisplay(),
- fix: x.map((y) => y.colors.map((z) => z.toDisplay())),
- },
- $configStore.userName
- );
- });
+ return fix
+ .then((x) => x.map((pal) => ({ pal, label })).at(0))
+
+ .then((x) => {
+ suggestions = [...suggestions, x].filter((x) => x) as FixSuggestion[];
+ requestState = "loaded";
+ logEvent(
+ "lint-fix",
+ {
+ fixType,
+ errorName: lintProgram.name,
+ lintProgram: lintProgram.program,
+ palette: palette.colors.map((x) => x.toDisplay()),
+ background: palette.background.toDisplay(),
+ fix: x?.pal?.colors.map((z) => z.toDisplay()),
+ },
+ $configStore.userName
+ );
+ });
};
getFix().catch((e) => {
@@ -70,6 +73,16 @@
}
});
}
+ function generateFixes() {
+ proposeFix("ai", "LLMs");
+ if (lintProgram && lintProgram.program.length) {
+ proposeFix("monte", "Monte Carlo");
+ }
+ if (lintProgram.subscribedFix && lintProgram.subscribedFix !== "none") {
+ proposeFix("heuristic", "Hand tuned fix");
+ }
+ }
+
$: currentPal = $colorStore.palettes[$colorStore.currentPal];
$: evalConfig = currentPal.evalConfig;
@@ -123,22 +136,9 @@
{#if lintResult.kind === "success" && !lintResult.passes}
-