feat: implement channel runtime connectors

This commit is contained in:
2026-06-03 16:22:44 +08:00
parent ee972441f5
commit c3d84b904a
105 changed files with 15621 additions and 322 deletions

View File

@ -1,6 +1,26 @@
import type { ChatMessage } from '@/types';
const INVISIBLE_CONTENT_CHARS = /[\u200B-\u200D\uFEFF]/g;
export const CHAT_WAITING_REFRESH_INTERVAL_MS = 1500;
export const CHAT_IDLE_REFRESH_INTERVAL_MS = 5000;
export function getSessionRefreshIntervalMs({
isLoading,
isThinking,
documentHidden,
}: {
isLoading: boolean;
isThinking: boolean;
documentHidden: boolean;
}): number | null {
if (documentHidden) {
return null;
}
if (isLoading || isThinking) {
return CHAT_WAITING_REFRESH_INTERVAL_MS;
}
return CHAT_IDLE_REFRESH_INTERVAL_MS;
}
export function normalizedMessageText(content: unknown): string {
if (typeof content === 'string') {