fix: 调整提示词和 agent 管理入口

This commit is contained in:
Administrator committed 2026-06-04 18:45:16 +08:00
1 parent c1336ad5b3
commit 1e4ef070cf
4 files changed
+42 -50

No files matched your search

@@ -136,21 +136,21 @@ export function AgentManageDialog({
{agents.map((agent, index) => ( {agents.map((agent, index) => (
<div <div
key={agent.id} key={agent.id}
className="flex items-center gap-2 px-3 py-2 hover:bg-accent/30" className="flex min-w-0 items-start gap-2 px-3 py-2 hover:bg-accent/30"
> >
<span className="text-muted-foreground w-6 shrink-0 text-center text-xs tabular-nums"> <span className="text-muted-foreground w-6 shrink-0 text-center text-xs tabular-nums">
{index + 1} {index + 1}
</span> </span>
<BotIcon className="text-muted-foreground size-4 shrink-0" /> <BotIcon className="text-muted-foreground mt-0.5 size-4 shrink-0" />
<div className="flex min-w-0 flex-1 flex-col"> <div className="flex min-w-0 flex-1 flex-col">
<span className="truncate text-sm">{agent.name}</span> <span className="truncate text-sm">{agent.name}</span>
{agent.description && ( {agent.description && (
<span className="truncate text-[11px] text-muted-foreground"> <span className="line-clamp-2 whitespace-normal break-words text-[11px] leading-snug text-muted-foreground">
{agent.description} {agent.description}
</span> </span>
)} )}
</div> </div>
<div className="flex items-center gap-0.5"> <div className="flex shrink-0 items-center gap-0.5">
<Tooltip content="上移"> <Tooltip content="上移">
<Button <Button
size="icon" size="icon"
@@ -222,13 +222,13 @@ export function AgentManageDialog({
key={agent.id} key={agent.id}
value={`${agent.name} ${agent.description ?? ""}`} value={`${agent.name} ${agent.description ?? ""}`}
onSelect={() => void add(agent)} onSelect={() => void add(agent)}
className="flex min-w-0 items-center overflow-hidden" className="flex w-full min-w-0 items-start overflow-hidden"
> >
<BotIcon className="text-muted-foreground mr-2 size-4 shrink-0" /> <BotIcon className="text-muted-foreground mr-2 mt-0.5 size-4 shrink-0" />
<div className="flex min-w-0 flex-1 flex-col"> <div className="flex min-w-0 flex-1 flex-col">
<span className="truncate text-sm">{agent.name}</span> <span className="truncate text-sm">{agent.name}</span>
{agent.description && ( {agent.description && (
<span className="truncate text-[10px] text-muted-foreground"> <span className="line-clamp-2 whitespace-normal break-words text-[10px] leading-snug text-muted-foreground">
{agent.description} {agent.description}
</span> </span>
)} )}
@@ -120,15 +120,15 @@ export function AgentSelector({
value={`${agent.name} ${agent.description ?? ""}`} value={`${agent.name} ${agent.description ?? ""}`}
onSelect={() => handleSelect(agent)} onSelect={() => handleSelect(agent)}
className={cn( className={cn(
"flex min-w-0 items-center gap-2 overflow-hidden", "flex w-full min-w-0 items-start gap-2 overflow-hidden",
agent.id === selectedAgentId && "bg-accent", agent.id === selectedAgentId && "bg-accent",
)} )}
> >
<BotIcon className="text-muted-foreground size-4 shrink-0" /> <BotIcon className="text-muted-foreground mt-0.5 size-4 shrink-0" />
<div className="flex min-w-0 flex-1 flex-col"> <div className="flex min-w-0 flex-1 flex-col">
<span className="truncate text-sm">{agent.name}</span> <span className="truncate text-sm">{agent.name}</span>
{agent.description && ( {agent.description && (
<span className="truncate text-[10px] text-muted-foreground"> <span className="line-clamp-2 whitespace-normal break-words text-[10px] leading-snug text-muted-foreground">
{agent.description} {agent.description}
</span> </span>
)} )}
@@ -86,7 +86,8 @@ import {
DropdownMenuTrigger, DropdownMenuTrigger,
} from "../ui/dropdown-menu"; } from "../ui/dropdown-menu";
import { useRecommendedQuestions } from "@/core/recommended-questions/hooks"; import { useRecommendedQuestions } from "@/core/recommended-questions/hooks";
import { useUserPreferences } from "@/core/user-preferences";
import { import {
isThreadRagModeLocked, isThreadRagModeLocked,
lockThreadRagMode, lockThreadRagMode,
@@ -204,7 +205,11 @@ export function InputBox({
null, null,
); );
const { questions: recommendedQuestions } = useRecommendedQuestions(); const { questions: recommendedQuestions } = useRecommendedQuestions();
const userPreferences = useUserPreferences();
const showAdminRecommendedQuestions =
!userPreferences.hide_admin_prompt_prefix &&
recommendedQuestions.length > 0;
useEffect(() => { useEffect(() => {
if (models.length === 0) { if (models.length === 0) {
@@ -511,7 +516,7 @@ export function InputBox({
</div> </div>
)} )}
{isNewThread && searchParams.get("mode") !== "skill" && recommendedQuestions.length > 0 && ( {isNewThread && searchParams.get("mode") !== "skill" && showAdminRecommendedQuestions && (
<div className="flex flex-wrap justify-center gap-2.5 px-4 mb-[10px]"> <div className="flex flex-wrap justify-center gap-2.5 px-4 mb-[10px]">
{recommendedQuestions.map((q) => ( {recommendedQuestions.map((q) => (
<button <button
@@ -1,6 +1,6 @@
"use client"; "use client";
import { import {
AlertCircle, AlertCircle,
ArchiveIcon, ArchiveIcon,
ArrowDownUpIcon, ArrowDownUpIcon,
@@ -22,9 +22,9 @@ import {
Trash2Icon, Trash2Icon,
TrendingUpIcon, TrendingUpIcon,
Upload, Upload,
} from "lucide-react"; } from "lucide-react";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { toast } from "sonner"; import { toast } from "sonner";
import { Badge } from "@/components/ui/badge"; import { Badge } from "@/components/ui/badge";
@@ -45,9 +45,8 @@ import {
DialogTitle, DialogTitle,
} from "@/components/ui/dialog"; } from "@/components/ui/dialog";
import { import {
Empty, Empty,
EmptyContent, EmptyDescription,
EmptyDescription,
EmptyHeader, EmptyHeader,
EmptyMedia, EmptyMedia,
EmptyTitle, EmptyTitle,
@@ -145,11 +144,11 @@ const rescanErrorToastDarkOptions = {
icon: <AlertCircle className="size-4 shrink-0 text-[#F5222D]" />, icon: <AlertCircle className="size-4 shrink-0 text-[#F5222D]" />,
} as const; } as const;
function SkillSettingsList({ onClose }: { onClose?: () => void }) { function SkillSettingsList({ onClose }: { onClose?: () => void }) {
const { t } = useI18n(); const { t } = useI18n();
const { theme } = useTheme(); const { theme } = useTheme();
const router = useRouter(); const router = useRouter();
const [filter, setFilter] = useState<string>("mine"); const [filter, setFilter] = useState<string>("mine");
const [installOpen, setInstallOpen] = useState(false); const [installOpen, setInstallOpen] = useState(false);
const [staleSheetOpen, setStaleSheetOpen] = useState(false); const [staleSheetOpen, setStaleSheetOpen] = useState(false);
const [archiveSheetOpen, setArchiveSheetOpen] = useState(false); const [archiveSheetOpen, setArchiveSheetOpen] = useState(false);
@@ -222,12 +221,7 @@ function SkillSettingsList({ onClose }: { onClose?: () => void }) {
[filteredSkills, page], [filteredSkills, page],
); );
const handleCreateSkill = () => { const handleRescan = async () => {
onClose?.();
router.push("/?mode=skill");
};
const handleRescan = async () => {
try { try {
const result = await reconcileMutation.mutateAsync(); const result = await reconcileMutation.mutateAsync();
if (result.adopted.length > 0) { if (result.adopted.length > 0) {
@@ -326,12 +320,8 @@ function SkillSettingsList({ onClose }: { onClose?: () => void }) {
<Upload className="size-4" /> <Upload className="size-4" />
{t.settings.skills.installSkill} {t.settings.skills.installSkill}
</Button> </Button>
<Button size="sm" onClick={handleCreateSkill}> </div>
<SparklesIcon className="size-4" /> </header>
{t.settings.skills.createSkill}
</Button>
</div>
</header>
<TagSearchBar <TagSearchBar
targetType="skill" targetType="skill"
onSearchChange={setSearch} onSearchChange={setSearch}
@@ -363,9 +353,9 @@ function SkillSettingsList({ onClose }: { onClose?: () => void }) {
<div className="text-muted-foreground text-sm">{t.common.loading}</div> <div className="text-muted-foreground text-sm">{t.common.loading}</div>
)} )}
{error && <div className="text-destructive text-sm">Error: {error.message}</div>} {error && <div className="text-destructive text-sm">Error: {error.message}</div>}
{!isLoading && !error && filteredSkills.length === 0 && ( {!isLoading && !error && filteredSkills.length === 0 && (
<EmptySkill onCreateSkill={handleCreateSkill} /> <EmptySkill />
)} )}
{/* —— 原纵向列表布局(保留备查)—— {/* —— 原纵向列表布局(保留备查)——
{!isLoading && !error && {!isLoading && !error &&
@@ -986,10 +976,10 @@ export function SkillRow({
); );
} }
function EmptySkill({ onCreateSkill }: { onCreateSkill: () => void }) { function EmptySkill() {
const { t } = useI18n(); const { t } = useI18n();
return ( return (
<Empty> <Empty>
<EmptyHeader> <EmptyHeader>
<EmptyMedia variant="icon"> <EmptyMedia variant="icon">
<SparklesIcon /> <SparklesIcon />
@@ -999,12 +989,9 @@ function EmptySkill({ onCreateSkill }: { onCreateSkill: () => void }) {
{t.settings.skills.emptyDescription} {t.settings.skills.emptyDescription}
</EmptyDescription> </EmptyDescription>
</EmptyHeader> </EmptyHeader>
<EmptyContent> </Empty>
<Button onClick={onCreateSkill}>{t.settings.skills.emptyButton}</Button> );
</EmptyContent> }
</Empty>
);
}
function InstallSkillDialog({ function InstallSkillDialog({
open, open,