Skip to content

Commit

Permalink
catch console, improve prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
mcnuttandrew committed Feb 6, 2024
1 parent 7b7a4c8 commit b160bdb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
14 changes: 12 additions & 2 deletions netlify/functions/suggest-lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const prompt = (pal: promptInput) => `
You are a color expert and domain-specific language programmer. You take in a lint prompt and suggest a lint using the following programming language.
# Task and output format
Given a lint prompt, suggest a lint using the color check linting language Your response should be a JSON object written in the following JSON DSL.
Given a lint prompt, suggest a lint using the color check linting language Your response should be a JSON object written in the following JSON DSL. You must be explicit in your response and include all necessary information. If a list of colors is suggest you should guess what those colors are and give explicit values
Expressions
EXPR = Conjunction | Quantifier | Comparison | Boolean
Expand All @@ -20,7 +20,7 @@ NOT: {not: EXPR}
Quantifiers:
FORALL: {all: {varbs: Variable[], predicate: EXPR, where?: EXPR, in: Variable | Value[]}}
EXISTS: {exists: {varbs: Variable[], predicate: EXPR, where?: EXPR, in: Variable | Value[]}}
EXISTS: {exist: {varbs: Variable[], predicate: EXPR, where?: EXPR, in: Variable | Value[]}}
Comparisons (value) => expression
similar: {"similar": {left: Value, right: Value, threshold: Number}}
Expand Down Expand Up @@ -54,6 +54,16 @@ Example Result:
"!=": {"left": { "cvd_sim": "a", "type": "deuteranopia" }, "right": { "cvd_sim": "b", "type": "deuteranopia" }
}}}}}
Example prompt: Colors should not be extreme
Example Result:
{"all": {
"in": "colors",
"varb": "a",
"predicate": {
"all": {"in": ["#000000", "#ffffff"], "varb": "b",
"predicate": { "!=": { "left": "a", "right": "b" } },
}}}}
Prompt: ${JSON.stringify(pal.lintPrompt)}
Your response: `;
Expand Down
1 change: 0 additions & 1 deletion src/lib/Color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ function colorFromHex(
}
const color = new ColorIO(hex).to(colorSpace);
const outColor = new colorDirectory[colorSpace]().fromChannels(color.coords);
console.log(hex, color.coords, outColor.toHex());
colorHexCache.set(hex, outColor);
return outColor;
}
Expand Down
1 change: 0 additions & 1 deletion src/linting/NewLintSuggestion.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
requestState = "idle";
return;
}
console.log(suggestions);
const program = JSONStringify(JSON.stringify(suggestions[0]));
const metaSuggestions = await suggestLintMetadata(
program,
Expand Down

0 comments on commit b160bdb

Please sign in to comment.