Update.
This commit is contained in:
parent
45f446e2f3
commit
83cba54bf5
|
@ -11,5 +11,11 @@
|
|||
"svelte.plugin.svelte.compilerWarnings": {
|
||||
"a11y-no-noninteractive-element-interactions": "ignore",
|
||||
"a11y-click-events-have-key-events": "ignore"
|
||||
},
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "vscode.typescript-language-features"
|
||||
},
|
||||
"[json]": {
|
||||
"editor.defaultFormatter": "vscode.json-language-features"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,3 +8,10 @@ A simple notes app built with [SvelteKit](https://kit.svelte.dev/), [Kysely](htt
|
|||
- Local-first; all data is stored on-device
|
||||
|
||||
Hosted at https://notes.dallashoffman.com/
|
||||
|
||||
|
||||
# ollama
|
||||
|
||||
```
|
||||
OLLAMA_HOST=0.0.0.0:11434 ollama serve
|
||||
```
|
||||
|
|
File diff suppressed because it is too large
Load Diff
17
package.json
17
package.json
|
@ -23,18 +23,23 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@picocss/pico": "^1.5.10",
|
||||
"@sveltejs/adapter-static": "^3.0.1",
|
||||
"@sveltejs/kit": "^2.5.4",
|
||||
"@sveltejs/adapter-static": "^3.0.6",
|
||||
"@vite-pwa/assets-generator": "^0.2.4",
|
||||
"@vite-pwa/sveltekit": "^0.4.0",
|
||||
"patch-package": "^8.0.0",
|
||||
"prettier": "^2.8.0",
|
||||
"prettier-plugin-svelte": "^2.10.1",
|
||||
"prettier": "^3.3.2",
|
||||
"prettier-plugin-svelte": "^3.2.6",
|
||||
"sass": "^1.69.5",
|
||||
"svelte": "^4.2.12",
|
||||
"@sveltejs/adapter-node": "^5.2.2",
|
||||
"@sveltejs/kit": "^2.5.25",
|
||||
"@sveltejs/vite-plugin-svelte": "^4.0.0",
|
||||
"svelte": "^5.0.0",
|
||||
"svelte-check": "^3.6.8",
|
||||
"tslib": "^2.6.2",
|
||||
"typescript": "^5.4.3",
|
||||
"vite": "^5.2.3"
|
||||
"vite": "^5.0.3",
|
||||
"fast-glob": "^3.3.2",
|
||||
"openai": "^4.74.0",
|
||||
"ollama": "^0.5.10"
|
||||
}
|
||||
}
|
|
@ -3,11 +3,11 @@
|
|||
import ThemeToggle from '$lib/components/theme-toggle.svelte';
|
||||
</script>
|
||||
|
||||
<header class="app-header">
|
||||
<!-- <header class="app-header">
|
||||
<ThemeToggle />
|
||||
<h1 class="app-header__title">Notes</h1>
|
||||
<SettingsButton />
|
||||
</header>
|
||||
</header> -->
|
||||
|
||||
<style lang="scss">
|
||||
.app-header {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<style lang="scss">
|
||||
button {
|
||||
position: fixed;
|
||||
bottom: 2rem;
|
||||
bottom: 1rem;
|
||||
right: 1rem;
|
||||
width: 4rem;
|
||||
height: 4rem;
|
||||
|
|
|
@ -34,8 +34,12 @@
|
|||
<article class="note-card" style:--note-color={NoteColor[note.color][$themeUpperCase]}>
|
||||
<header class="note-card__header" hidden={$editing}>
|
||||
<div class="note-card__header-buttons">
|
||||
{#if !$editing}
|
||||
<NoteEditButton on:click={noteEditorStore.startEditing} />
|
||||
{/if}
|
||||
<NoteDeleteButton {note} {noteEditorStore} />
|
||||
<div class="note-card__spacer" />
|
||||
<NoteTimestamp {note} />
|
||||
<NoteColorPicker {note} {noteEditorStore} />
|
||||
<NoteTagButton on:click={focusTags} />
|
||||
</div>
|
||||
|
@ -51,16 +55,13 @@
|
|||
>
|
||||
<NoteContent {note} {noteEditorStore} />
|
||||
</div>
|
||||
{#if $editing}
|
||||
<footer class="note-card__footer">
|
||||
{#if !$editing}
|
||||
<NoteEditButton on:click={noteEditorStore.startEditing} />
|
||||
{:else}
|
||||
<NoteSaveButton on:click={noteEditorStore.save} />
|
||||
<NoteDiscardButton on:click={noteEditorStore.discard} />
|
||||
{/if}
|
||||
<div class="note-card__spacer" />
|
||||
<NoteTimestamp {note} />
|
||||
</footer>
|
||||
{/if}
|
||||
</article>
|
||||
|
||||
<style lang="scss">
|
||||
|
|
|
@ -5,5 +5,4 @@
|
|||
|
||||
<Button icon plain on:click>
|
||||
<FaPenToSquare />
|
||||
Edit
|
||||
</Button>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
import { get, type Unsubscriber } from 'svelte/store';
|
||||
|
||||
let noteListElement: HTMLUListElement;
|
||||
const noteHeight = 385;
|
||||
const noteHeight = 400;
|
||||
const noteGap = 16;
|
||||
const paddingRows = 2;
|
||||
let scrollHeight = 0;
|
||||
|
@ -105,8 +105,8 @@
|
|||
<style lang="scss">
|
||||
.note-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(0, calc(var(--note-height, 385px) * 0.92)));
|
||||
grid-auto-rows: var(--note-height, 385px);
|
||||
grid-template-columns: repeat(auto-fill, minmax(0, var(--note-height)));
|
||||
grid-auto-rows: var(--note-height);
|
||||
gap: var(--note-gap, 1rem);
|
||||
justify-content: center;
|
||||
height: var(--scroll-height, auto);
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<script lang="ts">
|
||||
import FaPlus from '$icon/fa-potato.svelte';
|
||||
import { notes } from '$lib/stores';
|
||||
</script>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
aria-label="Search note"
|
||||
data-tooltip="Search note"
|
||||
data-placement="left"
|
||||
on:click={() => notes.search()}
|
||||
>
|
||||
<FaPlus />
|
||||
</button>
|
||||
|
||||
<style lang="scss">
|
||||
button {
|
||||
position: fixed;
|
||||
bottom: 1rem;
|
||||
right: 6rem;
|
||||
width: 4rem;
|
||||
height: 4rem;
|
||||
margin: 0;
|
||||
border-radius: 50%;
|
||||
box-shadow: var(--card-shadow);
|
||||
|
||||
& > :global(svg) {
|
||||
width: 2rem;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -4,7 +4,8 @@
|
|||
import { settings } from '$lib/stores';
|
||||
</script>
|
||||
|
||||
<Button
|
||||
<button
|
||||
type="button"
|
||||
plain
|
||||
icon
|
||||
size="lg"
|
||||
|
@ -13,4 +14,21 @@
|
|||
on:click={() => settings.open.set(true)}
|
||||
>
|
||||
<FaGear />
|
||||
</Button>
|
||||
</button>
|
||||
|
||||
<style lang="scss">
|
||||
button {
|
||||
position: fixed;
|
||||
bottom: 6rem;
|
||||
right: 1rem;
|
||||
width: 4rem;
|
||||
height: 4rem;
|
||||
margin: 0;
|
||||
border-radius: 50%;
|
||||
box-shadow: var(--card-shadow);
|
||||
|
||||
& > :global(svg) {
|
||||
width: 2rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -4,6 +4,8 @@ import type { Insertable, Selectable, Updateable } from 'kysely';
|
|||
import { writable, type Readable, get, readonly } from 'svelte/store';
|
||||
import type { TagsStore } from './tags';
|
||||
import { settings } from '.';
|
||||
import OpenAI from 'openai';
|
||||
import { Ollama } from 'ollama'
|
||||
|
||||
export type Note = Selectable<Schema['note']>;
|
||||
export type NewNote = Insertable<Schema['note']>;
|
||||
|
@ -66,6 +68,20 @@ export class NotesStore implements Readable<Note[]> {
|
|||
return notes.find((note) => note.id === noteId);
|
||||
};
|
||||
|
||||
search = async () => {
|
||||
|
||||
const ol = new Ollama({ host: 'http://deve.work:11434' })
|
||||
const response = await ol.chat({
|
||||
model: 'qwen2.5-coder:14b',
|
||||
messages: [{ role: 'user', content: 'python编写1+1=?' }],
|
||||
})
|
||||
alert(response.message.content)
|
||||
|
||||
// const all = await db.selectFrom('note').selectAll().execute();
|
||||
// alert(all[0].content);
|
||||
return;
|
||||
};
|
||||
|
||||
add = async (newNote?: NewNote, scrollToTop?: boolean) => {
|
||||
if (!newNote) {
|
||||
newNote = {
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
import AppHeader from '$lib/components/app-header.svelte';
|
||||
import AppUpdatePrompt from '$lib/components/app-update-prompt.svelte';
|
||||
import FilterTags from '$lib/components/filter-tags.svelte';
|
||||
import NoteSearchButton from '$lib/components/notes/note-search-button.svelte';
|
||||
import SettingsButton from '$lib/components/settings/settings-button.svelte';
|
||||
import NoteAddButton from '$lib/components/notes/note-add-button.svelte';
|
||||
import NoteListPlaceholder from '$lib/components/notes/note-list-placeholder.svelte';
|
||||
import NoteList from '$lib/components/notes/note-list.svelte';
|
||||
|
@ -23,6 +25,8 @@
|
|||
{:else if $notesCount === 0}
|
||||
<NoteListPlaceholder />
|
||||
{/if}
|
||||
<SettingsButton />
|
||||
<NoteSearchButton />
|
||||
<NoteAddButton />
|
||||
</section>
|
||||
</main>
|
||||
|
|
Loading…
Reference in New Issue