Skip to content

Commit 66032dc

Browse files
ilumerahonn
authored andcommitted
feat: add basePath and auto reload setting
1 parent d783bb1 commit 66032dc

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/main.tsx

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

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

@@ -20,6 +20,7 @@ function main() {
2020
prompts.map(({ name, prompt, output }: IPromptOptions) => {
2121
const configuration = new Configuration({
2222
apiKey,
23+
basePath
2324
});
2425

2526
const openai = new OpenAIApi(configuration);
@@ -74,6 +75,7 @@ function main() {
7475
}
7576
},
7677
);
78+
logseq.onSettingsChanged(() => main())
7779
});
7880
}
7981

src/settings.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export interface IPromptOptions {
1414

1515
export interface ISettings {
1616
apiKey: string;
17+
basePath: string;
1718
model: string;
1819
tag: string;
1920
customPrompts: {
@@ -30,6 +31,13 @@ const settings: SettingSchemaDesc[] = [
3031
description: 'Enter your OpenAI API key.',
3132
default: '',
3233
},
34+
{
35+
key: 'basePath',
36+
type: 'string',
37+
title: 'openApi basePath',
38+
description: 'Enter your openApi proxy basePath',
39+
default: 'https://api.openai.com/v1',
40+
},
3341
{
3442
key: 'model',
3543
type: 'string',

0 commit comments

Comments
 (0)