Merge pull request #1618 from code-yeongyu/fix/594-user-prompt-submit-fires-once
fix(hooks): fire UserPromptSubmitHooks on every prompt, not just first (#594)
This commit is contained in:
@@ -44,9 +44,16 @@ export async function executeUserPromptSubmitHooks(
|
||||
return { block: false, modifiedParts, messages }
|
||||
}
|
||||
|
||||
// Check if hook tags are in the current user input only (not in injected context)
|
||||
// by checking only the text parts that were provided in this message
|
||||
const userInputText = ctx.parts
|
||||
.filter((p) => p.type === "text" && p.text)
|
||||
.map((p) => p.text ?? "")
|
||||
.join("\n")
|
||||
|
||||
if (
|
||||
ctx.prompt.includes(USER_PROMPT_SUBMIT_TAG_OPEN) &&
|
||||
ctx.prompt.includes(USER_PROMPT_SUBMIT_TAG_CLOSE)
|
||||
userInputText.includes(USER_PROMPT_SUBMIT_TAG_OPEN) &&
|
||||
userInputText.includes(USER_PROMPT_SUBMIT_TAG_CLOSE)
|
||||
) {
|
||||
return { block: false, modifiedParts, messages }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user