Polish agent dialog and card copy
This commit is contained in:
parent
d27d25e6ff
commit
5aabe83da7
@ -1,7 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { Copy, Pencil, Sparkles, Trash2, Video } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { cn } from "@/lib/utils";
|
||||
import type { AgentPreset } from "@/types/agent";
|
||||
@ -82,55 +81,59 @@ export function AgentPresetCard({
|
||||
</Badge>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="absolute right-2 top-2 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100">
|
||||
{preset.visibility === "private" && onEdit ? (
|
||||
<button
|
||||
type="button"
|
||||
className="inline-flex h-8 w-8 items-center justify-center rounded-full bg-white/90 text-black shadow-sm transition-colors hover:bg-white"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
onEdit(preset);
|
||||
}}
|
||||
title="编辑"
|
||||
>
|
||||
<Pencil className="h-4 w-4" />
|
||||
</button>
|
||||
) : null}
|
||||
{preset.visibility === "private" && onDelete ? (
|
||||
<button
|
||||
type="button"
|
||||
className="inline-flex h-8 w-8 items-center justify-center rounded-full bg-white/90 text-destructive shadow-sm transition-colors hover:bg-white"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
onDelete(preset);
|
||||
}}
|
||||
title="删除"
|
||||
>
|
||||
<Trash2 className="h-4 w-4" />
|
||||
</button>
|
||||
) : null}
|
||||
{preset.visibility === "public" && onFork ? (
|
||||
<button
|
||||
type="button"
|
||||
className="inline-flex h-8 w-8 items-center justify-center rounded-full bg-white/90 text-black shadow-sm transition-colors hover:bg-white"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
onFork(preset);
|
||||
}}
|
||||
title="另存为我的智能体"
|
||||
>
|
||||
<Copy className="h-4 w-4" />
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2 p-3">
|
||||
<div className="space-y-1.5 p-3">
|
||||
<div className="line-clamp-1 text-sm font-semibold">{preset.name}</div>
|
||||
<div className="flex items-center justify-between gap-3 text-xs text-muted-foreground">
|
||||
<span className="truncate">{ownerName}</span>
|
||||
<span className="shrink-0">{publishedAt}</span>
|
||||
<div className="line-clamp-1 text-xs text-muted-foreground">
|
||||
发布人:{ownerName}
|
||||
</div>
|
||||
<div className="text-xs text-muted-foreground">
|
||||
发布时间:{publishedAt}
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
|
||||
<div className="flex items-center gap-2 border-t px-3 py-2">
|
||||
<Button size="sm" className="h-8 flex-1" onClick={() => onSelect(preset.id)}>
|
||||
{selected ? "已选中" : "使用"}
|
||||
</Button>
|
||||
{preset.visibility === "private" && onEdit ? (
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
className="h-8"
|
||||
onClick={() => onEdit(preset)}
|
||||
>
|
||||
<Pencil className="mr-1 h-3.5 w-3.5" />
|
||||
编辑
|
||||
</Button>
|
||||
) : null}
|
||||
{preset.visibility === "private" && onDelete ? (
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
className="h-8 text-destructive hover:text-destructive"
|
||||
onClick={() => onDelete(preset)}
|
||||
>
|
||||
<Trash2 className="mr-1 h-3.5 w-3.5" />
|
||||
删除
|
||||
</Button>
|
||||
) : null}
|
||||
{preset.visibility === "public" && onFork ? (
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
className="h-8"
|
||||
onClick={() => onFork(preset)}
|
||||
>
|
||||
<Copy className="mr-1 h-3.5 w-3.5" />
|
||||
另存
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@ -371,12 +371,12 @@ export function AgentPresetDialog({
|
||||
<div className="space-y-4">
|
||||
<div className="grid grid-cols-1 gap-3 md:grid-cols-2">
|
||||
<div className="space-y-2">
|
||||
<div className="text-sm font-medium">头像</div>
|
||||
<div className="text-sm font-medium">预览图</div>
|
||||
<div className="flex items-center gap-3">
|
||||
{avatarUrl ? (
|
||||
<img
|
||||
src={avatarUrl}
|
||||
alt="智能体头像"
|
||||
alt="智能体预览图"
|
||||
className="h-14 w-14 rounded-2xl border object-cover"
|
||||
/>
|
||||
) : (
|
||||
@ -406,7 +406,7 @@ export function AgentPresetDialog({
|
||||
) : (
|
||||
<Upload className="mr-1 h-4 w-4" />
|
||||
)}
|
||||
上传头像
|
||||
上传预览图
|
||||
</Button>
|
||||
</label>
|
||||
</div>
|
||||
@ -466,6 +466,9 @@ export function AgentPresetDialog({
|
||||
<SelectItem value={NEW_CATEGORY_VALUE}>新建分类</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<div className="text-xs text-muted-foreground">
|
||||
如需创建分类,请先选择“新建分类”,再在下方填写分类名称。
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<div className="text-sm font-medium">对应模型</div>
|
||||
@ -621,7 +624,11 @@ export function AgentPresetDialog({
|
||||
<Button variant="outline" onClick={() => onOpenChange(false)}>
|
||||
取消
|
||||
</Button>
|
||||
<Button onClick={handleCreate} disabled={isSubmitting}>
|
||||
<Button
|
||||
onClick={handleCreate}
|
||||
disabled={isSubmitting}
|
||||
className="bg-black text-white hover:bg-black/90 dark:bg-white dark:text-black dark:hover:bg-white/90"
|
||||
>
|
||||
{isSubmitting ? <Loader2 className="mr-2 h-4 w-4 animate-spin" /> : null}
|
||||
{initialPreset ? "保存修改" : "创建智能体"}
|
||||
</Button>
|
||||
|
||||
@ -139,7 +139,7 @@ export function AgentPresetPanel({
|
||||
<Loader2 className="h-5 w-5 animate-spin text-muted-foreground" />
|
||||
</div>
|
||||
) : filteredPublicPresets.length > 0 ? (
|
||||
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
|
||||
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3">
|
||||
{filteredPublicPresets.map((preset) => (
|
||||
<AgentPresetCard
|
||||
key={preset.id}
|
||||
@ -162,7 +162,7 @@ export function AgentPresetPanel({
|
||||
<section className="space-y-3">
|
||||
<div className="text-sm font-medium">我的智能体</div>
|
||||
{isLoading ? null : filteredPrivatePresets.length > 0 ? (
|
||||
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
|
||||
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3">
|
||||
{filteredPrivatePresets.map((preset) => (
|
||||
<AgentPresetCard
|
||||
key={preset.id}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user