forked from open-webui/open-webui
		
	Merge pull request #1795 from cheahjs/fix/openai-handle-carriage-returns
fix: handle carriage returns in OpenAI streams
This commit is contained in:
		
						commit
						db5c4be674
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		|  | @ -26,7 +26,11 @@ async function* openAIStreamToIterator( | |||
| 			break; | ||||
| 		} | ||||
| 		const lines = value.split('\n'); | ||||
| 		for (const line of lines) { | ||||
| 		for (let line of lines) { | ||||
| 			if (line.endsWith('\r')) { | ||||
| 				// Remove trailing \r
 | ||||
| 				line = line.slice(0, -1); | ||||
| 			} | ||||
| 			if (line !== '') { | ||||
| 				console.log(line); | ||||
| 				if (line === 'data: [DONE]') { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Timothy Jaeryang Baek
						Timothy Jaeryang Baek