feat: implement channel runtime connectors
This commit is contained in:
@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user