|
@@ -412,9 +412,13 @@ export class GameService implements OnModuleInit {
|
|
|
const charactorsAlive = charactors.filter((i) => i.dead === false)
|
|
const charactorsAlive = charactors.filter((i) => i.dead === false)
|
|
|
const charactorsWillDead = charactorsAlive.filter((i) => !i.dead && i.hp <= 0)
|
|
const charactorsWillDead = charactorsAlive.filter((i) => !i.dead && i.hp <= 0)
|
|
|
|
|
|
|
|
|
|
+ const vars = {
|
|
|
|
|
+ days: Math.floor(differenceInDays(date, history[0].date)),
|
|
|
|
|
+ charactors: charactors
|
|
|
|
|
+ }
|
|
|
let summary = this.formatSummary(history)
|
|
let summary = this.formatSummary(history)
|
|
|
let prompt = new PromptTemplate({
|
|
let prompt = new PromptTemplate({
|
|
|
- template: await this.promptService.getPromptByName(PromptName.NextPlot, game.type),
|
|
|
|
|
|
|
+ template: this.evalPrompt(vars, await this.promptService.getPromptByName(PromptName.NextPlot, game.type)),
|
|
|
inputVariables: ['background', 'charactors', 'datetime', 'summary', 'choice', 'death', 'newCharactor']
|
|
inputVariables: ['background', 'charactors', 'datetime', 'summary', 'choice', 'death', 'newCharactor']
|
|
|
})
|
|
})
|
|
|
const formatedCharactors = this.formatCharactors(charactors)
|
|
const formatedCharactors = this.formatCharactors(charactors)
|
|
@@ -452,12 +456,7 @@ export class GameService implements OnModuleInit {
|
|
|
: ''
|
|
: ''
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- const vars = {
|
|
|
|
|
- days: Math.floor(differenceInDays(date, history[0].date)),
|
|
|
|
|
- charactors: charactors
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const response = await this.callLLM([new HumanMessage(this.evalPrompt(vars, input))])
|
|
|
|
|
|
|
+ const response = await this.callLLM([new HumanMessage(input)])
|
|
|
plot = response.content
|
|
plot = response.content
|
|
|
|
|
|
|
|
this.send(`${id}`, {
|
|
this.send(`${id}`, {
|
|
@@ -796,7 +795,10 @@ export class GameService implements OnModuleInit {
|
|
|
)
|
|
)
|
|
|
const formatInstructions = parser.getFormatInstructions()
|
|
const formatInstructions = parser.getFormatInstructions()
|
|
|
const prompt = new PromptTemplate({
|
|
const prompt = new PromptTemplate({
|
|
|
- template: await this.promptService.getPromptByName(PromptName.GenChoice, type),
|
|
|
|
|
|
|
+ template: this.evalPrompt(
|
|
|
|
|
+ vars,
|
|
|
|
|
+ await this.promptService.getPromptByName(PromptName.GenChoice, type)
|
|
|
|
|
+ ),
|
|
|
inputVariables: ['charactorsAlive', 'charactorsDead', 'summary'],
|
|
inputVariables: ['charactorsAlive', 'charactorsDead', 'summary'],
|
|
|
partialVariables: { format_instructions: formatInstructions }
|
|
partialVariables: { format_instructions: formatInstructions }
|
|
|
})
|
|
})
|