Skip to content

Commit

Permalink
fix(settings): Fix update settings bug
Browse files Browse the repository at this point in the history
Even though logseq specifies this as a number, and enforces the input is
a number, it gets saved as a string. This parses it if neccesary.
  • Loading branch information
briansunter committed Jun 7, 2022
1 parent 8c8f0b4 commit c6bd72f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ logseq.useSettingsSchema(settingsSchema);
async function runOpenAI(b: IHookEvent) {
const apiKey = logseq.settings!["openAIKey"];
const completionEngine = logseq.settings!["openAICompletionEngine"];
const temperature = logseq.settings!["openAITemperature"];
const maxTokens = logseq.settings!["openAIMaxTokens"];
const temperature = Number.parseFloat(logseq.settings!["openAITemperature"]);
const maxTokens = Number.parseInt(logseq.settings!["openAIMaxTokens"]);

if (!apiKey) {
console.error("Need API key set in settings.");
Expand Down

0 comments on commit c6bd72f

Please sign in to comment.