* chore: `npm audit fix --force` * feat: Update sidebar toggle to use Logo * refactor: Clean up favicon SVG * feat: Refactor logo component and implement theme-aware favicon generation * feat: Add configurable padding to generated PWA assets * test: Add unit tests for writeThemeFavicons * refactor: Componentization * feat: WIP * feat: WIP * feat: WIP * feat: Mobile UI * feat: add SEARCH route constant * feat: create SidebarNavigationSearchResults component * refactor: use SidebarNavigationSearchResults in conversation list * feat: enable mobile search navigation in sidebar actions * feat: add mobile search route and page * fix: prevent sidebar overflow on mobile viewports * fix: Mobile sidebar * feat: Mobile Search WIP * feat: Mobile WIP * feat: Add PWA standalone detection and refine mobile UI * feat: Improve mobile layout, sidebar handling, and chat scrolling * feat: Improve mobile sidebar visibility and iOS Safari chat spacing * fix: Disable auto-scroll on mobile * chore: Linting * fix: Wrong condition * feat: Mobile chat scroll * refactor: WIP * fix: Desktop initial scroll always working again * fix: Partial fix for mobile auto-scroll / initial scroll * fix: Desktop auto-scroll on initial load and during streaming * fix: Mobile scrolling logic * refactor: Clean up * feat: Improve start UI * feat: Add `delay` to `fadeInView` * feat: Auto-scroll button * refactor: Cleanup * refactor: Extract chat dialogs and alerts into dedicated component * refactor: Reorganize ChatScreen component structure and initialization * feat: Improve auto-scroll after sending message * feat: UI improvements * fix: Settings link * feat: UI improvements * fix: better UI spacing * fix: Remove unneeded logic * fix: Chat Processing Info UI rendering * feat: Improve mobile UI * feat: UI improvement * fix: Conditional transition delay for Chat Messages based on route from * fix: Delay mobile sidebar collapse for smoother transitions * fix: Mobile scroll down button + sidebar pointer events * fix: Mobile UI * fix: Auto scrolling * fix: Implement dynamic height calculations for chat auto-scroll positioning and UI elements * fix: Retrieve `autofocus` for Chat Form textarea * fix: Use proper class Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * refactor: extract scroll-to-bottom logic and fix message send flow * fix: update viewport store usage and remove conflicting autofocus * feat: add accessibility labels to scroll down button * fix: correct HTML structure in sidebar empty states * fix: dynamically toggle processing info visibility * chore: remove commented exports and fix formatting * fix * fix: Mobile Chat Form Add Action Sheet interactions --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
101 lines
2.4 KiB
TypeScript
101 lines
2.4 KiB
TypeScript
/**
|
|
* Active model resolution and capability detection for the ChatScreen.
|
|
*
|
|
* Picks the model that should be used for the current view
|
|
* (router: user-selected or conversation fallback; non-router: first
|
|
* available option), and reactively tracks which modalities (vision /
|
|
* audio / video) it supports — fetching model props from the server on
|
|
* demand if they aren't cached yet.
|
|
*/
|
|
|
|
import { modelsStore, modelOptions, selectedModelId } from '$lib/stores/models.svelte';
|
|
import { isRouterMode } from '$lib/stores/server.svelte';
|
|
import { chatStore } from '$lib/stores/chat.svelte';
|
|
import { activeMessages } from '$lib/stores/conversations.svelte';
|
|
|
|
export function useChatScreenActiveModel() {
|
|
const isRouter = $derived(isRouterMode());
|
|
const conversationModel = $derived(
|
|
chatStore.getConversationModel(activeMessages() as DatabaseMessage[])
|
|
);
|
|
|
|
const activeModelId = $derived.by(() => {
|
|
const options = modelOptions();
|
|
|
|
if (!isRouter) {
|
|
return options.length > 0 ? options[0].model : null;
|
|
}
|
|
|
|
const selectedId = selectedModelId();
|
|
if (selectedId) {
|
|
const model = options.find((m) => m.id === selectedId);
|
|
if (model) return model.model;
|
|
}
|
|
|
|
if (conversationModel) {
|
|
const model = options.find((m) => m.model === conversationModel);
|
|
if (model) return model.model;
|
|
}
|
|
|
|
return null;
|
|
});
|
|
|
|
let modelPropsVersion = $state(0);
|
|
|
|
$effect(() => {
|
|
if (activeModelId) {
|
|
const cached = modelsStore.getModelProps(activeModelId);
|
|
if (!cached) {
|
|
modelsStore.fetchModelProps(activeModelId).then(() => {
|
|
modelPropsVersion++;
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|
|
const hasAudioModality = $derived.by(() => {
|
|
if (activeModelId) {
|
|
void modelPropsVersion;
|
|
return modelsStore.modelSupportsAudio(activeModelId);
|
|
}
|
|
return false;
|
|
});
|
|
|
|
const hasVideoModality = $derived.by(() => {
|
|
if (activeModelId) {
|
|
void modelPropsVersion;
|
|
return modelsStore.modelSupportsVideo(activeModelId);
|
|
}
|
|
return false;
|
|
});
|
|
|
|
const hasVisionModality = $derived.by(() => {
|
|
if (activeModelId) {
|
|
void modelPropsVersion;
|
|
return modelsStore.modelSupportsVision(activeModelId);
|
|
}
|
|
return false;
|
|
});
|
|
|
|
return {
|
|
get isRouter() {
|
|
return isRouter;
|
|
},
|
|
get conversationModel() {
|
|
return conversationModel;
|
|
},
|
|
get activeModelId() {
|
|
return activeModelId;
|
|
},
|
|
get hasAudioModality() {
|
|
return hasAudioModality;
|
|
},
|
|
get hasVideoModality() {
|
|
return hasVideoModality;
|
|
},
|
|
get hasVisionModality() {
|
|
return hasVisionModality;
|
|
}
|
|
};
|
|
}
|