This commit is contained in:
2025-09-19 18:20:10 +08:00
parent 249f32c25f
commit 15cddb6474
3 changed files with 56 additions and 30 deletions
+23 -14
View File
@@ -2,7 +2,7 @@
* 全局数据
*/
import { BaseData } from "./BaseData";
import proto from 'db://assets/Scripts/proto/proto.pb.js';
import proto from "db://assets/Scripts/proto/proto.pb.js";
export class GlobalData extends BaseData {
// api键
@@ -28,7 +28,9 @@ export class GlobalData extends BaseData {
// 情绪评分机器人system_prompt,需拼接角色prompt
private _emotionRating: string = "";
// ai机器人基础规则
private _girlBasePrompt: string = "";
private _girlBasePrompt: string = "";
// emotion基础规则
private _emotionBasePrompt: string = "";
public reset(): void {
this._apiKey = "";
@@ -43,6 +45,7 @@ export class GlobalData extends BaseData {
this._gameName = "";
this._emotionRating = "";
this._girlBasePrompt = "";
this._emotionBasePrompt = "";
}
public clear(): void {
@@ -58,6 +61,7 @@ export class GlobalData extends BaseData {
this._gameName = "";
this._emotionRating = "";
this._girlBasePrompt = "";
this._emotionBasePrompt = "";
}
public destroy(): void {
@@ -74,6 +78,7 @@ export class GlobalData extends BaseData {
this._gameName = null;
this._emotionRating = null;
this._girlBasePrompt = null;
this._emotionBasePrompt = null;
}
/** 设置全局数据 */
@@ -93,14 +98,15 @@ export class GlobalData extends BaseData {
this._gameName = obj.GameName;
this._emotionRating = obj.EmotionRating;
this._girlBasePrompt = obj.girlBasePrompt;
this._emotionBasePrompt = obj.EmotionBasePrompt;
console.log("设置全局数据: ", this._gameName);
}
}
}
/** 获取api键 */
public getApiKey(): string {
return this._apiKey;
}
}
/** 获取情绪判断机器人api */
public getEmotionApiKey(): string {
@@ -110,50 +116,53 @@ export class GlobalData extends BaseData {
/** 获取ai模型 */
public getModel(): string {
return this._model;
}
}
/** Temperature */
public getTemperature(): number {
return this._temperature;
}
}
/** 单次聊天最大token */
public getMaxTokens(): number {
return this._maxTokens;
}
}
/** 超时时间(微秒) */
public getTimeout(): number {
return this._timeout;
}
}
/** 单个角色免费聊天次数 */
public getFreeChatTimes(): number {
return this._freeChatTimes;
}
}
/** 单次对话增长好感度 */
public getOnceChatAddScore(): number {
return this._onceChatAddScore;
}
}
/** 好感度等级兑换比例 */
public getScoreExchangeStarLevel(): number {
return this._scoreExchangeStarLevel;
}
}
/** 游戏名 */
public getGameName(): string {
return this._gameName;
}
}
/** 情绪评分机器人system_prompt,需拼接角色prompt */
public getEmotionRating(): string {
return this._emotionRating;
}
}
/** ai机器人基础规则 */
public getGirlBasePrompt(): string {
return this._girlBasePrompt;
}
}
public getEmotionBasePrompt(): string {
return this._emotionBasePrompt;
}
}