Explorar o código

fix: playground

Timothy J. Baek hai 10 meses
pai
achega
bc1a7ab567
Modificáronse 1 ficheiros con 8 adicións e 18 borrados
  1. 8 18
      src/lib/components/workspace/Playground.svelte

+ 8 - 18
src/lib/components/workspace/Playground.svelte

@@ -80,8 +80,6 @@
 					if (stopResponseFlag) {
 					if (stopResponseFlag) {
 						controller.abort('User: Stop Response');
 						controller.abort('User: Stop Response');
 					}
 					}
-
-					currentRequestId = null;
 					break;
 					break;
 				}
 				}
 
 
@@ -97,11 +95,7 @@
 								let data = JSON.parse(line.replace(/^data: /, ''));
 								let data = JSON.parse(line.replace(/^data: /, ''));
 								console.log(data);
 								console.log(data);
 
 
-								if ('request_id' in data) {
-									currentRequestId = data.request_id;
-								} else {
-									text += data.choices[0].delta.content ?? '';
-								}
+								text += data.choices[0].delta.content ?? '';
 							}
 							}
 						}
 						}
 					}
 					}
@@ -178,21 +172,17 @@
 								let data = JSON.parse(line.replace(/^data: /, ''));
 								let data = JSON.parse(line.replace(/^data: /, ''));
 								console.log(data);
 								console.log(data);
 
 
-								if ('request_id' in data) {
-									currentRequestId = data.request_id;
+								if (responseMessage.content == '' && data.choices[0].delta.content == '\n') {
+									continue;
 								} else {
 								} else {
-									if (responseMessage.content == '' && data.choices[0].delta.content == '\n') {
-										continue;
-									} else {
-										textareaElement.style.height = textareaElement.scrollHeight + 'px';
+									textareaElement.style.height = textareaElement.scrollHeight + 'px';
 
 
-										responseMessage.content += data.choices[0].delta.content ?? '';
-										messages = messages;
+									responseMessage.content += data.choices[0].delta.content ?? '';
+									messages = messages;
 
 
-										textareaElement.style.height = textareaElement.scrollHeight + 'px';
+									textareaElement.style.height = textareaElement.scrollHeight + 'px';
 
 
-										await tick();
-									}
+									await tick();
 								}
 								}
 							}
 							}
 						}
 						}