From 636b0323075225c584b62719ed51e75521bb7ffb Mon Sep 17 00:00:00 2001 From: aura Date: Tue, 17 Feb 2026 22:39:42 +0100 Subject: push source --- moneyjsx/src/support-models.tsx | 114 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 moneyjsx/src/support-models.tsx (limited to 'moneyjsx/src/support-models.tsx') diff --git a/moneyjsx/src/support-models.tsx b/moneyjsx/src/support-models.tsx new file mode 100644 index 0000000..2afd726 --- /dev/null +++ b/moneyjsx/src/support-models.tsx @@ -0,0 +1,114 @@ +import $ from "jquery"; +import * as JSX from './jsx'; +import * as API from "./api"; +import * as user from "./user"; +import * as util from "./util"; + +import { Page, GroupBox, Spinner, Dropdown, DropdownItem } from './components'; + +export default function Models() { + if( !API.models.length ) { + const modelTimeout = () => { + if( API.models.length ) + JSX.navigateSilent( "/models" ); + else + setTimeout( modelTimeout, 100 ); + } + + modelTimeout(); + + return +
+ +
+
+ } + + let model = API.models[0].name; + if( user.is_loggedin && user.settings.site_prefs && user.settings.site_prefs.model ) + model = user.settings.site_prefs.model!; + + return + +
+ + { API.models.map( ( m ) => { m.name } ) } + +
+ +
+
+
+} + +function changeModel( e: Event ) { + const el = $( e.target ); + const txt = el.text(); + console.log( txt ); + const m = API.getModelFromName( txt ); + console.log( m ); + + $( "#model-list" ).children().replaceWith( + + ); + + $( "#model-selector" ).text( m.name ); +} + + +function ModelInfo( props: any ) { + const m = props.model as API.Model; + return
+
+

+ { m.name } +

+
+
+
+ Web { m.capabilities.web ? '✔' : '✘' } + Notes { m.capabilities.notes ? '✔' : '✘' } + Vision { m.capabilities.vision ? '✔' : '✘' } + Memory Lookup { m.capabilities.remind ? '✔' : '✘' } +
+
+ { m.description.full } +
+
+
+
+ + { util.escapeHtml( m.license ) } + +
; +} + +let license_open = false; +function ModelLicense( props: any ) { + const collapseToggle = () => { + const el = $( "#model-license" ); + let list = el.find( '.tool-call-list' ); + let btn = el.find( '.tool-call-collapse' ); + + license_open = list.css( 'display' ) == 'block'; + if( !license_open ) { + list.css( 'display', 'block' ); + btn.text( '-' ); + } else { + list.css( 'display', 'none' ); + btn.text( '+' ); + } + }; + + let el =
+
+ License + { license_open ? '-' : '+' } +
+
+ { props.children } +
+
; + + return el; +} -- cgit v1.2.3