char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
521a64cd0
char/aliceai-t5-moe
1/** 2* Active model resolution and capability detection for the ChatScreen. 3* 4* Picks the model that should be used for the current view 5* (router: user-selected or conversation fallback; non-router: first 6* available option), and reactively tracks which modalities (vision / 7* audio / video) it supports — fetching model props from the server on 8* demand if they aren't cached yet. 9*/ 10 11import { conversationsStore , modelsStore , serverStore } from '$lib/stores' ; 12import { getConversationModel } from '$lib/utils' ; 13 14export function useChatScreenActiveModel () { 15const isRouter = $derived ( serverStore . isRouterMode ); 16const conversationModel = $derived ( 17getConversationModel ( conversationsStore . activeMessages as DatabaseMessage []) 18); 19const activeModelId = $derived ( modelsStore . activeModelId ); 20 21let modelPropsVersion = $state ( 0 ); 22 23$effect (() => { 24if ( activeModelId ) { 25const cached = modelsStore . props . getModelProps ( activeModelId ); 26 27if ( ! cached ) { 28modelsStore . props . fetchModelProps ( activeModelId ). then (() => { 29modelPropsVersion ++ ; 30}); 31} 32} 33}); 34 35const hasAudioModality = $derived . by (() => { 36if ( activeModelId ) { 37void modelPropsVersion ; 38 39return modelsStore . props . modelSupportsAudio ( activeModelId ); 40} 41 42return false ; 43}); 44const hasVideoModality = $derived . by (() => { 45if ( activeModelId ) { 46void modelPropsVersion ; 47 48return modelsStore . props . modelSupportsVideo ( activeModelId ); 49} 50 51return false ; 52}); 53const hasVisionModality = $derived . by (() => { 54if ( activeModelId ) { 55void modelPropsVersion ; 56 57return modelsStore . props . modelSupportsVision ( activeModelId ); 58} 59 60return false ; 61}); 62 63return { 64get activeModelId () { 65return activeModelId ; 66}, 67get conversationModel () { 68return conversationModel ; 69}, 70get hasAudioModality () { 71return hasAudioModality ; 72}, 73get hasVideoModality () { 74return hasVideoModality ; 75}, 76get hasVisionModality () { 77return hasVisionModality ; 78}, 79get isRouter () { 80return isRouter ; 81} 82}; 83}