Documentation Index
Fetch the complete documentation index at: https://tech.illasoft.com/llms.txt
Use this file to discover all available pages before exploring further.
概述
Generator 是 Kira 的核心工作区,用于 AI 图片生成、视频生成、音乐生成和编辑。根据mediaType 自动切换图片、视频和音频模式。
组件层次
AI 对话集成
使用 Vercel AI SDK v6 与后端通信:api 和 body 不是 useKiraChat 的直接参数,它们在内部 ChatManager 中配置。实际代码位于 lib/chat/kirachat.tsx。消息类型
| 类型 | 说明 |
|---|---|
text | AI 文本回复 |
tool-call | 工具调用请求 |
tool-result | 工具执行结果 |
poisson-function 消息标记
AI 返回的工具调用在消息中使用特殊 marker 格式:工具调用流程
工具栏功能
| 工具 | 组件 | EditMode | toolName (analytics) |
|---|---|---|---|
| 滤镜 | FilterSelector / ChooseFilterSelector | filter / chooseFilter | applyFilter / getFilterChoiceFromUser |
| 调整 | PCAdjustSelector / MobileAdjustSelector | adjust | applyAdjust |
| 裁剪 | PCCropSelector / MobileCropSelector | crop | getAutoCropResultFromUser |
| 放大 | UpscaleSelector | upscale | applyUpscale |
| 擦除 | EraserSelector | eraser | applyEraser |
| 重绘 | InpaintSelector | inpaint | applyInpaint |
| 扩展 | ExpandSelector | expand | — |
| 换背景 | ReplaceBgSelector | replaceBg | applyReplaceBg |
| 图片生成 | GenerateImageSelector | generateImage | generateImageWithAI |
| 视频生成 | VideoSelector | generateVideo | generateVideo |
| 视频修剪 | VideoTrimSelector | trimVideo | trimVideo |
| 视频编辑 | VideoEditSelector | videoEdit | videoEdit |
| 视频延长 | VideoExtendSelector | videoExtend | videoExtend |
| Motion Control | MotionControlSelector | motionControl | motionControl |
| 歌曲生成 | MusicSelector | generateMusic | generateMusic |
| 器乐生成 | InstrumentalSelector | generateInstrumental | generateInstrumental |
| 添加人声 | AddVocalsSelector | addVocals | addVocals |
| 音频修剪 | AudioTrimSelector | trimAudio | trimAudio |
工具文件位置:components/feature/common/generator/tool/
Selector 文件位置:components/feature/common/generator/*-selector.tsx
数据流
媒体类型切换
Generator 页面根据mediaType 切换三种模式:
图片状态管理
store 代码位于仓库根目录
store/(不是 src/store/)。详见 State 文档。键盘快捷键
| 快捷键 | 功能 |
|---|---|
Ctrl/Cmd + Z | 撤销 |
Ctrl/Cmd + S | 保存 |
Ctrl/Cmd + E | 导出 |
Space | 平移图片 |
+/- | 缩放 |