the last two shell strings were the composer's pre-filled prompt (2 -> 0)
CapabilityPage puts a suggestion in the chat composer, which the reader sees and edits before sending -- user-facing, so translated. The hidden promptFrontmatter beside it is NOT: that one instructs the agent and carries file paths. The scanner never flagged it, correctly, because it opens with a tag rather than a capital. officer-web is now at zero convertible strings.
This commit is contained in:
@@ -278,12 +278,18 @@ export const CapabilityChat = ({
|
|||||||
description,
|
description,
|
||||||
onResponseEnd,
|
onResponseEnd,
|
||||||
}: CapabilityChatProps) => {
|
}: CapabilityChatProps) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
const seedFile = `${kind.toUpperCase()}.md`;
|
const seedFile = `${kind.toUpperCase()}.md`;
|
||||||
const genericPrefix = `<frontmatter>\ninput file: ${filePath}\n${seedFile}: ${filePath}\ndir: ${resourceDir}\n\nBe aware of any extra files alongside the same dir as the ${kind} file we're handling, for possible extra context. You can also, if pertinent, create scripts or other files that will help you in the future.\n</frontmatter>`;
|
const genericPrefix = `<frontmatter>\ninput file: ${filePath}\n${seedFile}: ${filePath}\ndir: ${resourceDir}\n\nBe aware of any extra files alongside the same dir as the ${kind} file we're handling, for possible extra context. You can also, if pertinent, create scripts or other files that will help you in the future.\n</frontmatter>`;
|
||||||
const promptFrontmatter = isNew ? (buildCreationPrefix(kind, filePath, resourceDir) ?? genericPrefix) : genericPrefix;
|
const promptFrontmatter = isNew ? (buildCreationPrefix(kind, filePath, resourceDir) ?? genericPrefix) : genericPrefix;
|
||||||
|
/*
|
||||||
|
The composer's PRE-FILLED text, which the reader sees and edits — so it is translated. The hidden
|
||||||
|
`promptFrontmatter` above is not: that one instructs the agent and carries file paths, and is
|
||||||
|
machine-facing rather than something anybody reads.
|
||||||
|
*/
|
||||||
const defaultInput = isNew
|
const defaultInput = isNew
|
||||||
? (description ?? `Help me create the content for this new ${kind} file`)
|
? (description ?? t('capability.createPrompt', { kind: kind.toLowerCase() }))
|
||||||
: `Help me understand and improve this ${kind} file`;
|
: t('capability.improvePrompt', { kind: kind.toLowerCase() });
|
||||||
|
|
||||||
const chat = useChat(undefined, undefined, { replaceUrl: false });
|
const chat = useChat(undefined, undefined, { replaceUrl: false });
|
||||||
|
|
||||||
|
|||||||
@@ -697,6 +697,8 @@
|
|||||||
"searchPlaceholder": "Search {{kind}}…",
|
"searchPlaceholder": "Search {{kind}}…",
|
||||||
"selectOne": "Select a {{kind}}",
|
"selectOne": "Select a {{kind}}",
|
||||||
"selectToView": "Select a {{kind}} to view its contents",
|
"selectToView": "Select a {{kind}} to view its contents",
|
||||||
"delete": "Delete"
|
"delete": "Delete",
|
||||||
|
"createPrompt": "Help me create the content for this new {{kind}} file",
|
||||||
|
"improvePrompt": "Help me understand and improve this {{kind}} file"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -697,6 +697,8 @@
|
|||||||
"searchPlaceholder": "Pesquisar {{kind}}…",
|
"searchPlaceholder": "Pesquisar {{kind}}…",
|
||||||
"selectOne": "Selecione um {{kind}}",
|
"selectOne": "Selecione um {{kind}}",
|
||||||
"selectToView": "Selecione um {{kind}} para ver o seu conteúdo",
|
"selectToView": "Selecione um {{kind}} para ver o seu conteúdo",
|
||||||
"delete": "Eliminar"
|
"delete": "Eliminar",
|
||||||
|
"createPrompt": "Ajuda-me a criar o conteúdo deste novo ficheiro de {{kind}}",
|
||||||
|
"improvePrompt": "Ajuda-me a compreender e melhorar este ficheiro de {{kind}}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user