summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'packages/app/src/utils')
-rw-r--r--packages/app/src/utils/prompt.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/packages/app/src/utils/prompt.ts b/packages/app/src/utils/prompt.ts
index 5d9edfed1..35aec0071 100644
--- a/packages/app/src/utils/prompt.ts
+++ b/packages/app/src/utils/prompt.ts
@@ -53,10 +53,11 @@ function textPartValue(parts: Part[]) {
* Extract prompt content from message parts for restoring into the prompt input.
* This is used by undo to restore the original user prompt.
*/
-export function extractPromptFromParts(parts: Part[], opts?: { directory?: string }): Prompt {
+export function extractPromptFromParts(parts: Part[], opts?: { directory?: string; attachmentName?: string }): Prompt {
const textPart = textPartValue(parts)
const text = textPart?.text ?? ""
const directory = opts?.directory
+ const attachmentName = opts?.attachmentName ?? "attachment"
const toRelative = (path: string) => {
if (!directory) return path
@@ -104,7 +105,7 @@ export function extractPromptFromParts(parts: Part[], opts?: { directory?: strin
images.push({
type: "image",
id: filePart.id,
- filename: filePart.filename ?? "attachment",
+ filename: filePart.filename ?? attachmentName,
mime: filePart.mime,
dataUrl: filePart.url,
})