fix: add default values for optional config fields #3

Merged
hzhang merged 34 commits from feat/whispergate-mvp into main 2026-02-27 15:31:33 +00:00
Showing only changes of commit 75f358001b - Show all commits

View File

@@ -43,7 +43,10 @@ function stripTrailingMetadata(input: string): string {
function getLastChar(input: string): string {
const t = stripTrailingMetadata(input).trim();
return t.length ? t[t.length - 1] : "";
if (!t.length) return "";
// Use Array.from to handle multi-byte characters (emoji, surrogate pairs)
const chars = Array.from(t);
return chars[chars.length - 1] || "";
}
export function resolvePolicy(config: WhisperGateConfig, channelId?: string, channelPolicies?: Record<string, ChannelPolicy>) {