Skip to content

Commit

Permalink
Release 0.6.1 (#67)
Browse files Browse the repository at this point in the history
* style(logo): final mvp version

* refactor: vector store files in seperate directory

* up manifest
  • Loading branch information
Leo310 authored Apr 1, 2024
1 parent 484f1e5 commit b029db5
Show file tree
Hide file tree
Showing 10 changed files with 121 additions and 133 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Interact with your privacy focused assistant, leveraging Ollama or OpenAI, making your second brain even smarter.",
"author": "Leo310, nicobrauchtgit",
"authorUrl": "https://github.com/nicobrauchtgit",
"version": "0.6.0",
"version": "0.6.1",
"minAppVersion": "1.5.0",
"isDesktopOnly": true
}
14 changes: 8 additions & 6 deletions src/SmartSecondBrain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ export default class SmartSecondBrain {
return new Notice(t('notice.failed', { values: { error: e } }), 4000);
}
// check if vector store data exists
if (await this.app.vault.adapter.exists(this.getVectorStorePath())) {
const vectorStoreData = await this.app.vault.adapter.readBinary(this.getVectorStorePath());
if (await this.app.vault.adapter.exists(this.getVectorStoreFile())) {
const vectorStoreData = await this.app.vault.adapter.readBinary(this.getVectorStoreFile());
await this.papa.load(vectorStoreData);
}
}
Expand Down Expand Up @@ -122,7 +122,7 @@ export default class SmartSecondBrain {
}

async cancelIndexing() {
// if (this.app.vault.adapter.exists(this.getVectorStorePath())) await this.app.vault.adapter.remove(this.getVectorStorePath());
// if (this.app.vault.adapter.exists(this.getVectorStoreFile())) await this.app.vault.adapter.remove(this.getVectorStoreFile());
papaState.set('uninitialized');
papaIndexingProgress.set(0);
}
Expand Down Expand Up @@ -170,16 +170,18 @@ export default class SmartSecondBrain {
return fileName;
}

