聊天数据bug修复

This commit is contained in:
2025-10-14 11:34:09 +08:00
parent 0088515f2a
commit 34d07ec143
5 changed files with 36 additions and 15 deletions
@@ -10,6 +10,10 @@ import { InnerMsgCode } from "../../Main/Config/InnerMsgCode";
import { TipsPanel } from "../ui/panels/TipsPanel";
import LanguageUtils from "../../Main/Common/LanguageUtils";
import { logger } from "db://assets/Scripts/Main/Common/Logger";
import { GirlService } from "../network/services/GirlService";
import { DataManager, DataId } from "../data/DataManager";
import { GirlData } from "../data/GirlData";
import proto from "db://assets/Scripts/proto/proto.pb.js";
/**
* 聊天控制器接口 - 定义Panel和Controller之间的通信协议
@@ -152,12 +156,16 @@ export class ChatController {
* @param roleId 角色ID
* @returns 是否切换成功
*/
public switchRole(categoryId: string, roleId: number): boolean {
public async switchRole(
categoryId: string,
roleId: number
): Promise<boolean> {
if (!this.chatModel.switchToRole(categoryId, roleId)) {
logger.error(`Failed to switch to role ${roleId}`);
return false;
}
// 更新AI服务的当前角色
ChatAIService.Instance.setCurrentRole(roleId);