支持角色id与性格配置
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { _decorator, Component, EditBox, Node,Label,Sprite,UITransform } from "cc";
|
||||
import { DemoManager } from "./DemoManager";
|
||||
import { ChatGPTService } from "./ChatGPTService";
|
||||
import { ChatAIService } from "./ChatAIService";
|
||||
import li_BaseView from "db://assets/Scripts/Main/Common/li_BaseView";
|
||||
import Utils from "db://assets/Scripts/Main/Common/Utils";
|
||||
import {InnerMsgCode} from "db://assets/Scripts/Main/Config/InnerMsgCode";
|
||||
@@ -38,6 +38,8 @@ export class ChatPanel extends li_BaseView {
|
||||
openUIDataCT(data)
|
||||
{
|
||||
this.id = data;
|
||||
// 设置当前聊天的角色ID
|
||||
ChatAIService.Instance.setCurrentRole(this.id);
|
||||
}
|
||||
|
||||
onLoadCT()
|
||||
@@ -84,22 +86,17 @@ export class ChatPanel extends li_BaseView {
|
||||
|
||||
DemoManager.getInstance().updateDialog(true, str,true);
|
||||
|
||||
let ret = await ChatGPTService.getInstance().Post({
|
||||
model: "Deepseek-reasoner",
|
||||
messages: [{ role: "user", content: str }],
|
||||
temperature: 0.8,
|
||||
id: ChatGPTService.getInstance().GetId(),
|
||||
});
|
||||
// 使用新的sendMessage方法,传入角色ID
|
||||
const ret = await ChatAIService.Instance.sendMessage(this.id, str);
|
||||
console.log(ret);
|
||||
|
||||
const rep = ret.choices[0].message.content;
|
||||
if (rep == null) {
|
||||
if (ret == null) {
|
||||
console.warn("rep null");
|
||||
}
|
||||
if (this.manager) {
|
||||
this.manager.updateDialog(false, rep);
|
||||
this.manager.updateDialog(false, ret);
|
||||
}
|
||||
console.log("ret:" + rep);
|
||||
console.log("ret:" + ret);
|
||||
|
||||
//测试
|
||||
//this.popUpImage.refresh("Image/1/blur_naked_1");
|
||||
|
||||
Reference in New Issue
Block a user