Skip to content

feat: guide AI to use ReadMediaFile for video analysis instead of manual frame extraction#1912

Open
bj456736 wants to merge 3 commits into
MoonshotAI:mainfrom
bj456736:feat/video-readmediafile-prompt-20260719
Open

feat: guide AI to use ReadMediaFile for video analysis instead of manual frame extraction#1912
bj456736 wants to merge 3 commits into
MoonshotAI:mainfrom
bj456736:feat/video-readmediafile-prompt-20260719

Conversation

@bj456736

Copy link
Copy Markdown
Contributor

Summary

Adds explicit guidance in the system prompt to prefer the ReadMediaFile tool over writing Python/ffmpeg scripts when analyzing video content. This prevents inefficient manual frame extraction and leverages built-in multimodal capabilities.

Changes

  • Modified packages/agent-core/src/profile/default/system.md
    • In the "General Guidelines for Research and Data Processing" section, updated the multimedia processing guideline to:
      • Remove "videos" from the list of file types to process with Python/shell scripts
      • Add explicit instruction: For video files, prefer using the ReadMediaFile tool to read them directly rather than writing Python scripts or ffmpeg commands to extract frames manually.

Motivation

Currently, when users upload video files, the AI often defaults to writing Python scripts with OpenCV or ffmpeg commands to extract frames manually. This approach is:

  • Inefficient — requires installing dependencies, writing boilerplate code, and managing temporary files
  • Error-prone — frame extraction logic can fail on various video formats
  • Redundant — the ReadMediaFile tool already provides native multimodal video reading capabilities

By explicitly guiding the AI to prefer ReadMediaFile for video files, we improve user experience and reduce unnecessary code generation.

Related

  • Task: Kimi CLI 视频分析希望默认调用 ReadMediaFile 而不是写 Python 切帧 (P0)
  • Feedback: Q-0266

qer added 3 commits July 18, 2026 18:06
When vis-server binds to 0.0.0.0 or :: (all interfaces), the startup
banner and CLI output now display the actual LAN IP addresses that
other devices on the same network can use to connect. This enables
lan-range remote control from phones, tablets, or other machines.

Changes:
- Add isAllInterfaces() and getLocalNetworkAddresses() to config.ts
- Add lanUrls field to StartedVisServer in start.ts
- Update formatStartupBanner() to list LAN URLs when applicable
- Update vis CLI handler to print LAN access URLs
- Add unit tests for isAllInterfaces and getLocalNetworkAddresses
…ual frame extraction

Adds explicit guidance in system prompt to prefer ReadMediaFile tool over
writing Python/ffmpeg scripts when analyzing video content. This prevents
inefficient manual frame extraction and leverages built-in multimodal capabilities.

- Modified system.md General Guidelines for Research and Data Processing
- Target task: Kimi CLI 视频分析希望默认调用 ReadMediaFile 而不是写 Python 切帧
@changeset-bot

changeset-bot Bot commented Jul 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ff32fd9

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

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

@pkg-pr-new

pkg-pr-new Bot commented Jul 19, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@ff32fd9
npx https://pkg.pr.new/@moonshot-ai/kimi-code@ff32fd9

commit: ff32fd9

@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: ff32fd9da4

ℹ️ 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".

port: info.port,
host,
url: `http://${hostForUrl(host)}:${info.port}/`,
lanUrls: isAllInterfaces(host) ? getLocalNetworkAddresses(info.port) : undefined,

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 Include the auth token in LAN access URLs

When binding to 0.0.0.0 or ::, resolveVisAuthToken requires VIS_AUTH_TOKEN for non-loopback hosts, and the vis web client only sends that token after reading token/vis_token from the URL or existing localStorage. The lanUrls returned here are bare URLs, so a fresh phone/tablet opening one will load the shell but every /api request gets 401; append the token to these auth-required URLs or provide a login flow.

Useful? React with 👍 / 👎.

Comment on lines +13 to +14
if (!iface.internal && iface.family === 'IPv4') {
addresses.push(`http://${iface.address}:${port}/`);

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 Support IPv6 LAN URLs for :: binds

For VIS_HOST=:: or --host :: on an IPv6-only LAN, startVisServer considers the host an all-interfaces bind but this helper drops every IPv6 interface, so the new LAN access block is empty or only shows IPv4 URLs that may not connect. Include non-internal IPv6 addresses as bracketed URLs, e.g. http://[addr]:port/, when advertising an IPv6 all-interface bind.

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.

1 participant