Chat相关表现&逻辑分离,新增ChatController

新增情绪机器人逻辑,
新增情绪切换视频逻辑
This commit is contained in:
2025-08-26 19:41:13 +08:00
parent 58bac34580
commit 1507fff7c5
25 changed files with 2763 additions and 6933 deletions
+120 -16
View File
@@ -60,6 +60,16 @@ export enum PriceType {
}
export enum VideoEmotion {
calm_down = 0,
arousal = 1,
desire = 2,
passion = 3,
orgasm = 4,
}
@@ -69,7 +79,8 @@ export class AiCharacter {
constructor(_buf_: ByteBuf) {
this.id = _buf_.readInt()
this.systemInstruction = _buf_.readString()
this.basePrompt = _buf_.readString()
this.additionPrompt = _buf_.readString()
}
/**
@@ -77,13 +88,18 @@ export class AiCharacter {
*/
readonly id: number
/**
* 系统指令
* 个人信息基础prompt(聊天&评分都需要)
*/
readonly systemInstruction: string
readonly basePrompt: string
/**
* 额外信息prompt(聊天&评分都需要)
*/
readonly additionPrompt: string
resolve(tables:Tables) {
}
}
@@ -101,7 +117,6 @@ export class Girl {
this.tagKey = _buf_.readString()
this.priceType = _buf_.readInt()
this.avatarPath = _buf_.readString()
this.starCount = _buf_.readInt()
}
/**
@@ -132,10 +147,6 @@ export class Girl {
* 头像路径
*/
readonly avatarPath: string
/**
* 评价星数
*/
readonly starCount: number
resolve(tables:Tables) {
@@ -145,7 +156,6 @@ export class Girl {
}
}
@@ -158,8 +168,8 @@ export class GirlDetail {
constructor(_buf_: ByteBuf) {
this.id = _buf_.readInt()
this.detailDesc = _buf_.readString()
{ let n = Math.min(_buf_.readSize(), _buf_.size); this.pics = []; for(let i = 0 ; i < n ; i++) { let _e0 ;_e0 = _buf_.readString(); this.pics.push(_e0);}}
{ let n = Math.min(_buf_.readSize(), _buf_.size); this.vids = []; for(let i = 0 ; i < n ; i++) { let _e0 ;_e0 = _buf_.readString(); this.vids.push(_e0);}}
{ let n = Math.min(_buf_.readSize(), _buf_.size); this.commercialImages = []; for(let i = 0 ; i < n ; i++) { let _e0 ;_e0 = new purchase.CommercialImage(_buf_); this.commercialImages.push(_e0);}}
{ let n = Math.min(_buf_.readSize(), _buf_.size); this.commercialVideos = []; for(let i = 0 ; i < n ; i++) { let _e0 ;_e0 = new purchase.CommercialVideo(_buf_); this.commercialVideos.push(_e0);}}
}
/**
@@ -171,19 +181,19 @@ export class GirlDetail {
*/
readonly detailDesc: string
/**
* 图片资源列表
* 类型
*/
readonly pics: string[]
readonly commercialImages: purchase.CommercialImage[]
/**
* 视频资源列表
*/
readonly vids: string[]
readonly commercialVideos: purchase.CommercialVideo[]
resolve(tables:Tables) {
for (let _e of this.commercialImages) { _e?.resolve(tables); }
for (let _e of this.commercialVideos) { _e?.resolve(tables); }
}
}
@@ -195,18 +205,25 @@ export class GlobalConfig {
constructor(_buf_: ByteBuf) {
this.ApiKey = _buf_.readString()
this.emotionApiKey = _buf_.readString()
this.Model = _buf_.readString()
this.Temperature = _buf_.readFloat()
this.MaxTokens = _buf_.readInt()
this.Timeout = _buf_.readInt()
this.FreeChatTimes = _buf_.readInt()
this.GameName = _buf_.readString()
this.EmotionRating = _buf_.readString()
this.girlBasePrompt = _buf_.readString()
}
/**
* api键
*/
readonly ApiKey: string
/**
* 情绪判断机器人api
*/
readonly emotionApiKey: string
/**
* ai模型
*/
@@ -228,6 +245,14 @@ export class GlobalConfig {
* 游戏名
*/
readonly GameName: string
/**
* 情绪评分机器人system_prompt,需拼接角色prompt
*/
readonly EmotionRating: string
/**
* ai机器人基础规则
*/
readonly girlBasePrompt: string
resolve(tables:Tables) {
@@ -237,6 +262,9 @@ export class GlobalConfig {
}
}
@@ -287,6 +315,70 @@ export class Language {
export namespace purchase {
export class CommercialImage {
constructor(_buf_: ByteBuf) {
this.imageType = _buf_.readInt()
this.imagePrice = _buf_.readFloat()
this.path = _buf_.readString()
}
/**
* 1=详情页展示<br/>2=聊天触发
*/
readonly imageType: number
/**
* 价格
*/
readonly imagePrice: number
/**
* 资源路径
*/
readonly path: string
resolve(tables:Tables) {
}
}
}
export namespace purchase {
export class CommercialVideo {
constructor(_buf_: ByteBuf) {
this.path = _buf_.readString()
this.emotion = _buf_.readInt()
this.videoPrice = _buf_.readFloat()
}
/**
* 资源路径
*/
readonly path: string
/**
* 关联情绪
*/
readonly emotion: VideoEmotion
/**
* 价格
*/
readonly videoPrice: number
resolve(tables:Tables) {
}
}
}
export class PurchaseConfig {
@@ -625,6 +717,10 @@ export class TbGlobalConfig {
* api键
*/
get ApiKey(): string { return this._data.ApiKey; }
/**
* 情绪判断机器人api
*/
get emotionApiKey(): string { return this._data.emotionApiKey; }
/**
* ai模型
*/
@@ -646,6 +742,14 @@ export class TbGlobalConfig {
* 游戏名
*/
get GameName(): string { return this._data.GameName; }
/**
* 情绪评分机器人system_prompt,需拼接角色prompt
*/
get EmotionRating(): string { return this._data.EmotionRating; }
/**
* ai机器人基础规则
*/
get girlBasePrompt(): string { return this._data.girlBasePrompt; }
resolve(tables:Tables) {
this._data.resolve(tables)