Files
18xchat/assets/Scripts/chat18x/config/GlobalConfig.ts
T
2025-09-19 23:25:51 +08:00

111 lines
2.9 KiB
TypeScript

/**
* 全局配置
*/
import { BaseConfig } from "./BaseConfig";
import { ConfigManager } from "../manager/ConfigManager";
export class GlobalConfig extends BaseConfig {
public reset(): void {
}
public clear(): void {
}
public destroy(): void {
super.destroy();
}
/**
* 获取所有配置
*/
protected getAllConfig(): any | null {
return ConfigManager.tables.TbGlobalConfig;
}
/** 获取api键 */
public getApiKey(): string | null {
let oneData = this.getAllConfig();
if (!oneData) return null;
return oneData.ApiKey;
}
/** 获取情绪判断机器人api */
public getEmotionApiKey(): string | null {
let oneData = this.getAllConfig();
if (!oneData) return null;
return oneData.emotionApiKey;
}
/** 获取ai模型 */
public getModel(): string | null {
let oneData = this.getAllConfig();
if (!oneData) return null;
return oneData.Model;
}
/** Temperature */
public getTemperature(): number | null {
let oneData = this.getAllConfig();
if (!oneData) return null;
return oneData.Temperature;
}
/** 单次聊天最大token */
public getMaxTokens(): number | null {
let oneData = this.getAllConfig();
if (!oneData) return null;
return oneData.MaxTokens;
}
/** 超时时间(微秒) */
public getTimeout(): number | null {
let oneData = this.getAllConfig();
if (!oneData) return null;
return oneData.Timeout;
}
/** 单个角色免费聊天次数 */
public getFreeChatTimes(): number | null {
let oneData = this.getAllConfig();
if (!oneData) return null;
return oneData.FreeChatTimes;
}
/** 单次对话增长好感度 */
public getOnceChatAddScore(): number | null {
let oneData = this.getAllConfig();
if (!oneData) return null;
return oneData.OnceChatAddScore;
}
/** 好感度等级兑换比例 */
public getScoreExchangeStarLevel(): number | null {
let oneData = this.getAllConfig();
if (!oneData) return null;
return oneData.ScoreExchangeStarLevel;
}
/** 游戏名 */
public getGameName(): string | null {
let oneData = this.getAllConfig();
if (!oneData) return null;
return oneData.GameName;
}
/** 情绪评分机器人system_prompt,需拼接角色prompt */
public getEmotionBasePrompt(): string | null {
let oneData = this.getAllConfig();
if (!oneData) return null;
return oneData.EmotionBasePrompt;
}
/** ai机器人基础规则 */
public getGirlBasePrompt(): string | null {
let oneData = this.getAllConfig();
if (!oneData) return null;
return oneData.girlBasePrompt;
}
}