mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
The native adapter's route was named deepseek, colliding with pi-ai's catalog provider of the same name, so the two DeepSeek paths could never be mounted side by side. The web settings page needs both configurable at once. Compositions, fixtures, goldens, scaffolding defaults, and docs all move together (pre-release, no shim); TUI/session-query-spill/ missing-credential goldens re-recorded through their keyless refresh modes because provider-name length shifts box padding and spill truncation points.
33 lines
1.2 KiB
TypeScript
33 lines
1.2 KiB
TypeScript
/**
|
|
* Test helper: drive `ctx.llm.stream()` through a `BlockAssembler` and return
|
|
* the assembled message + usage + finish reason. This exercises the same
|
|
* streaming path production uses (the loop), rather than a service-level
|
|
* one-shot convenience method.
|
|
*/
|
|
|
|
import { BlockAssembler } from '@deepseek-ai/dsh-llm'
|
|
import type { Context } from 'cordis'
|
|
import type { FinishReason, GenerateOptions, Message, TokenUsage } from '@deepseek-ai/dsh-llm'
|
|
|
|
export interface AssembledResult {
|
|
message: Message
|
|
usage?: TokenUsage
|
|
finish: FinishReason
|
|
}
|
|
|
|
export async function assemble(ctx: Context, options: Omit<GenerateOptions, 'provider'> & { provider?: string }): Promise<AssembledResult> {
|
|
const assembler = new BlockAssembler()
|
|
const request = { provider: 'deepseek-official', ...options }
|
|
for await (const chunk of ctx.llm.stream(request)) assembler.push(chunk)
|
|
return {
|
|
message: assembler.message({
|
|
kind: 'model',
|
|
provider: request.provider,
|
|
model: request.model,
|
|
...assembler.replayState === undefined ? {} : { replayState: assembler.replayState },
|
|
}),
|
|
...assembler.usage !== undefined ? { usage: assembler.usage } : {},
|
|
finish: assembler.finish,
|
|
}
|
|
}
|