* Creates the scroll-to-bottom button element
()
| 1123 | try { await this.runtime.discardUsagePreview?.({ sessionId: session.id, requestId: id }); } |
| 1124 | catch (error) { console.warn('Could not clear the local usage preview:', error?.message || 'Storage unavailable'); } |
| 1125 | } |
| 1126 | } |
| 1127 | } |
| 1128 | |
| 1129 | /** Whether an extension has mounted a node matching `selector` into `name`. */ |
| 1130 | hasExtensionSlotNode(name, selector) { |
| 1131 | return this.extensionSlots.hasMatchingNode(name, selector); |
| 1132 | } |
| 1133 | |
| 1134 | /** Notify `listener` whenever the nodes mounted into `name` change. */ |
| 1135 | subscribeExtensionSlot(name, listener) { |
| 1136 | return this.extensionSlots.subscribe(name, listener); |
| 1137 | } |
| 1138 | |
| 1139 | detectInitialLinkContext() { |
| 1140 | try { |
| 1141 | const url = new URL(window.location.href); |
| 1142 | if (/^\/tickets\/[^/?#]+/i.test(url.pathname)) { |
| 1143 | return true; |
| 1144 | } |
| 1145 | |
| 1146 | const params = url.searchParams; |
| 1147 | return params.has('tickets') || params.has('sharing') || params.has('s'); |
| 1148 | } catch (error) { |
| 1149 | return false; |
| 1150 | } |
| 1151 | } |
| 1152 | |
| 1153 | getDefaultModelId() { |
| 1154 | const session = this.getCurrentSession(); |
| 1155 | const fallbackModel = this.getFallbackModelEntry(session); |
| 1156 | return fallbackModel?.id || this.inferenceService.getDefaultModelId(session); |
| 1157 | } |
| 1158 | |
| 1159 | getDefaultModelName() { |
| 1160 | const session = this.getCurrentSession(); |
| 1161 | const fallbackModel = this.getFallbackModelEntry(session); |
| 1162 | return fallbackModel?.name || this.inferenceService.getDefaultModelName(session); |
| 1163 | } |
| 1164 | |
| 1165 | getDisabledModelSet(session = this.getCurrentSession()) { |
| 1166 | return new Set(this.modelConfiguration.getDisabledModels(session)); |
| 1167 | } |
| 1168 | |
| 1169 | filterDisabledModels(models, session = this.getCurrentSession()) { |
| 1170 | return filterDisabledModelsValue(models, this.getDisabledModelSet(session)); |
| 1171 | } |
| 1172 | |
| 1173 | getModelsForSession(session) { |
| 1174 | const backendId = session?.inferenceBackend || this.inferenceService?.getDefaultBackendId?.(); |
| 1175 | if (!this.state.modelsBackendId || this.state.modelsBackendId === backendId) return this.state.models; |
| 1176 | return this.modelCatalogsByBackend?.get(backendId) |
| 1177 | || this.inferenceService.getCachedModels?.(session) || []; |
| 1178 | } |
| 1179 | |
| 1180 | getFallbackModelEntry(session) { |
| 1181 | const usePinnedDefaults = !session?.inferenceBackend || |
| 1182 | session.inferenceBackend === this.inferenceService.getDefaultBackendId(); |
no test coverage detected