From 2f6d583ebf2fb37457b3b8f861093c2bb7a0d92b Mon Sep 17 00:00:00 2001 From: xlj <543978819@qq.com> Date: Tue, 22 Jul 2025 17:48:45 +0800 Subject: [PATCH] update --- assets/Scripts/test/ChatGPTService.ts | 7 ++++++- assets/Scripts/test/ChatPanel.ts | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/assets/Scripts/test/ChatGPTService.ts b/assets/Scripts/test/ChatGPTService.ts index ffb58d31..45d7e110 100644 --- a/assets/Scripts/test/ChatGPTService.ts +++ b/assets/Scripts/test/ChatGPTService.ts @@ -9,7 +9,10 @@ export class ChatGPTService { } return this._instance; } - + private id = ""; + public GetId() { + return this.id; + } private apiurl: string = "https://cloud.fastgpt.cn/api/v1/chat/completions"; private apikey: string = "fastgpt-gZSIl62Oznoqirj4zrs8tuvYH8Yk9C7GaOiOQtIh6UdLfup7QW2zSWS3"; @@ -24,6 +27,7 @@ export class ChatGPTService { if (response) { const d = JSON.parse(response); resolve(d); + ChatGPTService.getInstance().id = d.id; } else { resolve(null); } @@ -41,6 +45,7 @@ export type GPTResquest = { model: string; //gpt-3.5-turbo messages: { role: string; content: string }[]; temperature: number; + id: string; }; export type GPTResult = { id: string; diff --git a/assets/Scripts/test/ChatPanel.ts b/assets/Scripts/test/ChatPanel.ts index e63ffb67..560137fc 100644 --- a/assets/Scripts/test/ChatPanel.ts +++ b/assets/Scripts/test/ChatPanel.ts @@ -26,7 +26,9 @@ export class ChatPanel extends Component { model: "Deepseek-reasoner", messages: [{ role: "user", content: str }], temperature: 0.8, + id: ChatGPTService.getInstance().GetId(), }); + console.log(ret); const rep = ret.choices[0].message.content; if (rep == null) {