代码结构整理
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import System_Instruction from "../config/SystemPrompts";
|
||||
|
||||
/**
|
||||
* 角色配置映射
|
||||
* 将角色ID映射到对应的System Instruction
|
||||
*/
|
||||
export class RoleConfig {
|
||||
private static roleMap: Map<number, string> = new Map([
|
||||
[10001, System_Instruction.Role_1], // Anaya Kapoor - 成熟魅惑型
|
||||
[10002, System_Instruction.Role_2], // Meher Joshi - 猫咪性格
|
||||
[10003, System_Instruction.Role_3], // Sana Reddy - 小狗性格
|
||||
]);
|
||||
|
||||
/**
|
||||
* 根据角色ID获取对应的System Instruction
|
||||
* @param roleId 角色ID
|
||||
* @returns System Instruction字符串,如果未找到则返回默认Role_1
|
||||
*/
|
||||
public static getRoleInstruction(roleId: number): string {
|
||||
return this.roleMap.get(roleId) || System_Instruction.Role_1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加或更新角色配置
|
||||
* @param roleId 角色ID
|
||||
* @param instruction System Instruction内容
|
||||
*/
|
||||
public static setRoleInstruction(roleId: number, instruction: string): void {
|
||||
this.roleMap.set(roleId, instruction);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查角色是否存在配置
|
||||
* @param roleId 角色ID
|
||||
*/
|
||||
public static hasRole(roleId: number): boolean {
|
||||
return this.roleMap.has(roleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有配置的角色ID
|
||||
*/
|
||||
public static getAllRoleIds(): number[] {
|
||||
return Array.from(this.roleMap.keys());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user