feat: Ollama models command, with load/pull/delete and unload (#16)
This commit was merged in pull request #16.
This commit is contained in:
+6
-4
@@ -1,9 +1,9 @@
|
||||
import { Action, ActionPanel, Clipboard, Icon, List, useNavigation } from "@vicinae/api";
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { runAutoDelete } from "./lib/cleanup";
|
||||
import { ChatView } from "./lib/components/ChatView";
|
||||
import { sessionToPlainText } from "./lib/markdown";
|
||||
import { getLamPreferences } from "./lib/preferences";
|
||||
import { loadPreferences } from "./lib/preferences";
|
||||
import { clearSessions, deleteSession, listSessions, loadSession } from "./lib/sessions";
|
||||
import type { SessionSummary } from "./lib/types";
|
||||
import { formatRelativeTime, truncate } from "./lib/utils";
|
||||
@@ -18,7 +18,6 @@ import { formatRelativeTime, truncate } from "./lib/utils";
|
||||
export default function SessionsCommand() {
|
||||
const { push } = useNavigation();
|
||||
const [sessions, setSessions] = useState<SessionSummary[] | undefined>(undefined);
|
||||
const preferences = useMemo(() => getLamPreferences(), []);
|
||||
|
||||
const refresh = useCallback(() => {
|
||||
void listSessions()
|
||||
@@ -34,6 +33,9 @@ export default function SessionsCommand() {
|
||||
let cancelled = false;
|
||||
|
||||
void (async () => {
|
||||
// Read here rather than at render time: preferences are asynchronous now
|
||||
// that the model selection has to be layered on top of them.
|
||||
const preferences = await loadPreferences();
|
||||
await runAutoDelete({ maxAgeMs: preferences.autoDeleteMs });
|
||||
if (!cancelled) refresh();
|
||||
})();
|
||||
@@ -41,7 +43,7 @@ export default function SessionsCommand() {
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [preferences.autoDeleteMs, refresh]);
|
||||
}, [refresh]);
|
||||
|
||||
const openSession = useCallback(
|
||||
(id: string) => {
|
||||
|
||||
Reference in New Issue
Block a user