]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/blob
2dcb36baf6800b8119afdd69724b0f98c24bfc06
[pkg/ggml/sources/llama.cpp] /
1 <script lang="ts">
2 import {
3 ChatMessageActionIcons,
4 ChatMessageEditForm,
5 ChatMessageMcpPromptContent
6 } from '$lib/components/app';
7 import { getMessageEditContext } from '$lib/contexts';
8 import { MessageRole, McpPromptVariant } from '$lib/enums';
9 import type { DatabaseMessageExtraMcpPrompt } from '$lib/types';
10
11 interface Props {
12 class?: string;
13 message: DatabaseMessage;
14 mcpPrompt: DatabaseMessageExtraMcpPrompt;
15 siblingInfo?: ChatMessageSiblingInfo | null;
16 showDeleteDialog: boolean;
17 deletionInfo: {
18 totalCount: number;
19 userMessages: number;
20 assistantMessages: number;
21 messageTypes: string[];
22 } | null;
23 onCopy: () => void;
24 onEdit: () => void;
25 onDelete: () => void;
26 onConfirmDelete: () => void;
27 onNavigateToSibling?: (siblingId: string) => void;
28 onShowDeleteDialogChange: (show: boolean) => void;
29 }
30
31 let {
32 class: className = '',
33 message,
34 mcpPrompt,
35 siblingInfo = null,
36 showDeleteDialog,
37 deletionInfo,
38 onCopy,
39 onEdit,
40 onDelete,
41 onConfirmDelete,
42 onNavigateToSibling,
43 onShowDeleteDialogChange
44 }: Props = $props();
45
46 // Get edit context
47 const editCtx = getMessageEditContext();
48 </script>
49
50 <div
51 aria-label="MCP Prompt message with actions"
52 class="group flex flex-col items-end gap-3 md:gap-2 {className}"
53 role="group"
54 >
55 {#if editCtx.isEditing}
56 <ChatMessageEditForm />
57 {:else}
58 <ChatMessageMcpPromptContent
59 prompt={mcpPrompt}
60 variant={McpPromptVariant.MESSAGE}
61 class="w-full max-w-[80%]"
62 />
63
64 {#if message.timestamp}
65 <div class="max-w-[80%]">
66 <ChatMessageActionIcons
67 actionsPosition="right"
68 {deletionInfo}
69 justify="end"
70 {onConfirmDelete}
71 {onCopy}
72 {onDelete}
73 {onEdit}
74 {onNavigateToSibling}
75 {onShowDeleteDialogChange}
76 {siblingInfo}
77 {showDeleteDialog}
78 role={MessageRole.USER}
79 />
80 </div>
81 {/if}
82 {/if}
83 </div>