Spaces:
Runtime error
Runtime error
No need for double-try
Browse files19 unmodified lines202122232425262728293031323334353637383940414243444519 unmodified lines...conversation.messages];let out = '';try {for await (const chunk of hf.chatCompletionStream({model: conversation.model.id,messages,temperature: conversation.config.temperature,max_tokens: conversation.config.maxTokens},{ signal: abortController.signal })) {if (chunk.choices && chunk.choices.length > 0 && chunk.choices[0]?.delta?.content) {out += chunk.choices[0].delta.content;onChunk(out);}}} catch (error) {if (error.name === 'AbortError') {console.log('Stream aborted');} else {throw error;}}}19 unmodified lines20212223242526272829303132333435363719 unmodified lines...conversation.messages];let out = '';for await (const chunk of hf.chatCompletionStream({model: conversation.model.id,messages,temperature: conversation.config.temperature,max_tokens: conversation.config.maxTokens},{ signal: abortController.signal })) {if (chunk.choices && chunk.choices.length > 0 && chunk.choices[0]?.delta?.content) {out += chunk.choices[0].delta.content;onChunk(out);}}}
src/lib/components/InferencePlayground/inferencePlaygroundUtils.ts+12-20