File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,12 +12,7 @@ type ChatComposerPersistenceState = {
1212 assistantAgentId ?: string | null ;
1313 agentsList ?: { defaultId ?: string | null ; mainKey ?: string | null } | null ;
1414 hello ?: {
15- snapshot ?: {
16- sessionDefaults ?: {
17- defaultAgentId ?: string | null ;
18- mainKey ?: string | null ;
19- } | null ;
20- } | null ;
15+ snapshot ?: unknown ;
2116 } | null ;
2217 sessionKey : string ;
2318 chatMessage : string ;
@@ -46,7 +41,18 @@ function storageKeyForGateway(gatewayUrl: string | null | undefined): string {
4641}
4742
4843function readHelloDefaultAgentId ( state : Pick < ChatComposerPersistenceState , "hello" > ) {
49- return state . hello ?. snapshot ?. sessionDefaults ?. defaultAgentId ?. trim ( ) || undefined ;
44+ const snapshot = state . hello ?. snapshot ;
45+ if ( ! snapshot || typeof snapshot !== "object" ) {
46+ return undefined ;
47+ }
48+ const defaults = ( snapshot as { sessionDefaults ?: unknown } ) . sessionDefaults ;
49+ if ( ! defaults || typeof defaults !== "object" ) {
50+ return undefined ;
51+ }
52+ const defaultAgentId = ( defaults as { defaultAgentId ?: unknown } ) . defaultAgentId ;
53+ return typeof defaultAgentId === "string" && defaultAgentId . trim ( )
54+ ? defaultAgentId . trim ( )
55+ : undefined ;
5056}
5157
5258function resolveComposerAgentScope (
You can’t perform that action at this time.
0 commit comments