MujicaUI

Chat Sessions · #259

ArtifactCard 浅色主题渲染快照
浅色 · 渲染快照
ArtifactCard 深色主题渲染快照
深色 · 渲染快照

259 ArtifactCard · 产物卡片

用途

消息中的产物卡片(代码、文档、网页),点击打开产物面板。

最小示例

view := func(c *ui.Context) {
	core.Use(c, core.Settings{})
	if chat.ArtifactCard(c, chat.ArtifactCardOptions{Title: "seating.go", Detail: "Go · 120 lines"}).Changed() {
		log.Println("open artifact panel")
	}
}
ui.Render(view, 400, 300, 1)

参数

func ArtifactCard(c *ui.Context, opts ArtifactCardOptions) ChoiceResult。

字段类型默认值含义
KindArtifactKindArtifactCodeArtifactCode、ArtifactDocument、ArtifactWeb;越界 panic。
Titlestring必填产物标题。
Detailstring""简短说明,如“Go · 120 行”。
Streamingboolfalse仍在生成,显示旋转标记。
Disabledboolfalse禁用。

状态

默认、悬停、聚焦、生成中、禁用。种类同时用图标与文字表示。

事件

Changed():请求打开产物面板。

键盘操作

  • Tab 聚焦;Enter/Space 打开。

限制

  • 卡片不渲染产物内容,面板由调用方实现。