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
+18 -26

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>
)} )}
@@ -87,6 +87,7 @@ import {
} 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,
@@ -205,6 +206,10 @@ export function InputBox({
); );
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
@@ -46,7 +46,6 @@ import {
} from "@/components/ui/dialog"; } from "@/components/ui/dialog";
import { import {
Empty, Empty,
EmptyContent,
EmptyDescription, EmptyDescription,
EmptyHeader, EmptyHeader,
EmptyMedia, EmptyMedia,
@@ -222,11 +221,6 @@ function SkillSettingsList({ onClose }: { onClose?: () => void }) {
[filteredSkills, page], [filteredSkills, page],
); );
const handleCreateSkill = () => {
onClose?.();
router.push("/?mode=skill");
};
const handleRescan = async () => { const handleRescan = async () => {
try { try {
const result = await reconcileMutation.mutateAsync(); const result = await reconcileMutation.mutateAsync();
@@ -326,10 +320,6 @@ 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}>
<SparklesIcon className="size-4" />
{t.settings.skills.createSkill}
</Button>
</div> </div>
</header> </header>
<TagSearchBar <TagSearchBar
@@ -364,7 +354,7 @@ function SkillSettingsList({ onClose }: { onClose?: () => void }) {
)} )}
{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 />
)} )}
{/* —— 原纵向列表布局(保留备查)—— {/* —— 原纵向列表布局(保留备查)——
@@ -986,7 +976,7 @@ export function SkillRow({
); );
} }
function EmptySkill({ onCreateSkill }: { onCreateSkill: () => void }) { function EmptySkill() {
const { t } = useI18n(); const { t } = useI18n();
return ( return (
<Empty> <Empty>
@@ -999,9 +989,6 @@ function EmptySkill({ onCreateSkill }: { onCreateSkill: () => void }) {
{t.settings.skills.emptyDescription} {t.settings.skills.emptyDescription}
</EmptyDescription> </EmptyDescription>
</EmptyHeader> </EmptyHeader>
<EmptyContent>
<Button onClick={onCreateSkill}>{t.settings.skills.emptyButton}</Button>
</EmptyContent>
</Empty> </Empty>
); );
} }