Spaces:
Running
Running
Update index.html
Browse files- index.html +29 -3
index.html
CHANGED
|
@@ -1005,11 +1005,28 @@ async function loadModel() {
|
|
| 1005 |
log(`loading ${id}`, 'w');
|
| 1006 |
|
| 1007 |
try {
|
| 1008 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1009 |
engine = await window.webllm.CreateMLCEngine(id, {
|
| 1010 |
-
appConfig:
|
| 1011 |
initProgressCallback: (report) => {
|
| 1012 |
-
// Updates the UI with download percentage
|
| 1013 |
const pct = Math.round((report.progress || 0) * 100);
|
| 1014 |
document.getElementById('mstatus').textContent = `LOADING ${pct}%`;
|
| 1015 |
if (report.text) log(report.text, '');
|
|
@@ -1017,6 +1034,7 @@ async function loadModel() {
|
|
| 1017 |
});
|
| 1018 |
|
| 1019 |
store.set({ engineReady: true });
|
|
|
|
| 1020 |
document.getElementById('mdot').classList.add('ready');
|
| 1021 |
document.getElementById('mstatus').textContent = 'READY';
|
| 1022 |
document.getElementById('uin').disabled = false;
|
|
@@ -1029,6 +1047,14 @@ async function loadModel() {
|
|
| 1029 |
document.getElementById('mstatus').textContent = 'ERROR';
|
| 1030 |
document.getElementById('lbtn').disabled = false;
|
| 1031 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1032 |
}
|
| 1033 |
|
| 1034 |
async function runAgent(userText) {
|
|
|
|
| 1005 |
log(`loading ${id}`, 'w');
|
| 1006 |
|
| 1007 |
try {
|
| 1008 |
+
// 1. Hole die Standardliste aus WebLLM
|
| 1009 |
+
const baseConfig = window.webllm.prebuiltAppConfig || { model_list: [] };
|
| 1010 |
+
|
| 1011 |
+
// 2. Erstelle eine neue Config und hänge MiniCPM5-2B an
|
| 1012 |
+
const customAppConfig = {
|
| 1013 |
+
...baseConfig,
|
| 1014 |
+
model_list: [
|
| 1015 |
+
...(baseConfig.model_list || []),
|
| 1016 |
+
{
|
| 1017 |
+
model: "https://huggingface.co/fatih-can/MiniCPM5-2B-MLC/resolve/main/q4f16_1",
|
| 1018 |
+
model_id: "MiniCPM5-2B-q4f16_1-MLC",
|
| 1019 |
+
model_lib: "https://huggingface.co/fatih-can/MiniCPM5-2B-MLC/resolve/main/q4f16_1/libs/MiniCPM5-2B-q4f16_1-MLC-webgpu.wasm",
|
| 1020 |
+
vram_required_MB: 2000,
|
| 1021 |
+
overrides: { context_window_size: 2048 }
|
| 1022 |
+
}
|
| 1023 |
+
]
|
| 1024 |
+
};
|
| 1025 |
+
|
| 1026 |
+
// FIX: Nutze customAppConfig anstatt der reinen prebuiltAppConfig
|
| 1027 |
engine = await window.webllm.CreateMLCEngine(id, {
|
| 1028 |
+
appConfig: customAppConfig,
|
| 1029 |
initProgressCallback: (report) => {
|
|
|
|
| 1030 |
const pct = Math.round((report.progress || 0) * 100);
|
| 1031 |
document.getElementById('mstatus').textContent = `LOADING ${pct}%`;
|
| 1032 |
if (report.text) log(report.text, '');
|
|
|
|
| 1034 |
});
|
| 1035 |
|
| 1036 |
store.set({ engineReady: true });
|
| 1037 |
+
|
| 1038 |
document.getElementById('mdot').classList.add('ready');
|
| 1039 |
document.getElementById('mstatus').textContent = 'READY';
|
| 1040 |
document.getElementById('uin').disabled = false;
|
|
|
|
| 1047 |
document.getElementById('mstatus').textContent = 'ERROR';
|
| 1048 |
document.getElementById('lbtn').disabled = false;
|
| 1049 |
}
|
| 1050 |
+
|
| 1051 |
+
|
| 1052 |
+
|
| 1053 |
+
|
| 1054 |
+
|
| 1055 |
+
|
| 1056 |
+
|
| 1057 |
+
|
| 1058 |
}
|
| 1059 |
|
| 1060 |
async function runAgent(userText) {
|