diff --git a/Components/TopBar.svelte b/Components/TopBar.svelte index 49383d1..9825e8c 100644 --- a/Components/TopBar.svelte +++ b/Components/TopBar.svelte @@ -1,14 +1,15 @@ @@ -107,6 +117,13 @@ on:click={openSettings} aria-label="AI Agent Settings" > + {#if conversationTitle !== ""}
{conversationTitle}
@@ -137,7 +154,7 @@ grid-column: 2; display: grid; grid-template-rows: auto; - grid-template-columns: var(--size-4-2) auto auto auto auto auto auto 1fr 0.1fr auto var(--size-4-2); + grid-template-columns: var(--size-4-2) auto auto auto auto auto auto auto 1fr 0.1fr auto var(--size-4-2); background-color: var(--background-modifier-hover); border-radius: var(--radius-m); } @@ -182,14 +199,19 @@ grid-column: 6; } - #conversation-divider-2 { + #help-menu-button { grid-row: 1; grid-column: 7; } - #conversation-title { + #conversation-divider-2 { grid-row: 1; grid-column: 8; + } + + #conversation-title { + grid-row: 1; + grid-column: 9; display: inline-block; align-self: center; white-space: nowrap; @@ -201,6 +223,6 @@ #close-button { grid-row: 1; - grid-column: 10; + grid-column: 11; } diff --git a/LICENSE b/LICENSE index 287f37a..837061e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,21 @@ -Copyright (C) 2020-2025 by Dynalist Inc. +MIT License -Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. +Copyright (c) 2025 Andy-Stack -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/Modals/ConversationHistoryModal.ts b/Modals/ConversationHistoryModal.ts index 81e8477..2e035e4 100644 --- a/Modals/ConversationHistoryModal.ts +++ b/Modals/ConversationHistoryModal.ts @@ -10,6 +10,7 @@ import { dateToString } from 'Helpers/Helpers'; import { conversationStore } from 'Stores/ConversationStore'; import { Selector } from 'Enums/Selector'; import type { ChatService } from 'Services/ChatService'; +import type AIAgentPlugin from 'main'; interface IListItem { id: string; @@ -31,8 +32,9 @@ export class ConversationHistoryModal extends Modal { private conversations: Conversation[]; public onModalClose?: () => void; - constructor(app: App) { - super(app); + constructor() { + const plugin = Resolve(Services.AIAgentPlugin); + super(plugin.app); } override async open() { diff --git a/Modals/ConversationHistoryModalSvelte.svelte b/Modals/ConversationHistoryModalSvelte.svelte index c2f8b3d..af1129c 100644 --- a/Modals/ConversationHistoryModalSvelte.svelte +++ b/Modals/ConversationHistoryModalSvelte.svelte @@ -2,260 +2,260 @@ import { setIcon } from "obsidian"; import { fade } from "svelte/transition"; - export let items: Array<{id: string, date: string, updated: Date, title: string, selected: boolean}>; - export let onClose: () => void; - export let onDelete: (itemIds: string[]) => void; - export let onSelect: (itemId: string) => void; - - let deleteButton: HTMLButtonElement; - let closeButton: HTMLButtonElement; + export let items: Array<{id: string, date: string, updated: Date, title: string, selected: boolean}>; + export let onClose: () => void; + export let onDelete: (itemIds: string[]) => void; + export let onSelect: (itemId: string) => void; - $: if (deleteButton) { - setIcon(deleteButton, 'trash-2'); + let deleteButton: HTMLButtonElement; + let closeButton: HTMLButtonElement; + + $: if (deleteButton) { + setIcon(deleteButton, 'trash-2'); + } + $: if (closeButton) { + setIcon(closeButton, 'circle-x'); + } + + let selectedItems = new Set(); + let searchQuery = ""; + + $: filteredItems = items.filter(item => + item.title.toLowerCase().includes(searchQuery.toLowerCase()) + ).sort((a, b) => b.updated.getTime() - a.updated.getTime()); + + function toggleSelection(itemId: string) { + if (selectedItems.has(itemId)) { + selectedItems.delete(itemId); + } else { + selectedItems.add(itemId); } - $: if (closeButton) { - setIcon(closeButton, 'circle-x'); + selectedItems = selectedItems; + } + + function handleDelete() { + if (selectedItems.size === 0) { + return; } + onDelete(Array.from(selectedItems)); + items = items.filter((item) => !selectedItems.has(item.id)) + selectedItems.clear(); + selectedItems = selectedItems; + } - let selectedItems = new Set(); - let searchQuery = ""; + function handleConversationClick(itemId: string, event: UIEvent) { + onSelect(itemId); + } + - $: filteredItems = items.filter(item => - item.title.toLowerCase().includes(searchQuery.toLowerCase()) - ).sort((a, b) => b.updated.getTime() - a.updated.getTime()); - - function toggleSelection(itemId: string) { - if (selectedItems.has(itemId)) { - selectedItems.delete(itemId); - } else { - selectedItems.add(itemId); - } - selectedItems = selectedItems; - } - - function handleDelete() { - if (selectedItems.size === 0) { - return; - } - onDelete(Array.from(selectedItems)); - items = items.filter((item) => !selectedItems.has(item.id)) - selectedItems.clear(); - selectedItems = selectedItems; - } - - function handleConversationClick(itemId: string, event: UIEvent) { - onSelect(itemId); - } - - -
-
-
- - - -
-
-
- {#if filteredItems.length === 0} -

- No conversations match your search. -

- {:else} - {#each filteredItems as item (item.id)} -
-
handleConversationClick(item.id, e)} - on:keydown={(e) => e.key === 'Enter' && handleConversationClick(item.id, e)} - role="button" - tabindex="0"> - {item.date} - | - {item.title} -
- toggleSelection(item.id)} - /> -
- {/each} - {/if} +
+
+
+ + +
- - \ No newline at end of file + .conversation-search-input:focus { + border-color: var(--color-accent); + max-width: 100%; + transition: border-color 0.3s ease-out; + transition: max-width 0.3s ease-out; + } + + .conversation-search-input::placeholder { + color: var(--text-muted); + } + \ No newline at end of file diff --git a/Modals/HelpModal.ts b/Modals/HelpModal.ts new file mode 100644 index 0000000..331206f --- /dev/null +++ b/Modals/HelpModal.ts @@ -0,0 +1,13 @@ +import type AIAgentPlugin from "main"; +import { Modal } from "obsidian"; +import { Resolve } from "Services/DependencyService"; +import { Services } from "Services/Services"; + +export class HelpModal extends Modal { + + public constructor() { + const plugin = Resolve(Services.AIAgentPlugin); + super(plugin.app); + } + +} \ No newline at end of file diff --git a/Modals/HelpModalSvelte.svelte b/Modals/HelpModalSvelte.svelte new file mode 100644 index 0000000..6284296 --- /dev/null +++ b/Modals/HelpModalSvelte.svelte @@ -0,0 +1,10 @@ + + +
+ Testing... +
+ + \ No newline at end of file diff --git a/Services/ServiceRegistration.ts b/Services/ServiceRegistration.ts index 36aecf1..369a40d 100644 --- a/Services/ServiceRegistration.ts +++ b/Services/ServiceRegistration.ts @@ -34,7 +34,8 @@ import { UserInputService } from "./UserInputService"; import { SearchStateStore } from "Stores/SearchStateStore"; import { InputService } from "./InputService"; import { HTMLService } from "./HTMLService"; -import { SettingsService, type IAIAgentSettings } from "./SettingsService"; +import { SettingsService } from "./SettingsService"; +import { HelpModal } from "Modals/HelpModal"; export async function RegisterPlugin(plugin: AIAgentPlugin) { RegisterSingleton(Services.AIAgentPlugin, plugin); @@ -66,7 +67,7 @@ export function RegisterDependencies() { RegisterTransient(Services.StreamingMarkdownService, () => new StreamingMarkdownService()); RegisterTransient(Services.InputService, () => new InputService()); - RegisterModals(plugin.app); + RegisterModals(); RegisterAiProvider(); } @@ -94,6 +95,7 @@ export function RegisterAiProvider() { Resolve(Services.ConversationNamingService).resolveNamingProvider(); } -function RegisterModals(app: App) { - RegisterTransient(Services.ConversationHistoryModal, () => new ConversationHistoryModal(app)); +function RegisterModals() { + RegisterTransient(Services.ConversationHistoryModal, () => new ConversationHistoryModal()); + RegisterTransient(Services.HelpModal, () => new HelpModal()) } \ No newline at end of file diff --git a/Services/Services.ts b/Services/Services.ts index 69df5f0..d5a2a80 100644 --- a/Services/Services.ts +++ b/Services/Services.ts @@ -31,4 +31,5 @@ export class Services { // modals static ConversationHistoryModal = Symbol("ConversationHistoryModal"); + static HelpModal = Symbol("HelpModal"); } \ No newline at end of file diff --git a/main.ts b/main.ts index 5b14aa8..6250f6f 100644 --- a/main.ts +++ b/main.ts @@ -41,7 +41,7 @@ export default class AIAgentPlugin extends Plugin { this.addSettingTab(new AIAgentSettingTab()); this.app.workspace.onLayoutReady(async () => { - await this.setup(this); + await this.setup(); }); } @@ -69,7 +69,7 @@ export default class AIAgentPlugin extends Plugin { } // create example user instruction (on first launch only) - private async setup(plugin: AIAgentPlugin) { + private async setup() { const settingsService = Resolve(Services.SettingsService); if (!settingsService.settings.firstTimeStart) { return;