Skip to content

fix(tui): save pasted images for text-only models#921

Open
tt-a1i wants to merge 1 commit into
MoonshotAI:mainfrom
tt-a1i:fix/pasted-image-text-model-path
Open

fix(tui): save pasted images for text-only models#921
tt-a1i wants to merge 1 commit into
MoonshotAI:mainfrom
tt-a1i:fix/pasted-image-text-model-path

Conversation

@tt-a1i

@tt-a1i tt-a1i commented Jun 20, 2026

Copy link
Copy Markdown

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

  • Keep the existing image_url prompt part path for image-capable models.
  • For text-only models, save pasted images to a private temp file and send an <image path="..."></image> text tag.
  • Keep unsupported video rejection unchanged.
  • Added TUI and placeholder utility coverage for the fallback path.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, 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.

@changeset-bot

changeset-bot Bot commented Jun 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f819471

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

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

@tt-a1i tt-a1i marked this pull request as ready for review June 20, 2026 04:19

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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 });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pasted images fail on text-only models — should offload to file + MCP path

1 participant