@@ -6,7 +6,7 @@ import 'react-toastify/dist/ReactToastify.css';
6
6
import { useRef , useState , useEffect } from "react" ;
7
7
import type { FormEvent } from "react" ;
8
8
9
- import { ChatMessageBubble } from " @/components/ChatMessageBubble" ;
9
+ import { ChatMessageBubble } from ' @/components/ChatMessageBubble' ;
10
10
import { ChatWindowMessage } from '@/schema/ChatWindowMessage' ;
11
11
12
12
export function ChatWindow ( props : {
@@ -35,25 +35,12 @@ export function ChatWindow(props: {
35
35
controller . close ( ) ;
36
36
return ;
37
37
}
38
- // Config copied from:
39
- // https://github.com/mlc-ai/web-llm/blob/eaaff6a7730b6403810bb4fd2bbc4af113c36050/examples/simple-chat/src/gh-config.js
38
+ // See https://github.com/mlc-ai/web-llm/blob/main/src/config.ts for a list of available models
40
39
const webLLMConfig = {
41
- temperature : 0.1 ,
42
- modelRecord : {
43
- "model_url" : "https://huggingface.co/mlc-ai/phi-2-q4f32_1-MLC/resolve/main/" ,
44
- "local_id" : "Phi2-q4f32_1" ,
45
- "model_lib_url" : "https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/phi-2/phi-2-q4f32_1-ctx2k-webgpu.wasm" ,
46
- "vram_required_MB" : 4032.48 ,
47
- "low_resource_required" : false ,
40
+ model : "Phi2-q4f32_1" ,
41
+ chatOptions : {
42
+ temperature : 0.1 ,
48
43
} ,
49
- // {
50
- // "model_url": "https://huggingface.co/mlc-ai/phi-2-q0f16-MLC/resolve/main/",
51
- // "local_id": "Phi2-q0f16",
52
- // "model_lib_url": "https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/phi-2/phi-2-q0f16-ctx2k-webgpu.wasm",
53
- // "vram_required_MB": 11079.47,
54
- // "low_resource_required": false,
55
- // "required_features": ["shader-f16"],
56
- // },
57
44
} ;
58
45
const ollamaConfig = {
59
46
baseUrl : "http://localhost:11435" ,
@@ -89,15 +76,15 @@ export function ChatWindow(props: {
89
76
initProgressToastId . current = toast (
90
77
"Loading model weights... This may take a while" ,
91
78
{
92
- progress : e . data . data . progress ,
79
+ progress : e . data . data . progress || 0.01 ,
93
80
theme : "dark"
94
81
}
95
82
) ;
96
83
} else {
97
84
if ( e . data . data . progress === 1 ) {
98
85
await new Promise ( ( resolve ) => setTimeout ( resolve , 2000 ) ) ;
99
86
}
100
- toast . update ( initProgressToastId . current , { progress : e . data . data . progress } ) ;
87
+ toast . update ( initProgressToastId . current , { progress : e . data . data . progress || 0.01 } ) ;
101
88
}
102
89
break
103
90
case "chunk" :
0 commit comments