Skip to content

Commit 9500e57

Browse files
committed
feat: add setting for add specific tags to AI-generated content
1 parent 2ac00e9 commit 9500e57

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/main.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import settings, {
99
import { getBlockContent } from './utils';
1010

1111
function main() {
12-
const { apiKey, model, customPrompts } = logseq.settings as unknown as ISettings;
12+
const { apiKey, model, customPrompts, tag } =
13+
logseq.settings as unknown as ISettings;
1314
const prompts = [...Object.values(presetPrompts)];
1415

1516
if (customPrompts.enable) {
@@ -55,14 +56,19 @@ function main() {
5556
case PromptOutputType.property:
5657
await logseq.Editor.updateBlock(
5758
uuid,
58-
block?.content + `\n ${name.toLowerCase()}:: ${content}`,
59+
block?.content +
60+
` #${tag}\n ${name.toLowerCase()}:: ${content}`,
5961
);
6062
break;
6163
case PromptOutputType.insert:
64+
await logseq.Editor.updateBlock(
65+
uuid,
66+
block?.content + ` #${tag}`,
67+
);
6268
await logseq.Editor.insertBlock(uuid, content);
6369
break;
6470
case PromptOutputType.replace:
65-
await logseq.Editor.updateBlock(uuid, content);
71+
await logseq.Editor.updateBlock(uuid, `${content} #${tag}`);
6672
break;
6773
}
6874
}

src/settings.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export interface IPromptOptions {
1515
export interface ISettings {
1616
apiKey: string;
1717
model: string;
18+
tag: string;
1819
customPrompts: {
1920
enable: boolean;
2021
prompts: IPromptOptions[];
@@ -36,6 +37,13 @@ const settings: SettingSchemaDesc[] = [
3637
description: 'Choose the OpenAI model (e.g., "gpt-3.5-turbo").',
3738
default: 'gpt-3.5-turbo',
3839
},
40+
{
41+
key: 'tag',
42+
type: 'string',
43+
title: 'Tag',
44+
description: 'Add specific tags to AI-generated content',
45+
default: '[[🤖]]'
46+
},
3947
{
4048
key: 'customPrompts',
4149
type: 'object',

0 commit comments

Comments
 (0)