feat: Dynamisches Modell-Laden für Nvidia & Pollinations Provider
- OpenAiService: FetchModels() generisch für beide Provider (OpenAI-Format & Pollinations-Array-Format) - Pollinations Base-URL direkt auf text.pollinations.ai/openai (kein g4f.space Proxy → kein 402) - Pollinations Modelle-URL: text.pollinations.ai/models - ModelsEndpoint: /api/models/nvidia + /api/models/pollinations - agent-page.js: loadProviderModels() generisch, Promise.all für beide Provider parallel - index.html: statische Nvidia-Option entfernt, beide Optgroups mit 'Wird geladen...'
This commit is contained in:
1 parent
7972ca6a3a
commit
5ed910edcd
5 files changed
+127
-3
No files matched your search
+5
-2
@@ -191,8 +191,11 @@
|
||||
<option value="opus-4-5">Opus 4.5</option>
|
||||
<option value="opus-4-6" selected>Opus 4.6</option>
|
||||
<option value="haiku-4-5">Haiku 4.5</option>
|
||||
<optgroup label="Nvidia (via g4f.space)">
|
||||
<option value="nvidia:moonshotai/kimi-k2.5">Kimi K2.5 (Moonshot)</option>
|
||||
<optgroup label="Pollinations (via g4f.space)" id="pollinationsOptgroup">
|
||||
<option value="" disabled>Wird geladen...</option>
|
||||
</optgroup>
|
||||
<optgroup label="Nvidia (via g4f.space)" id="nvidiaOptgroup">
|
||||
<option value="" disabled>Wird geladen...</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
<div class="more">
|
||||
|
||||
@@ -18,6 +18,32 @@ registerPage('agent', {
|
||||
const nameEl = document.getElementById('agentName');
|
||||
const descEl = document.getElementById('agentDescription');
|
||||
const modelEl = document.getElementById('agentModel');
|
||||
const nvidiaOptgroup = document.getElementById('nvidiaOptgroup');
|
||||
const pollinationsOptgroup = document.getElementById('pollinationsOptgroup');
|
||||
|
||||
// Modelle dynamisch laden
|
||||
const loadProviderModels = async (url, prefix, optgroup) => {
|
||||
try {
|
||||
const resp = await fetch(url);
|
||||
const data = await resp.json();
|
||||
if (optgroup && data.models && data.models.length > 0) {
|
||||
optgroup.innerHTML = '';
|
||||
for (const m of data.models) {
|
||||
const opt = document.createElement('option');
|
||||
opt.value = prefix + ':' + m.id;
|
||||
opt.textContent = m.displayName;
|
||||
optgroup.appendChild(opt);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
if (optgroup) optgroup.innerHTML = '<option value="" disabled>Fehler beim Laden</option>';
|
||||
}
|
||||
};
|
||||
|
||||
await Promise.all([
|
||||
loadProviderModels('/api/models/nvidia', 'nvidia', nvidiaOptgroup),
|
||||
loadProviderModels('/api/models/pollinations', 'pollinations', pollinationsOptgroup)
|
||||
]);
|
||||
const allowUserChoiceEl = document.getElementById('agentAllowUserChoice');
|
||||
const autoCommitEl = document.getElementById('agentAutoCommit');
|
||||
const useSoulEl = document.getElementById('agentUseSoul');
|
||||
|
||||
Reference in new issue
Block a user