refactor: Use `UrlPrefix` enum for data stream parsing
This commit is contained in:
parent
6489c33dd5
commit
983b279724
|
|
@ -4,7 +4,13 @@ import {
|
|||
ATTACHMENT_LABEL_PDF_FILE,
|
||||
ATTACHMENT_LABEL_MCP_PROMPT
|
||||
} from '$lib/constants/attachment-labels';
|
||||
import { AttachmentType, ContentPartType, MessageRole, ReasoningFormat } from '$lib/enums';
|
||||
import {
|
||||
AttachmentType,
|
||||
ContentPartType,
|
||||
MessageRole,
|
||||
ReasoningFormat,
|
||||
UrlPrefix
|
||||
} from '$lib/enums';
|
||||
import type { ApiChatMessageContentPart, ApiChatCompletionToolCall } from '$lib/types/api';
|
||||
import type { DatabaseMessageExtraMcpPrompt } from '$lib/types';
|
||||
import { modelsStore } from '$lib/stores/models.svelte';
|
||||
|
|
@ -427,7 +433,7 @@ export class ChatService {
|
|||
for (const line of lines) {
|
||||
if (abortSignal?.aborted) break;
|
||||
|
||||
if (line.startsWith('data: ')) {
|
||||
if (line.startsWith(UrlPrefix.DATA)) {
|
||||
const data = line.slice(6);
|
||||
if (data === '[DONE]') {
|
||||
streamFinished = true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue