diff --git a/src/proxy/moonshot.ts b/src/proxy/moonshot.ts index 82424b6..efbbaa7 100644 --- a/src/proxy/moonshot.ts +++ b/src/proxy/moonshot.ts @@ -6,7 +6,7 @@ import { addKey, finalizeBody } from "./middleware/request"; import { ProxyResHandlerWithBody } from "./middleware/response"; import axios from "axios"; import { MoonshotKey, keyPool } from "../shared/key-management"; -import { isMoonshotModel, isMoonshotVisionModel, enableMoonshotPartial, hasMoonshotPartialMode } from "../shared/api-schemas/moonshot"; +import { isMoonshotModel, isMoonshotVisionModel } from "../shared/api-schemas/moonshot"; import { logger } from "../logger"; const log = logger.child({ module: "proxy", service: "moonshot" }); diff --git a/src/shared/api-schemas/moonshot.ts b/src/shared/api-schemas/moonshot.ts index 50a1bfc..6f34fa7 100644 --- a/src/shared/api-schemas/moonshot.ts +++ b/src/shared/api-schemas/moonshot.ts @@ -83,24 +83,5 @@ export const MoonshotV1EmbeddingsSchema = z.object({ encoding_format: z.enum(["float", "base64"]).optional() }); -// Helper function to enable partial mode for Moonshot (similar to Deepseek's prefill) -export function enableMoonshotPartial(messages: any[]): any[] { - // If the last message is from assistant and doesn't have partial flag, add it - if (messages.length > 0 && messages[messages.length - 1].role === 'assistant') { - const lastMessage = messages[messages.length - 1]; - if (!lastMessage.partial) { - return [ - ...messages.slice(0, -1), - { ...lastMessage, partial: true } - ]; - } - } - return messages; -} - -// Helper function to check if request uses partial mode -export function hasMoonshotPartialMode(messages: any[]): boolean { - return messages.length > 0 && - messages[messages.length - 1].role === 'assistant' && - messages[messages.length - 1].partial === true; -} +// Note: Partial mode handling is implemented directly in the proxy middleware +// to follow the Deepseek-style consolidation pattern