add: dynamic instructions (#927)

This commit is contained in:
Fouad Matin
2025-05-14 01:27:46 -07:00
committed by GitHub
parent 1bf00a3a95
commit 678f0dbfec
3 changed files with 30 additions and 7 deletions

View File

@@ -325,14 +325,12 @@ function rewriteFileCitations(
fileOpener: FileOpenerScheme | undefined,
cwd: string = process.cwd(),
): string {
if (!fileOpener) {
// Should we reformat the citations even if we cannot linkify them?
return markdown;
}
citationRegex.lastIndex = 0;
return markdown.replace(citationRegex, (_match, file, start, _end) => {
const absPath = path.resolve(cwd, file);
if (!fileOpener) {
return `[${file}](${absPath})`;
}
const uri = `${fileOpener}://file${absPath}:${start}`;
const label = `${file}:${start}`;
// In practice, sometimes multiple citations for the same file, but with a

View File

@@ -62,11 +62,19 @@ const TerminalMessageHistory: React.FC<TerminalMessageHistoryProps> = ({
key={`${message.id}-${index}`}
flexDirection="column"
marginLeft={
message.type === "message" && message.role === "user" ? 0 : 4
message.type === "message" &&
(message.role === "user" || message.role === "assistant")
? 0
: 4
}
marginTop={
message.type === "message" && message.role === "user" ? 0 : 1
}
marginBottom={
message.type === "message" && message.role === "assistant"
? 1
: 0
}
>
<TerminalChatResponseItem
item={message}