refactor(instructions): share instruction template rendering via @d3ro/core
This commit is contained in:
parent
d311e8123f
commit
ba0dbbd813
11 changed files with 423 additions and 36 deletions
|
|
@ -353,7 +353,7 @@ export function buildInstructionPrompt(instructionPrompt: string, input: string)
|
|||
throw new CommandClientError('invalid-request', false)
|
||||
}
|
||||
const combined = prompt.includes('{{text}}')
|
||||
? prompt.replace('{{text}}', normalizedInput)
|
||||
? prompt.replace('{{text}}', () => normalizedInput) // 함수 replacer: `$&`·`$'`·`$$` 해석 방지
|
||||
: `${prompt}\n\n${normalizedInput}`
|
||||
if (combined.length > MESSAGE_MAX_CHARS) throw new CommandClientError('invalid-request', false)
|
||||
return combined
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue