Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

Commit

Permalink
update prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
nohzafk committed Dec 16, 2023
1 parent 1678b29 commit 465b754
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function PromptSettings() {
const [prompt, setPrompt] = useState<string | undefined>(DEFAULT_PROMPT);
const [isPromptValid, setIsPromptValid] = useState<boolean>(true);

const promptFormatWarning: string = `{{types}} must be in the prompt`;
const promptFormatWarning: string = `{{tabURL}} {{tabTitle}} {{types}} must be in the prompt`;

useEffect(() => {
getStorage<string>("prompt").then(setPrompt);
Expand Down
11 changes: 6 additions & 5 deletions src/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ const renderPrompt = async (
return [
{
role: "system",
content: "Act as a brwoser tab group classificator",
content: "You are a brwoser tab group classificator",
},
{
role: "user",
content:
Mustache.render(prompt, {
types: types.join(", "),
}) + `, tab url: "${tab.url}", tab title: "${tab.title}"`,
content: Mustache.render(prompt, {
tabURL: tab.url,
tabTitle: tab.title,
types: types.join(", "),
}),
},
];
};
Expand Down
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export const DEFAULT_GROUP = [
];

export const DEFAULT_PROMPT: string =
`Classify the tab group base on the provided URL and title into one of the categories: ` +
`[{{types}}], response with the category only, without any comments.`;
`Classify the tab group base on the provided URL ({{tabURL}}) and title (tabTitle) into one of the categories: ` +
`{{types}}. Response with the category only, without any comments.`;

export function matchesRule(url: URL, rule: FilterRuleItem) {
const { type, rule: value } = rule;
Expand Down

0 comments on commit 465b754

Please sign in to comment.