Skip to content

Commit

Permalink
chore version 2.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
longy2k committed Jul 3, 2024
1 parent 4d0d2fa commit 4cec813
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 40 deletions.
25 changes: 4 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,6 @@ Generate and brainstorm ideas while creating your notes using Large Language Mod
<img src="README_images/dataview-example.png" alt="dataview_example">
</p>

## Breaking Changes

### If you have <v2.0.0, please perform the following instructions:

1. Go to `Options > Community plugins > BMO Chatbot` and uninstall the plugin.
2. Re-install "BMO Chatbot"
3. Restart Obsidian or toggle the plugin on/off to refresh.

Or,

1. Go to `Options > Community plugins` and click on the folder's icon:

<img width="775" alt="Screenshot 2024-03-10 at 9 28 38 PM" src="https://github.com/longy2k/obsidian-bmo-chatbot/assets/40724177/62882d8d-77d9-4a46-88fc-4e6a9b1215fc">

2. Close Obsidian completely.
3. Find the `bmo-chatbot` folder and delete `data.json`.
4. Restart Obsidian.

## Features

- **Interact with self-hosted Large Language Models (LLMs):** Use the REST API URLs provided to interact with self-hosted Large Language Models (LLMs) using [Ollama](https://ollama.ai) or [LM Studio](https://lmstudio.ai/).
Expand Down Expand Up @@ -107,14 +89,15 @@ To start using the plugin, enable it in your settings menu and insert an API key
- claude-2.1
- claude-3-haiku-20240307
- claude-3-sonnet-20240229
- claude-3-5-sonnet-20240620
- claude-3-opus-20240229
- Mistral AI's models
- Google Gemini Pro
- OpenAI
- gpt-3.5-turbo
- gpt-3.5-turbo-1106
- gpt-4
- gpt-4-turbo-preview
- gpt-4-turbo
- gpt-4o
- Any Openrouter provided models.

## Other Notes
Expand All @@ -127,7 +110,7 @@ Be MOre!

Any ideas or support is highly appreciated :)

If you have any bugs, improvements, or suggestions, please create an issue.
If you have any bugs or improvements, please create an issue.

If you like to share your ideas, profiles, or anything else, please join or create a discussion.

Expand Down
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": "2.1.1",
"version": "2.1.2",
"minAppVersion": "1.0.0",
"description": "Generate and brainstorm ideas while creating your notes using Large Language Models (LLMs) from Ollama, LM Studio, Anthropic, OpenAI, Mistral AI, and more for Obsidian.",
"author": "Longy2k",
Expand Down
4 changes: 2 additions & 2 deletions 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": "bmo-chatbot",
"version": "2.1.1",
"version": "2.1.2",
"description": "Generate and brainstorm ideas while creating your notes using Large Language Models (LLMs) from Ollama, LM Studio, Anthropic, OpenAI, Mistral AI, and more for Obsidian.",
"main": "main.js",
"scripts": {
Expand Down
15 changes: 12 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DataWriteOptions, Plugin, TFile} from 'obsidian';
import { BMOView, VIEW_TYPE_CHATBOT, populateModelDropdown} from './view';
import { BMOView, VIEW_TYPE_CHATBOT, populateModelDropdown } from './view';
import { BMOSettingTab } from './settings';
import { promptSelectGenerateCommand, renameTitleCommand } from './components/editor/EditorCommands';
import { colorToHex, isValidHexColor } from './utils/ColorConverter';
Expand Down Expand Up @@ -468,6 +468,17 @@ export default class BMOGPT extends Plugin {
const currentProfileFile = `${this.settings.profiles.profileFolderPath}/${this.settings.profiles.profile}`
const currentProfile = this.app.vault.getAbstractFileByPath(currentProfileFile) as TFile;
updateFrontMatter(this, currentProfile);

// Update the model dropdown in the header
const header = document.querySelector('#header') as HTMLElement;
const modelOptions = header.querySelector('#modelOptions');
if (modelOptions) {
modelOptions.remove();
}
const populateModelOptions = populateModelDropdown(this, this.settings);
header.appendChild(populateModelOptions);

// Save the settings
await this.saveData(this.settings);
}
}
Expand Down Expand Up @@ -617,8 +628,6 @@ export async function updateFrontMatter(plugin: BMOGPT, file: TFile){
frontmatter.ollama_keep_alive = plugin.settings.OllamaConnection.ollamaParameters.keep_alive;
};

populateModelDropdown(plugin, plugin.settings);

// Optional: Specify data write options
const writeOptions: DataWriteOptions = {
// Specify options if needed
Expand Down
22 changes: 11 additions & 11 deletions src/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,8 @@ export class BMOView extends ItemView {
}
});

const modelOptions = chatbotContainer.createEl('select', {
attr: { id: 'modelOptions' }
});

populateModelDropdown(this.plugin, this.settings);
// Models dropdown
const modelOptions = populateModelDropdown(this.plugin, this.settings);

const dotIndicator = chatbotContainer.createEl('span', {
attr: {
Expand Down Expand Up @@ -628,12 +625,14 @@ export async function deleteAllMessages(plugin: BMOGPT) {
}
}

export function populateModelDropdown(plugin: BMOGPT, settings: BMOSettings) {
// Get the modelOptions element
const modelOptions = document.querySelector('#modelOptions') as HTMLSelectElement;
console.log('Model name:', modelOptions);
export function populateModelDropdown(plugin: BMOGPT, settings: BMOSettings): HTMLSelectElement {
const modelOptions = document.createElement('select');
modelOptions.id = 'modelOptions';

if (modelOptions) {
modelOptions.innerHTML = ''; // Clear existing options
}

modelOptions.innerHTML = ''; // Clear existing options
// Get models as arrays
const modelGroups = [
{ name: 'Ollama Models', models: settings.OllamaConnection.ollamaModels },
Expand Down Expand Up @@ -666,7 +665,8 @@ export function populateModelDropdown(plugin: BMOGPT, settings: BMOSettings) {

modelOptions.addEventListener('change', async function() {
plugin.settings.general.model = this.value;
console.log('Selected model:', this.value);
await plugin.saveSettings();
});

return modelOptions;
}
2 changes: 1 addition & 1 deletion styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ ul#dropdownOptions li:hover {

#modelOptions {
height: 24px;
font-size: 0.8em;
font-size: 0.7em;
color: var(--interactive-accent);
margin: 5px auto;
padding: 0;
Expand Down

0 comments on commit 4cec813

Please sign in to comment.