fix(tui): save pasted images for text-only models#921
Conversation
🦋 Changeset detectedLatest commit: f819471 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f81947138f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| getPastedImageDir(), | ||
| `pasted-${String(Date.now())}-${String(att.id)}-${randomUUID()}${extensionForMime(att.mime)}`, | ||
| ); | ||
| writeFileSync(path, att.bytes, { mode: 0o600 }); |
There was a problem hiding this comment.
Remove pasted-image temp files during cleanup
When a user pastes an image while using a model without image_in, this writes the raw pasted bytes under /tmp/kimi-code-pasted-images-*, but the new temp directory/files are never tracked or removed on successful send, queued-message cancellation, or KimiTUI.stop(). Pasted screenshots often contain sensitive data and can be large, so they will remain on disk across CLI sessions until the OS eventually cleans temp storage; please add lifecycle cleanup for the generated files/directories once they are no longer needed.
Useful? React with 👍 / 👎.
Related Issue
Resolve #905
Problem
Pasted images currently fail on models without
image_in, even though text-only models can still hand a local image path to a vision MCP server.What changed
image_urlprompt part path for image-capable models.<image path="..."></image>text tag.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.AI Assistance Disclosure
I used Codex to review the changes, sanity-check the implementation against existing patterns, and help spot potential edge cases.