Skip to content

Commit

Permalink
chore
Browse files Browse the repository at this point in the history
  • Loading branch information
josStorer committed Apr 3, 2024
1 parent f6614ff commit ff6240d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions frontend/src/pages/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -583,8 +583,9 @@ const ChatPanel: FC = observer(() => {
}),
signal: chatSseController?.signal,
onmessage(e) {
if (finished) return;
scrollToBottom();
if (!finished && e.data.trim() === '[DONE]') {
if (e.data.trim() === '[DONE]') {
finish();
return;
}
Expand All @@ -598,7 +599,7 @@ const ChatPanel: FC = observer(() => {
if (data.model)
commonStore.setLastModelName(data.model);
if (data.choices && Array.isArray(data.choices) && data.choices.length > 0) {
if (!finished && data.choices[0]?.finish_reason) {
if (data.choices[0]?.finish_reason) {
finish();
return;
}
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/pages/Completion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ const CompletionPanel: FC = observer(() => {
}),
signal: completionSseController?.signal,
onmessage(e) {
if (finished) return;
scrollToBottom();
if (!finished && e.data.trim() === '[DONE]') {
if (e.data.trim() === '[DONE]') {
finish();
return;
}
Expand All @@ -124,7 +125,7 @@ const CompletionPanel: FC = observer(() => {
if (data.model)
commonStore.setLastModelName(data.model);
if (data.choices && Array.isArray(data.choices) && data.choices.length > 0) {
if (!finished && data.choices[0]?.finish_reason) {
if (data.choices[0]?.finish_reason) {
finish();
return;
}
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/pages/Composition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,9 @@ const CompositionPanel: FC = observer(() => {
}),
signal: compositionSseController?.signal,
onmessage(e) {
if (finished) return;
scrollToBottom();
if (!finished && e.data.trim() === '[DONE]') {
if (e.data.trim() === '[DONE]') {
finish();
return;
}
Expand All @@ -229,7 +230,7 @@ const CompositionPanel: FC = observer(() => {
if (data.model)
commonStore.setLastModelName(data.model);
if (data.choices && Array.isArray(data.choices) && data.choices.length > 0) {
if (!finished && data.choices[0]?.finish_reason) {
if (data.choices[0]?.finish_reason) {
finish();
return;
}
Expand Down

0 comments on commit ff6240d

Please sign in to comment.