mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 10:27:38 +00:00
refactor(config): unify streaming config across channels
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
export type SlackStreamMode = "replace" | "status_final" | "append";
|
||||
import {
|
||||
mapStreamingModeToSlackLegacyDraftStreamMode,
|
||||
resolveSlackNativeStreaming,
|
||||
resolveSlackStreamingMode,
|
||||
type SlackLegacyDraftStreamMode,
|
||||
type StreamingMode,
|
||||
} from "../config/discord-preview-streaming.js";
|
||||
|
||||
export type SlackStreamMode = SlackLegacyDraftStreamMode;
|
||||
export type SlackStreamingMode = StreamingMode;
|
||||
const DEFAULT_STREAM_MODE: SlackStreamMode = "replace";
|
||||
|
||||
export function resolveSlackStreamMode(raw: unknown): SlackStreamMode {
|
||||
@@ -13,6 +21,20 @@ export function resolveSlackStreamMode(raw: unknown): SlackStreamMode {
|
||||
return DEFAULT_STREAM_MODE;
|
||||
}
|
||||
|
||||
export function resolveSlackStreamingConfig(params: {
|
||||
streaming?: unknown;
|
||||
streamMode?: unknown;
|
||||
nativeStreaming?: unknown;
|
||||
}): { mode: SlackStreamingMode; nativeStreaming: boolean; draftMode: SlackStreamMode } {
|
||||
const mode = resolveSlackStreamingMode(params);
|
||||
const nativeStreaming = resolveSlackNativeStreaming(params);
|
||||
return {
|
||||
mode,
|
||||
nativeStreaming,
|
||||
draftMode: mapStreamingModeToSlackLegacyDraftStreamMode(mode),
|
||||
};
|
||||
}
|
||||
|
||||
export function applyAppendOnlyStreamUpdate(params: {
|
||||
incoming: string;
|
||||
rendered: string;
|
||||
|
||||
Reference in New Issue
Block a user