@@ -5,13 +5,16 @@ import TextLineStream from 'textlinestream';
55
66// math formula rendering
77import 'katex/dist/katex.min.css' ;
8- import markdownItKatexGpt , { renderLatexHTML } from './katex-gpt' ;
8+ import markdownItKatexGpt from './katex-gpt' ;
99import markdownItKatexNormal from '@vscode/markdown-it-katex' ;
1010
1111// code highlighting
1212import hljs from './highlight-config' ;
1313import daisyuiThemes from 'daisyui/src/theming/themes' ;
1414
15+ // ponyfill for missing ReadableStream asyncIterator on Safari
16+ import { asyncIterator } from "@sec-ant/readable-stream/ponyfill/asyncIterator" ;
17+
1518const isDev = import . meta. env . MODE === 'development' ;
1619
1720// utility functions
@@ -33,7 +36,7 @@ const CONFIG_DEFAULT = {
3336 systemMessage : 'You are a helpful assistant.' ,
3437 showTokensPerSecond : false ,
3538 // make sure these default values are in sync with `common.h`
36- samplers : 'edkypmxt ' ,
39+ samplers : 'dkypmxt ' ,
3740 temperature : 0.8 ,
3841 dynatemp_range : 0.0 ,
3942 dynatemp_exponent : 1.0 ,
@@ -283,7 +286,7 @@ async function* sendSSEPostRequest(url, fetchOptions) {
283286 const lines = res . body
284287 . pipeThrough ( new TextDecoderStream ( ) )
285288 . pipeThrough ( new TextLineStream ( ) ) ;
286- for await ( const line of lines ) {
289+ for await ( const line of asyncIterator ( lines ) ) {
287290 if ( isDev ) console . log ( { line} ) ;
288291 if ( line . startsWith ( 'data:' ) && ! line . endsWith ( '[DONE]' ) ) {
289292 const data = JSON . parse ( line . slice ( 5 ) ) ;
0 commit comments