MCPcopy Create free account
hub / github.com/OpenAnonymity/oa-chat / createModelPickerInterface

Function createModelPickerInterface

chat/ui/appInterface.js:88–130  ·  view source on GitHub ↗
(app, options = {})

Source from the content-addressed store, hash-verified

86 sync: options.syncServiceImpl || globalThis.syncService || null
87 };
88}
89
90export function createModelPickerInterface(app, options = {}) {
91 const db = options.chatDBImpl || chatDB;
92 const elements = pickElements(app, [
93 'modelPickerBtn',
94 'modelPickerModal',
95 'closeModalBtn',
96 'modelsList',
97 'modelSearch',
98 'modelListScrollArea',
99 'messageInput'
100 ]);
101
102 return {
103 elements,
104 state: app.state,
105 presentation: options.presentation || null,
106 get reasoningEnabled() {
107 return app.reasoningEnabled;
108 },
109 get cachedModelDisplayMetadata() {
110 return app.cachedModelDisplayMetadata;
111 },
112 getCurrentSession: () => app.getCurrentSession(),
113 getDefaultModelName: () => app.getDefaultModelName(),
114 normalizeModelName: (modelName) => app.normalizeModelName(modelName),
115 getPrimaryModelName: () => {
116 if (app.chatInput?.getPrimaryModelName) {
117 return app.chatInput.getPrimaryModelName();
118 }
119 const session = app.getCurrentSession();
120 const rawModelName = session?.model || app.state.pendingModelName || null;
121 return rawModelName ? (app.normalizeModelName(rawModelName) || rawModelName) : null;
122 },
123 getCouncilSecondaryModelName: () => app.chatInput?.getSelectedCouncilSecondaryModelName?.() || '',
124 getCouncilSynthesisModelName: () => app.chatInput?.getCouncilSynthesisModelForSelection?.() || '',
125 renderCurrentModel: () => app.renderCurrentModel(),
126 refreshEditModelPickerButton: () => app.chatArea?.updateEditModelPickerButton?.(),
127 actions: {
128 async selectModel(modelName) {
129 const normalizedModelName = app.normalizeModelName(modelName);
130 const session = app.getCurrentSession();
131 const reservation = session ? app.beginSessionMutation?.(session.id) : null;
132 if (session && app.beginSessionMutation && !reservation) {
133 await app.acknowledgeSessionMutationBusy?.(session.id);

Callers 2

createVanillaUiInterfaceFunction · 0.85

Calls 5

pickElementsFunction · 0.85
getCurrentSessionMethod · 0.80
normalizeModelNameMethod · 0.80
getDefaultModelNameMethod · 0.45
renderCurrentModelMethod · 0.45

Tested by

no test coverage detected