frontmatter in skills/t/p
This commit is contained in:
@@ -19,6 +19,7 @@ type EmbeddableChatProps = {
|
||||
onBeforeSend?: (text: string) => boolean | Promise<boolean>;
|
||||
commandFeedback?: string | null;
|
||||
defaultInput?: string;
|
||||
promptPrefix?: string;
|
||||
className?: string;
|
||||
cwd?: { root?: string; path: string };
|
||||
autoSend?: boolean;
|
||||
@@ -32,6 +33,7 @@ export const EmbeddableChat = ({
|
||||
onBeforeSend,
|
||||
commandFeedback = null,
|
||||
defaultInput = '',
|
||||
promptPrefix,
|
||||
className,
|
||||
cwd,
|
||||
autoSend = false,
|
||||
@@ -126,8 +128,8 @@ export const EmbeddableChat = ({
|
||||
}
|
||||
}
|
||||
|
||||
// Prepend attachment content to the prompt
|
||||
let prompt = text;
|
||||
// Prepend metadata/attachment content to the prompt
|
||||
let prompt = promptPrefix ? `${promptPrefix}\n\n${text}` : text;
|
||||
const ids: string[] = [];
|
||||
const images: { filename: string; dataUrl: string }[] = [];
|
||||
for (const a of attachments) {
|
||||
|
||||
@@ -55,11 +55,15 @@ const ResourceChat = ({
|
||||
}: ResourceChatProps) => {
|
||||
const client = useClient();
|
||||
const claudeModels = useVisibleClaudeModels();
|
||||
const seedFile = `${kind.toUpperCase()}.md`;
|
||||
const promptFrontmatter = chatSessionId
|
||||
? undefined
|
||||
: `<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 defaultInput = chatSessionId
|
||||
? undefined
|
||||
: isNew
|
||||
? `Help me create the content for this new ${kind} file: ${filePath}`
|
||||
: `Help me understand and improve this ${kind} file: ${filePath}`;
|
||||
? `Help me create the content for this new ${kind} file`
|
||||
: `Help me understand and improve this ${kind} file`;
|
||||
|
||||
const storage = useMemo(
|
||||
() => ({
|
||||
@@ -99,6 +103,7 @@ const ResourceChat = ({
|
||||
provider="claude"
|
||||
availableModels={claudeModels}
|
||||
defaultInput={defaultInput}
|
||||
promptPrefix={promptFrontmatter}
|
||||
className="h-full"
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user