refactor: remove assistant chat archiving

This commit is contained in:
ajnart committed 2026-08-14 11:32:10 +02:00
1 parent 26a9752206
commit d37a2ba963
12 files changed
+8 -79

No files matched your search

@@ -34,7 +34,6 @@ import {
IconActivityHeartbeat,
IconAlertTriangle,
IconApps,
IconArchive,
IconArrowUp,
IconCheck,
IconChevronUp,
@@ -44,7 +43,6 @@ import {
IconPlayerStop,
IconPlus,
IconRefresh,
IconRestore,
IconRobot,
IconSearch,
IconTrash,
@@ -237,45 +235,6 @@ const ThreadListItem = () => {
<ThreadListItemPrimitive.Title fallback={t("newConversation")} />
</Button>
</ThreadListItemPrimitive.Trigger>
<ThreadListItemPrimitive.Archive asChild>
<ActionIcon variant="subtle" color="gray" size="sm" aria-label={t("archive")}>
<IconArchive size={14} />
</ActionIcon>
</ThreadListItemPrimitive.Archive>
<ThreadListItemPrimitive.Delete asChild>
<ActionIcon variant="subtle" color="red" size="sm" aria-label={t("delete")}>
<IconTrash size={14} />
</ActionIcon>
</ThreadListItemPrimitive.Delete>
</Group>
</ThreadListItemPrimitive.Root>
);
};
const ArchivedThreadListItem = () => {
const t = useScopedI18n("common.assistant");
const onSelect = useContext(HistorySelectContext);
return (
<ThreadListItemPrimitive.Root className={classes.historyItem}>
<Group gap={4} wrap="nowrap">
<ThreadListItemPrimitive.Trigger asChild>
<Button
variant="subtle"
color="gray"
size="compact-sm"
justify="flex-start"
flex={1}
style={{ minWidth: 0 }}
onClick={onSelect}
>
<ThreadListItemPrimitive.Title fallback={t("archivedConversation")} />
</Button>
</ThreadListItemPrimitive.Trigger>
<ThreadListItemPrimitive.Unarchive asChild>
<ActionIcon variant="subtle" color="gray" size="sm" aria-label={t("restore")}>
<IconRestore size={14} />
</ActionIcon>
</ThreadListItemPrimitive.Unarchive>
<ThreadListItemPrimitive.Delete asChild>
<ActionIcon variant="subtle" color="red" size="sm" aria-label={t("delete")}>
<IconTrash size={14} />
@@ -307,10 +266,6 @@ const ThreadHistory = ({ onSelect }: { onSelect: () => void }) => {
<ScrollArea h="min(24rem, 55dvh)" type="auto" offsetScrollbars>
<Stack gap={3}>
<ThreadListPrimitive.Items components={{ ThreadListItem }} />
<Text size="sm" fw={600} c="dimmed" px="xs" mt="sm">
{t("archived")}
</Text>
<ThreadListPrimitive.Items archived components={{ ThreadListItem: ArchivedThreadListItem }} />
</Stack>
</ScrollArea>
</Stack>
@@ -52,6 +52,7 @@ interface AssistantContextValue {
}
const AssistantContext = createContext<AssistantContextValue | null>(null);
const ignoreUnsupportedArchiveAction = () => Promise.resolve();
export const useHomarrAssistant = () => {
const value = useContext(AssistantContext);
@@ -69,7 +70,7 @@ const threadAdapter: RemoteThreadListAdapter = {
return {
threads: threads.map((thread) => ({
remoteId: thread.id,
status: thread.status,
status: "regular",
title: thread.title ?? undefined,
lastMessageAt: thread.updatedAt,
custom: { modelId: thread.modelId },
@@ -84,7 +85,7 @@ const threadAdapter: RemoteThreadListAdapter = {
const { thread } = await fetchApi.assistant.getThread.query({ threadId });
return {
remoteId: thread.id,
status: thread.status,
status: "regular",
title: thread.title ?? undefined,
lastMessageAt: thread.updatedAt,
custom: { modelId: thread.modelId },
@@ -93,12 +94,9 @@ const threadAdapter: RemoteThreadListAdapter = {
async rename(threadId, title) {
await fetchApi.assistant.renameThread.mutate({ threadId, title });
},
async archive(threadId) {
await fetchApi.assistant.setThreadStatus.mutate({ threadId, status: "archived" });
},
async unarchive(threadId) {
await fetchApi.assistant.setThreadStatus.mutate({ threadId, status: "regular" });
},
// assistant-ui requires these callbacks even when the product does not expose archiving.
archive: ignoreUnsupportedArchiveAction,
unarchive: ignoreUnsupportedArchiveAction,
async delete(threadId) {
await fetchApi.assistant.deleteThread.mutate({ threadId });
},