This commit is contained in:
2025-07-22 17:48:45 +08:00
parent ba607bd441
commit 2f6d583ebf
2 changed files with 8 additions and 1 deletions
+6 -1
View File
@@ -9,7 +9,10 @@ export class ChatGPTService {
} }
return this._instance; return this._instance;
} }
private id = "";
public GetId() {
return this.id;
}
private apiurl: string = "https://cloud.fastgpt.cn/api/v1/chat/completions"; private apiurl: string = "https://cloud.fastgpt.cn/api/v1/chat/completions";
private apikey: string = private apikey: string =
"fastgpt-gZSIl62Oznoqirj4zrs8tuvYH8Yk9C7GaOiOQtIh6UdLfup7QW2zSWS3"; "fastgpt-gZSIl62Oznoqirj4zrs8tuvYH8Yk9C7GaOiOQtIh6UdLfup7QW2zSWS3";
@@ -24,6 +27,7 @@ export class ChatGPTService {
if (response) { if (response) {
const d = JSON.parse(response); const d = JSON.parse(response);
resolve(d); resolve(d);
ChatGPTService.getInstance().id = d.id;
} else { } else {
resolve(null); resolve(null);
} }
@@ -41,6 +45,7 @@ export type GPTResquest = {
model: string; //gpt-3.5-turbo model: string; //gpt-3.5-turbo
messages: { role: string; content: string }[]; messages: { role: string; content: string }[];
temperature: number; temperature: number;
id: string;
}; };
export type GPTResult = { export type GPTResult = {
id: string; id: string;
+2
View File
@@ -26,7 +26,9 @@ export class ChatPanel extends Component {
model: "Deepseek-reasoner", model: "Deepseek-reasoner",
messages: [{ role: "user", content: str }], messages: [{ role: "user", content: str }],
temperature: 0.8, temperature: 0.8,
id: ChatGPTService.getInstance().GetId(),
}); });
console.log(ret);
const rep = ret.choices[0].message.content; const rep = ret.choices[0].message.content;
if (rep == null) { if (rep == null) {