private getVectorStorePath() {
getVectorStoreFile() {
const d = get(data);
return normalizePath(this.pluginDir + '/' + (d.isIncognitoMode ? d.ollamaEmbedModel.model : d.openAIEmbedModel.model) + '-vector-store.bin');
return normalizePath(this.pluginDir + '/vectorstores/' + (d.isIncognitoMode ? d.ollamaEmbedModel.model : d.openAIEmbedModel.model) + '.bin');
}

async saveVectorStoreData() {
if (this.needsToSaveVectorStoreData && this.papa) {
Log.debug('Saving vector store data');
this.needsToSaveVectorStoreData = false;
await this.app.vault.adapter.writeBinary(this.getVectorStorePath(), await this.papa.getData());
// create vectorstores directory if it doesn't exist
(await this.app.vault.adapter.exists(this.pluginDir + '/vectorstores')) || (await this.app.vault.adapter.mkdir(this.pluginDir + '/vectorstores'));
await this.app.vault.adapter.writeBinary(this.getVectorStoreFile(), await this.papa.getData());
Log.info('Saved vector store data');
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chat/Input.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
} from '../../store';
import ProgressCircle from '../base/ProgressCircle.svelte';
import { addMessage } from '../../controller/Messages';
import Logo from '../Logos/LogoSimple.svelte';
import Logo from '../Logos/Logo.svelte';
export let textarea: HTMLTextAreaElement;
Expand Down
106 changes: 106 additions & 0 deletions src/components/Logos/Logo.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<script>
import { data } from '../../store';
</script>

<svg
class="z-[-1] h-full {$data.isUsingRag ? 'fill-[--color-accent] stroke-[--color-accent]' : 'fill-[--text-normal] stroke-[--text-normal]'}"
viewBox="30 29 300 300"
>
<defs>
<style>
.cls-1,
.cls-2,
.cls-3,
.cls-4,
.cls-5,
.cls-6,
.cls-7 {
fill: none;
stroke-miterlimit: 10;
}
.cls-1,
.cls-6 {
stroke-width: 6px;
}
.cls-2 {
stroke-width: 8px;
}
.cls-2,
.cls-3,
.cls-4,
.cls-6 {
stroke-linecap: round;
}
.cls-8 {
stroke-width: 0px;
}
.cls-3,
.cls-5 {
stroke-width: 3px;
}
.cls-4,
.cls-7 {
stroke-width: 5px;
}
</style>
</defs>
<g>
<path class="cls-6" d="m119.76,235.22c-95.84-79.16-30.4-176.18,30.3-196.33,62.91-20.88,130.24,17.36,146.97,78.91,9.76,35.91,6.2,96.83-59.52,124.16" />
<path class="cls-4" d="m243.98,295.97c11.44,2.55,26.63-2.2,34.9-11.47,7.62-8.53,9.26-23.71-1.37-28.68-3.1-1.41-8.39-4.34-25.26,9.89" />
<path class="cls-4" d="m211.26,239.39c-7.07,16.12-9.01,30.06-3.44,43.38" />
<path class="cls-4" d="m255.03,262.83c-6.24-7.97-11.64-16.69-10.26-24.14" />
<path
class="cls-4"
d="m255.03,236.29c2.53,8.15,26.76,18.29,38.06-3.65,10.38-20.15,19.18-14.03,21.22-12.74,5.69,3.59,5.08,19.12,5.08,23.19,0,19.72-15.37,27.77-25.17,30.41-2.45.66-4.93.86-7.41.7"
/>
<path class="cls-2" d="m159.81,196.17c0,15.73,19.25,11.74,19.25.27" />
<path
class="cls-8"
d="m100.68,183.58c-.39-15.51,10.1-29.27,22.64-29.7,13.25-.46,24.05,11.76,24.39,27.61.36,16.39-9.78,29.86-22.87,30.39-13.03.52-23.76-12.03-24.17-28.3Zm33.87-3.78c3.85-.06,6.61-4.11,5.8-8.83-.87-5.07-3.33-8.55-7.51-9.86-3.76-1.18-7.21,1.93-7.48,6.67-.35,6.1,4.24,12.1,9.19,12.02Z"
/>
<path
class="cls-8"
d="m195.6,186.94c-.39-15.51,10.1-29.27,22.64-29.7,13.25-.46,24.05,11.76,24.39,27.61.36,16.39-9.78,29.86-22.87,30.39-13.03.52-23.76-12.03-24.17-28.3Zm33.87-3.78c3.85-.06,6.61-4.11,5.8-8.83-.87-5.07-3.33-8.55-7.51-9.86-3.76-1.18-7.21,1.93-7.48,6.67-.35,6.1,4.24,12.1,9.19,12.02Z"
/>
<path class="cls-4" d="m142.53,236.39c3.51,8.36,5.19,30.91-4.14,35.41" />
<path
class="cls-7"
d="m108.7,225.33c-17.93,8.39-29.31,4.95-35.4-7.63-.41-.95-3.65-7.37-9.47-7.99-3.69-.39-6.51,1.35-7.6,1.96-5.84,3.27-5.99,18.65-6.19,22.67-.3,6.17.29,12.61,4.66,19.09,2.99,4.44,7.61,6.3,10.03,7.71"
/>
<path class="cls-3" d="m223.9,267.43c-2.25-3.2-3.93-6.85-4.74-10.8" />
<path
class="cls-4"
d="m150.65,275.2c-11.27,3.93-16.8-9.25-23.58-17.48-1.15-1.4-3.84-3.56-7.8-4.56-.16-.04-2.65-.65-5.03-.41-6.83.68-12.82,7.92-14.1,13.2-5.53,22.77,9.93,36.73,18.74,41.48,14.52,7.82,36.47,6.91,55.1-5.68"
/>
<path
class="cls-4"
d="m179.07,235.47c-25.49,54.97,4.84,82.78,29.94,83.89,18.49.81,39.76-16.08,36.23-39.13-1.17-7.62-6.37-11.88-13.47-12.86-12.08-1.66-16.81,20.98-32.09,15.06"
/>
<g>
<path class="cls-5" d="m282.77,261.99c23.21-10.24,10.89-38.79,20.22-42.51" />
<path class="cls-3" d="m171.08,287.69c-22.21,15.19-37.76-9.57-40.91-19.61-4.83-15.38-10.76-15.33-16.18-15.33" />
<path class="cls-3" d="m98.59,263.83c-9.83-2.58-13.76-12.61-14.84-19.93-.61-4.1-1.74-10.92-11.89-10.58" />
<path class="cls-5" d="m66.89,235.29c-1.98-10.95,1.21-26.31-7.4-23.88" />
<path class="cls-5" d="m277.5,255.83c-2.71-1.29-13.23-4.09-17.22,13.97-1.87,8.48-7.96,11.66-14.93,11.04" />
<path class="cls-3" d="m171.83,287.26c5.8,9.77,15.91,17.37,31.37,11.41,13.36-5.16,9.97-24.24,21.68-28.87,4.31-1.7,7.1-1.94,10.53-1.58" />
</g>
<path
class="cls-4"
d="m97.64,280.44c-9.05.55-18.91-2.53-27.09-10.3-7.09-6.73-13.32-25.71-5.07-33.63,4.33-4.15,10.93-3.55,11.24-3.52,11,1.17,13.58,14.25,21.42,14.82,4.06.3,9.51-2.17,17.18-16.37"
/>
<path
class="cls-1"
d="m70.55,152.49c9.11-9.88,30.06-28.17,46.89-28.07,21.67.13,19.1,25.53,52.73,24.8,37.98-.82,27.35-16.61,52.43-19.52,15.57-1.81,40.86,11.57,76.26,31.09"
/>
</g>
<path
class="cls-8"
d="m102.06,128.35c4.62-2.2,9.56-4.14,16.68-4.29-.71-6.67-.5-13.88,1.03-17.71.93-2.33,2.45-4.98,5.21-3.62,2.45,1.2,1.71,3.65.62,6.02-3.77,8.25-.66,22.15,10.41,24.11,9.88,14.4,24.28,16.98,40.7,14.31-6.82-5.42-13.63-10.88-20.74-15.85-4.25-2.97-6.98-7.03-8.63-11.91-3.21-9.48-1.8-18.82,4.52-26.79,5.62-7.1,18.07-7.93,23.34-5.88,4.25,2.06,6.23,4.67,9.77,8.15,1,.98,2.36,4.14.73,5.59-1.63,1.45-3.71-.07-5.09-.94-2.26-1.43-3.96-3.84-6.19-5.33-6.84-4.56-16.86-1.51-20.28,5.97-3.91,8.57-2.98,17.38,3.54,23.2,5.67,5.05,12.04,9.23,18.29,13.5,5.79,3.96,9.84,5.58,11.84,10.61,5.03-1.57,9.84-3.83,14.18-7.63-4.93-9.76-12.33-17.33-22.24-22.55-2.08-1.1-4.68-2.15-3.34-5.23,1.44-3.32,3.98-2.11,6.29-.96,10.97,5.46,17.7,12.62,23.77,23.62,4.39-3.22,8.94-5.09,13.63-5.59.52-8.32-3.6-14.28-8.61-19.49-2.69-2.8-6.37-4.53-8.94-7.43-3.4-3.85-6.34-8.24-9.08-12.69-1.14-1.86-1.36-4.96,1.62-5.6,1.2-.26,3.01,1.67,4.04,3.05,1.54,2.09,2.22,5.08,4,6.79,3.93,3.76,8.32,6.94,12.46,10.32,3.02-3.47,5.42-6.98,8.48-9.53,2.84-2.37,6.29-4.07,9.67-5.35,1.18-.45,4.3-.41,4.46,1.93.17,2.34-1.83,3.64-3.14,4.2-5.36,2.28-10.19,5.22-12.51,11.19-.77,1.97-.85,4.96.02,6.7,2.75,5.5,4.4,11.12,3.77,17.62,13.59,2.85,26.65,6.59,37.54,14.05,7.57-2.41,9.63-3.51,10.67-14.52,1.52-16.07-12.65-27.75-26.31-21.45-2.68,1.24-4.75,4.11-7.29,5.88-2.38,2.36-1.82,3.68-5.03,2.03s-.47-4.73.51-6.11c5.59-7.91,13.2-10.71,21.92-10,1.11.09,2.22.29,3.34.44,1.31-19.03-21-32.02-35.16-28.07.14.84.61,1.84.34,2.53-.57,1.43-1.31,3.19-2.42,3.83-.67.38-2.88-.8-3.21-1.8-4.95-15.26-26.8-19.94-38.49-15.68-4.38,1.59-8.21,5.17-12.39,7.62-1.54.9-4.01,2.18-4.95,1.51-2.24-1.58-1.11-3.98.58-5.94.8-.92,1.53-1.9,2.32-2.89-8.31-3.73-28.54,3.65-34.51,12.57,3.14,1.56,6.45,2.8,9.3,4.8,1.04.73,2.74,3.17,1.39,4.95-1.34,1.78-3.72,1.14-4.93.45-13.32-7.55-26.24-3-33.62,12.73-4.68,9.98-6.91,20.3-3.88,30.6h0Zm141.09,1.88c5.3-8.49,11.49-9.41,20.1-6.01,2.03.8,4.6,1.58,3.34,4.8-1.17,3.01-3.35,1.78-5.31,1.01-4.19-1.64-8.23-1.8-11.94,2.1l-6.19-1.9Z"
/>
</svg>
113 changes: 0 additions & 113 deletions src/components/Logos/LogoSimple.svelte

This file was deleted.

4 changes: 0 additions & 4 deletions src/components/Modal/PullModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@
import { data } from '../../store';
import { OllamaGenModelNames, OllamaEmbedModelNames } from '../Settings/models';
import { getOllamaModels, ollamaGenChange, ollamaEmbedChange } from '../../controller/Ollama';
import type { PullModal } from './PullModal';
import DotAnimation from '../base/DotAnimation.svelte';
export let modal: PullModal;
let model = '';
let isOllama: boolean;
let pulledModel = false;
let installedOllamaModels: string[] = [];
Expand Down
3 changes: 0 additions & 3 deletions src/components/Modal/RemoveModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
import { deleteOllamaModels, isOllamaRunning } from '../../controller/Ollama';
import { t } from 'svelte-i18n';
import { getOllamaModels } from '../../controller/Ollama';
import type { PullModal } from './PullModal';
import DropdownComponent from '../base/Dropdown.svelte';
import DotAnimation from '../base/DotAnimation.svelte';
export let modal: PullModal;
let model = '';
let isOllama: boolean;
let installedOllamaModels: string[] = [];
Expand Down
2 changes: 1 addition & 1 deletion src/components/Onboarding/Onboarding.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import DaemonComponent from './OllamaDaemon.svelte';
import IncognitoToggle from '../Settings/IncognitoToggle.svelte';
import { t } from 'svelte-i18n';
import Logo from '../Logos/LogoDetailed.svelte';
import Logo from '../Logos/Logo.svelte';
const osType = os.type();
Expand Down
2 changes: 2 additions & 0 deletions src/components/base/Toggle.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
export let changeFunc: () => void;
</script>

<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div class="checkbox-container" class:is-enabled={isEnabled} on:click={changeFunc}>
<input type="checkbox" tabindex="0" />
</div>
6 changes: 2 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,8 @@ export default class SecondBrainPlugin extends Plugin {
async (result) => {
if (result === 'Yes') {
await this.saveData({});
const files = (await this.app.vault.adapter.list(normalizePath(this.manifest.dir))).files;
for (const file of files) {
if (file.endsWith('vector-store.bin')) await this.app.vault.adapter.remove(file);
}
const files = (await this.app.vault.adapter.list(normalizePath(this.manifest.dir + '/vectorstores'))).files;
for (const file of files) await this.app.vault.adapter.remove(file);
new Notice(t('notice.plugin_data_cleared'), 4000);
await this.loadSettings();
await this.activateView();
Expand Down

0 comments on commit b029db5

Please sign in to comment.