Skip to content

Commit

Permalink
Updated version
Browse files Browse the repository at this point in the history
  • Loading branch information
longy2k committed May 22, 2023
1 parent 06f1a6e commit 9e59a45
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 27 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "bmo-chatbot",
"name": "BMO Chatbot",
"version": "1.3.0",
"version": "1.3.1",
"minAppVersion": "1.0.0",
"description": "Improve your knowledge management with a chatbot that understands context and retrieves relevant information using Large Language Models (LLMs).",
"author": "Longy2k",
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-chatbot-plugin",
"version": "1.3.0",
"version": "1.3.1",
"description": "Improve your knowledge management with a chatbot that understands context and retrieves relevant information using Large Language Models (LLMs).",
"main": "main.js",
"scripts": {
Expand Down
42 changes: 19 additions & 23 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,17 @@ export class BMOSettingTab extends PluginSettingTab {
})
});

new Setting(containerEl)
.setName('System')
.setDesc('System role prompt.')
.addTextArea(text => text
.setPlaceholder('You are a helpful assistant.')
.setValue(this.plugin.settings.system_role !== undefined ? this.plugin.settings.system_role : "You are a helpful assistant who responds in markdown.")
.onChange(async (value) => {
this.plugin.settings.system_role = value !== undefined ? value : DEFAULT_SETTINGS.system_role;
await this.plugin.saveSettings();
})
);
new Setting(containerEl)
.setName('System')
.setDesc('System role prompt.')
.addTextArea(text => text
.setPlaceholder('You are a helpful assistant.')
.setValue(this.plugin.settings.system_role !== undefined ? this.plugin.settings.system_role : "You are a helpful assistant who responds in markdown.")
.onChange(async (value) => {
this.plugin.settings.system_role = value !== undefined ? value : DEFAULT_SETTINGS.system_role;
await this.plugin.saveSettings();
})
);

new Setting(containerEl)
.setName('Max Tokens')
Expand Down Expand Up @@ -196,7 +196,6 @@ export class BMOSettingTab extends PluginSettingTab {
})
);

// Your existing code starts here...
let colorPicker: ColorComponent;
let pollingInterval: string | number | NodeJS.Timer | undefined;

Expand Down Expand Up @@ -232,7 +231,6 @@ export class BMOSettingTab extends PluginSettingTab {
await this.plugin.saveSettings();
});

// Start polling when color picker is added
let previousDefaultColor = colorToHex(getComputedStyle(document.body).getPropertyValue(DEFAULT_SETTINGS.chatbotContainerBackgroundColor).trim());
pollingInterval = setInterval(() => {
const currentDefaultColor = colorToHex(getComputedStyle(document.body).getPropertyValue(DEFAULT_SETTINGS.chatbotContainerBackgroundColor).trim());
Expand Down Expand Up @@ -380,7 +378,6 @@ export class BMOSettingTab extends PluginSettingTab {
}, 1000); // Poll every second
});


// Be sure to clear the interval when the settings pane is closed to avoid memory leaks
onunload = () => {
clearInterval(pollingInterval);
Expand All @@ -394,33 +391,32 @@ export class BMOSettingTab extends PluginSettingTab {
.setName('REST API URL')
.setDesc(descLink1('Enter your REST API URL from a self-hosted API like', 'https://github.com/go-skynet/LocalAI', ''))
.addText(text => text
.setPlaceholder('http://localhost:8080')
.setValue(this.plugin.settings.restAPIUrl || DEFAULT_SETTINGS.restAPIUrl)
.onChange(async (value) => {
.setPlaceholder('http://localhost:8080')
.setValue(this.plugin.settings.restAPIUrl || DEFAULT_SETTINGS.restAPIUrl)
.onChange(async (value) => {
this.plugin.settings.restAPIUrl = value ? value : DEFAULT_SETTINGS.restAPIUrl;
await this.plugin.saveSettings();
})
})
);


function descLink1(text: string, link: string, extraWords: string): DocumentFragment {
const frag = new DocumentFragment();
const desc = document.createElement('span');
desc.innerText = text + ' ';
frag.appendChild(desc);

const anchor = document.createElement('a');
anchor.href = link;
anchor.target = '_blank';
anchor.rel = 'noopener noreferrer';
anchor.innerText = 'LocalAI';
frag.appendChild(anchor);

const extra = document.createElement('span');
extra.innerText = ' ' + extraWords;
frag.appendChild(extra);

return frag;
};
};
}
}
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"1.1.0": "1.1.0",
"1.2.0": "1.2.0",
"1.2.1": "1.2.1",
"1.3.0": "1.3.0"
"1.3.0": "1.3.0",
"1.3.1": "1.3.1"
}

0 comments on commit 9e59a45

Please sign in to comment.