Skip to content

Commit

Permalink
Allow AI Mute
Browse files Browse the repository at this point in the history
  • Loading branch information
mcnuttandrew committed Oct 15, 2024
1 parent 6190cc2 commit a99d99b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
3 changes: 3 additions & 0 deletions apps/color-buddy/src/controls/AddColor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
let requestState: "idle" | "loading" | "loaded" | "failed" = "idle";
function getColorForSearch(searchedString: string) {
if ($configStore.engine === "none") {
return;
}
const allowedStates = new Set(["idle", "loaded", "failed"]);
if (!allowedStates.has(requestState)) {
return;
Expand Down
1 change: 1 addition & 0 deletions apps/color-buddy/src/controls/Config.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// "google",
"openai",
"anthropic",
"none",
] as string[];
const isMac = navigator.userAgent.indexOf("Mac OS X") !== -1;
Expand Down
9 changes: 7 additions & 2 deletions apps/color-buddy/src/controls/DesignPit.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts">
import focusStore from "../stores/focus-store";
import colorStore from "../stores/color-store";
import configStore from "../stores/config-store";
import Tooltip from "../components/Tooltip.svelte";
import AdjustColor from "./AdjustColor.svelte";
Expand Down Expand Up @@ -28,12 +29,16 @@
style={`max-height: calc(100% - (450px + 65px + 48px + 20px))`}
>
<div class="flex w-full flex-wrap">
<SuggestionModificationToSelection />
{#if $configStore.engine !== "none"}
<SuggestionModificationToSelection />
{/if}
{#if numFocused > 0}
<DupAndDelete />
{/if}
</div>
<div class={breaker} />
{#if !($configStore.engine === "none" && numFocused === 0)}
<div class={breaker} />
{/if}
{#if numFocused >= 1}
<!-- <div class="font-bold">Adjust</div> -->
<AdjustColor />
Expand Down
3 changes: 2 additions & 1 deletion apps/color-buddy/src/lib/api-calls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import LintWorker from "./lint-worker.worker?worker";
import { summarizePal } from "./utils";
import type { WorkerCommand } from "./worker-types";

export type Engine = "openai" | "google" | "anthropic";
export type Engine = "openai" | "google" | "anthropic" | "none";
type SimplePal = { background: string; colors: string[] };
const palToString = (pal: Palette) => ({
background: pal.background.toHex(),
Expand Down Expand Up @@ -85,6 +85,7 @@ const engineToScaffold = {
openai: openAIScaffold,
google: googleScaffold,
anthropic: anthropicScaffold,
none: openAIScaffold,
};

// supports the add color search function
Expand Down
11 changes: 7 additions & 4 deletions apps/color-buddy/src/linting/LintToolTipContents.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script lang="ts">
import type { LintResult } from "color-buddy-palette-lint";
import type { Palette } from "color-buddy-palette";
import { suggestLintFix } from "color-buddy-palette-lint";
import { linter, suggestLintFix } from "color-buddy-palette-lint";
import { suggestLintAIFix, suggestLintMonteFix } from "../lib/lint-fixer";
import { linter } from "color-buddy-palette-lint";
import Equal from "virtual:icons/fa6-solid/equals";
import colorStore from "../stores/color-store";
Expand Down Expand Up @@ -81,8 +81,11 @@
$: waitingOnFixes = 0;
function generateFixes() {
let numAdd = 0;
proposeFix("ai", "LLM Suggestion");
numAdd += 1;
if ($configStore.engine !== "none") {
proposeFix("ai", "LLM Suggestion");
numAdd += 1;
}
if (lintProgram && lintProgram.program.length) {
proposeFix("monte", "Monte Carlo Suggestion");
numAdd += 1;
Expand Down

0 comments on commit a99d99b

Please sign in to comment.