-
Notifications
You must be signed in to change notification settings - Fork 1
Allozaur/mcp mvp #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…d per-chat overrides
…endency between ChatStore and ConversationsStore
refactor(models): Use new API fetch utilities refactor(props): Use new API fetch utilities
refactor(agentic-client): Extend BaseClient for store integration refactor(chat-client): Extend BaseClient for store integration refactor(conversations-client): Extend BaseClient for store integration
| import { ChatMessageActions, ChatMessageMcpPromptContent } from '$lib/components/app'; | ||
| import { getMessageEditContext } from '$lib/contexts'; | ||
| import { MessageRole, McpPromptVariant } from '$lib/enums'; | ||
| import type { DatabaseMessageExtraMcpPrompt } from '$lib/types'; | ||
| import ChatMessageEditForm from './ChatMessageEditForm.svelte'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| import { ChatMessageActions, ChatMessageMcpPromptContent } from '$lib/components/app'; | |
| import { getMessageEditContext } from '$lib/contexts'; | |
| import { MessageRole, McpPromptVariant } from '$lib/enums'; | |
| import type { DatabaseMessageExtraMcpPrompt } from '$lib/types'; | |
| import ChatMessageEditForm from './ChatMessageEditForm.svelte'; | |
| import { ChatMessageActions, ChatMessageEditForm, ChatMessageMcpPromptContent } from '$lib/components/app'; | |
| import { getMessageEditContext } from '$lib/contexts'; | |
| import { MessageRole, McpPromptVariant } from '$lib/enums'; | |
| import type { DatabaseMessageExtraMcpPrompt } from '$lib/types'; |
| let hoveredArgKey = $state<string | null>(null); | ||
| let argumentEntries = $derived(Object.entries(prompt.arguments ?? {})); | ||
| let hasArguments = $derived(prompt.arguments && Object.keys(prompt.arguments).length > 0); | ||
| let hasContent = $derived(prompt.content && prompt.content.trim().length > 0); | ||
| let serverSettingsMap = $derived.by(() => { | ||
| const servers = mcpStore.getServers(); | ||
| const map = new SvelteMap<string, MCPServerSettingsEntry>(); | ||
| for (const server of servers) { | ||
| map.set(server.id, server); | ||
| } | ||
| return map; | ||
| }); | ||
| function getServerFavicon(): string | null { | ||
| const server = serverSettingsMap.get(prompt.serverName); | ||
| return server ? getFaviconUrl(server.url) : null; | ||
| } | ||
| function getServerDisplayName(): string { | ||
| const server = serverSettingsMap.get(prompt.serverName); | ||
| if (!server) return prompt.serverName; | ||
| return mcpStore.getServerLabel(server); | ||
| } | ||
| let contentParts = $derived.by((): ContentPart[] => { | ||
| if (!prompt.content || !hasArguments) { | ||
| return [{ text: prompt.content || '', argKey: null }]; | ||
| } | ||
| const parts: ContentPart[] = []; | ||
| let remaining = prompt.content; | ||
| const valueToKey = new SvelteMap<string, string>(); | ||
| for (const [key, value] of argumentEntries) { | ||
| if (value && value.trim()) { | ||
| valueToKey.set(value, key); | ||
| } | ||
| } | ||
| const sortedValues = [...valueToKey.keys()].sort((a, b) => b.length - a.length); | ||
| while (remaining.length > 0) { | ||
| let earliestMatch: { index: number; value: string; key: string } | null = null; | ||
| for (const value of sortedValues) { | ||
| const index = remaining.indexOf(value); | ||
| if (index !== -1 && (earliestMatch === null || index < earliestMatch.index)) { | ||
| earliestMatch = { index, value, key: valueToKey.get(value)! }; | ||
| } | ||
| } | ||
| if (earliestMatch) { | ||
| if (earliestMatch.index > 0) { | ||
| parts.push({ text: remaining.slice(0, earliestMatch.index), argKey: null }); | ||
| } | ||
| parts.push({ text: earliestMatch.value, argKey: earliestMatch.key }); | ||
| remaining = remaining.slice(earliestMatch.index + earliestMatch.value.length); | ||
| } else { | ||
| parts.push({ text: remaining, argKey: null }); | ||
| break; | ||
| } | ||
| } | ||
| return parts; | ||
| }); | ||
| let showArgBadges = $derived(hasArguments && !isLoading && !loadError); | ||
| let isAttachment = $derived(variant === McpPromptVariant.ATTACHMENT); | ||
| let textSizeClass = $derived(isAttachment ? 'text-sm' : 'text-md'); | ||
| let maxHeightStyle = $derived( | ||
| isAttachment ? 'max-height: 10rem;' : 'max-height: var(--max-message-height);' | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-order with imports, props, context, variables, functions, effects, lifecycle order
| { value: ColorMode.SYSTEM, label: 'System', icon: Monitor }, | ||
| { value: ColorMode.LIGHT, label: 'Light', icon: Sun }, | ||
| { value: ColorMode.DARK, label: 'Dark', icon: Moon } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's have these options as constant from lib/constants
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to lib/components/app/actions
| /** | ||
| * CollapsibleInfoCard - Reusable collapsible card component | ||
| * | ||
| * Used for displaying thinking content, tool calls, and other collapsible information | ||
| * with a consistent UI pattern. | ||
| * | ||
| * Features auto-scroll during streaming: scrolls to bottom automatically, | ||
| * stops when user scrolls up, resumes when user scrolls back to bottom. | ||
| */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /** | |
| * CollapsibleInfoCard - Reusable collapsible card component | |
| * | |
| * Used for displaying thinking content, tool calls, and other collapsible information | |
| * with a consistent UI pattern. | |
| * | |
| * Features auto-scroll during streaming: scrolls to bottom automatically, | |
| * stops when user scrolls up, resumes when user scrolls back to bottom. | |
| */ |
We want to have JSDoc comments only in index files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably not needed anymore after removing the clients layer and moving back business logic to stores
No description provided.