Skip to content

Conversation

@allozaur
Copy link
Owner

No description provided.

ServeurpersoCom and others added 30 commits January 5, 2026 09:00
…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
Comment on lines +2 to +6
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';
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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';

Comment on lines +30 to +107
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);'
);
Copy link
Owner Author

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

Comment on lines +47 to +49
{ value: ColorMode.SYSTEM, label: 'System', icon: Monitor },
{ value: ColorMode.LIGHT, label: 'Light', icon: Sun },
{ value: ColorMode.DARK, label: 'Dark', icon: Moon }
Copy link
Owner Author

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

Copy link
Owner Author

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

Comment on lines +2 to +10
/**
* 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.
*/
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/**
* 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

Copy link
Owner Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants