@@ -29,7 +29,7 @@ import {
2929 getStoryAllowedTools ,
3030 getRolePlayCharacterName ,
3131} from './storyAgent' ;
32- import type { Message , AgentSessionSummary , AgentToolEntry } from '../stores/useAgentStore' ;
32+ import type { AgentSessionRecord , AgentToolEntry , Message } from '../stores/useAgentStore' ;
3333
3434interface MobileStoryUiState {
3535 isArchiveModalOpen : boolean ;
@@ -196,7 +196,7 @@ const useMobileStoryView = () => {
196196
197197 // Load session list on mount
198198 useEffect ( ( ) => {
199- appInvoke < AgentSessionSummary [ ] > ( 'list_agent_sessions' , {
199+ appInvoke ( 'list_agent_sessions' , {
200200 prefix : 'story-session-' ,
201201 sessionKind : 'story' ,
202202 } )
@@ -212,7 +212,7 @@ const useMobileStoryView = () => {
212212 setSessionId ( currentSessionId ) ;
213213 }
214214 try {
215- const record = {
215+ const record : AgentSessionRecord = {
216216 id : currentSessionId ,
217217 title,
218218 messages : list ,
@@ -227,10 +227,10 @@ const useMobileStoryView = () => {
227227 selectedWorldBookId,
228228 dynamicRoleLoadingEnabled,
229229 } ;
230- await appInvoke < AgentSessionSummary > ( 'save_agent_session' , { session : record } ) ;
231-
230+ await appInvoke ( 'save_agent_session' , { session : record } ) ;
231+
232232 // Update session summary list
233- const listRes = await appInvoke < AgentSessionSummary [ ] > ( 'list_agent_sessions' , {
233+ const listRes = await appInvoke ( 'list_agent_sessions' , {
234234 prefix : 'story-session-' ,
235235 sessionKind : 'story' ,
236236 } ) ;
@@ -262,10 +262,10 @@ const useMobileStoryView = () => {
262262 messages,
263263 finalFallback : '未命名故事' ,
264264 summarize : async ( ) => {
265- const res = await appInvoke < { title : string } > ( 'summarize_text' , {
265+ const res = await appInvoke ( 'summarize_text' , {
266266 request : { text : chatHistoryText } ,
267267 } ) ;
268- return res . title ;
268+ return typeof res === 'string' ? res : res . title ;
269269 } ,
270270 } ) ;
271271 setSessionTitle ( finalTitle ) ;
@@ -289,7 +289,7 @@ const useMobileStoryView = () => {
289289 return ;
290290 }
291291 try {
292- const record = await appInvoke < any > ( 'load_agent_session' , { id } ) ;
292+ const record = await appInvoke ( 'load_agent_session' , { id } ) ;
293293 setSessionId ( record . id ) ;
294294 setSessionTitle ( record . title ) ;
295295 setMessages ( record . messages || [ ] ) ;
@@ -318,7 +318,7 @@ const useMobileStoryView = () => {
318318 if ( sessionId === id ) {
319319 createNewSession ( ) ;
320320 }
321- const listRes = await appInvoke < AgentSessionSummary [ ] > ( 'list_agent_sessions' , {
321+ const listRes = await appInvoke ( 'list_agent_sessions' , {
322322 prefix : 'story-session-' ,
323323 sessionKind : 'story' ,
324324 } ) ;
@@ -408,7 +408,7 @@ const useMobileStoryView = () => {
408408 const storyAgentConfig = settings . agentConfigs ?. [ storyAgentConfigId ] || { } ;
409409
410410 try {
411- const { runId } = await appInvoke < { runId : string } > ( 'start_chat_completion_stream' , {
411+ const { runId } = await appInvoke ( 'start_chat_completion_stream' , {
412412 request : {
413413 agentId : storyAgentConfigId ,
414414 modelInterface : settings . modelInterface ,
@@ -630,7 +630,7 @@ const useMobileStoryView = () => {
630630
631631 const filteredCards = selectedCards . filter ( card => tempSelectedCardIds . includes ( card . id ) ) ;
632632 const results = await Promise . all ( filteredCards . map ( async ( card ) => {
633- const result = await appInvoke < string | Record < string , any > > ( 'analyze_character_memory' , {
633+ const result = await appInvoke ( 'analyze_character_memory' , {
634634 sessionId,
635635 characterCardId : card . id ,
636636 } ) ;
@@ -692,14 +692,14 @@ const useMobileStoryView = () => {
692692 message . success ( '记忆封存成功!故事已锁定归档。' ) ;
693693
694694 // Reload sessions
695- const listRes = await appInvoke < AgentSessionSummary [ ] > ( 'list_agent_sessions' , {
695+ const listRes = await appInvoke ( 'list_agent_sessions' , {
696696 prefix : 'story-session-' ,
697697 sessionKind : 'story' ,
698698 } ) ;
699699 setSessions ( listRes ) ;
700700
701701 // Reload partner store
702- const partnerStoreContent = await appInvoke < string > ( 'load_app_state' , { name : 'partner-store' } ) ;
702+ const partnerStoreContent = await appInvoke ( 'load_app_state' , { name : 'partner-store' } ) ;
703703 if ( partnerStoreContent ) {
704704 const parsed = JSON . parse ( partnerStoreContent ) ;
705705 if ( parsed . state ) {
0 commit comments