This commit is contained in:
xuhd committed 2026-05-14 20:45:02 +08:00
commit 9a67ca7c03
97 files changed
+20759 -306

No files matched your search

+86 -76
View File
@@ -1,5 +1,6 @@
import { useState } from "react";
import type { ElementType } from "react";
import { useNavigate, useLocation } from "react-router-dom";
import {
BarChart3,
Bot,
@@ -38,6 +39,7 @@ type MenuItem = {
id: string;
label: string;
icon: ElementType;
path?: string;
children?: MenuItem[];
};
@@ -49,173 +51,173 @@ type PageSidebarProps = {
const menuItems: MenuItem[] = [
{
id: "qa-center",
label: "QA Center",
label: "问答中心",
icon: HelpCircle,
children: [
{ id: "new-qa", label: "New QA", icon: Plus },
{ id: "general-qa", label: "General QA", icon: CircleHelp },
{ id: "agent-qa", label: "Agent QA", icon: Bot },
{ id: "multi-agent-qa", label: "Multi Agent", icon: Layers },
{ id: "sixstep-chat", label: "Six Step Chat", icon: Workflow },
{ id: "qa-records", label: "QA Records", icon: History },
{ id: "template-editor", label: "Template Config", icon: Settings },
{ id: "new-qa", label: "新建问答", icon: Plus },
{ id: "general-qa", label: "通用问答", icon: CircleHelp, path: "/page/strategy/qa/general" },
{ id: "agent-qa", label: "智能体问答", icon: Bot },
{ id: "multi-agent-qa", label: "多智能体", icon: Layers },
{ id: "sixstep-chat", label: "六步对话", icon: Workflow },
{ id: "qa-records", label: "问答记录", icon: History },
{ id: "template-editor", label: "模板配置", icon: Settings },
],
},
{
id: "light-app-center",
label: "Light Apps",
label: "轻应用",
icon: Grid3X3,
children: [
{ id: "light-app-square", label: "App Square", icon: Layout },
{ id: "light-app-records", label: "Run Records", icon: History },
{ id: "light-app-square", label: "应用广场", icon: Layout },
{ id: "light-app-records", label: "运行记录", icon: History },
],
},
{
id: "task-management",
label: "Task Management",
label: "任务管理",
icon: Target,
children: [
{ id: "dashboard", label: "Dashboard", icon: BarChart3 },
{ id: "dashboard", label: "数据看板", icon: BarChart3 },
{
id: "xk-task",
label: "XK Tasks",
label: "XK任务",
icon: Folder,
children: [
{ id: "xk-task-jc", label: "Task JC", icon: ListTodo },
{ id: "xk-task-dispatch", label: "Task Dispatch", icon: ListTodo },
{ id: "xk-task-jc", label: "任务JC", icon: ListTodo },
{ id: "xk-task-dispatch", label: "任务调度", icon: ListTodo },
],
},
{
id: "plan-task",
label: "Planning Tasks",
label: "规划任务",
icon: Folder,
children: [
{ id: "plan-task-fx", label: "Task Analysis", icon: ListTodo },
{ id: "plan-task-action", label: "Action Strategy", icon: ListTodo },
{ id: "plan-task-fx", label: "任务分析", icon: ListTodo },
{ id: "plan-task-action", label: "行动策略", icon: ListTodo },
],
},
{
id: "mnty-task",
label: "MNTY Tasks",
label: "MNTY任务",
icon: Folder,
children: [
{ id: "mnty-task-mechanism", label: "Mechanism Study", icon: ListTodo },
{ id: "mnty-task-plan", label: "Plan Task", icon: ListTodo },
{ id: "mnty-task-zsty", label: "ZSTY Task", icon: ListTodo },
{ id: "mnty-task-mechanism", label: "机制研究", icon: ListTodo },
{ id: "mnty-task-plan", label: "规划任务", icon: ListTodo },
{ id: "mnty-task-zsty", label: "ZSTY任务", icon: ListTodo },
],
},
{
id: "effect-task",
label: "Effect PG Tasks",
label: "效果PG任务",
icon: Folder,
children: [
{ id: "effect-task-pg", label: "Task PG", icon: ListTodo },
{ id: "effect-action-pg", label: "Action PG", icon: ListTodo },
{ id: "effect-info-pg", label: "Info PG", icon: ListTodo },
{ id: "effect-account-pg", label: "Account PG", icon: ListTodo },
{ id: "effect-task-pg", label: "任务PG", icon: ListTodo },
{ id: "effect-action-pg", label: "行动PG", icon: ListTodo },
{ id: "effect-info-pg", label: "信息PG", icon: ListTodo },
{ id: "effect-account-pg", label: "账号PG", icon: ListTodo },
],
},
{ id: "task-create", label: "Create Task", icon: Plus },
{ id: "task-single", label: "Single Agent Task", icon: Bot },
{ id: "task-scene", label: "Scene Task", icon: Workflow },
{ id: "task-consult-create", label: "Multi Agent Consult", icon: MessageSquare },
{ id: "final-plan", label: "Final Output", icon: FileOutput },
{ id: "task-create", label: "创建任务", icon: Plus },
{ id: "task-single", label: "单智能体任务", icon: Bot },
{ id: "task-scene", label: "场景任务", icon: Workflow },
{ id: "task-consult-create", label: "多智能体协商", icon: MessageSquare },
{ id: "final-plan", label: "最终输出", icon: FileOutput },
],
},
{ id: "scene-list", label: "Scene Management", icon: Layers },
{ id: "scene-list", label: "场景管理", icon: Layers },
{
id: "agent-list",
label: "Agent Management",
label: "智能体管理",
icon: Bot,
children: [
{ id: "agent-overview", label: "Agent List", icon: Users },
{ id: "agent-trial", label: "Single Agent Trial", icon: PlayCircle },
{ id: "agent-overview", label: "智能体列表", icon: Users, path: "/page/strategy/agents" },
{ id: "agent-trial", label: "单智能体试用", icon: PlayCircle },
],
},
{
id: "result-management",
label: "Result Management",
label: "结果管理",
icon: BarChart3,
children: [
{
id: "result-planning",
label: "Planning Results",
label: "规划结果",
icon: Target,
children: [
{ id: "result-planning-all", label: "All", icon: BarChart3 },
{ id: "result-planning-goal", label: "Goal Analysis", icon: Target },
{ id: "result-planning-brand", label: "Brand Strategy", icon: Target },
{ id: "result-planning-content", label: "Content Planning", icon: Target },
{ id: "result-planning-channel", label: "Channel Planning", icon: Target },
{ id: "result-planning-narrative", label: "Narrative Strategy", icon: Target },
{ id: "result-planning-all", label: "全部", icon: BarChart3 },
{ id: "result-planning-goal", label: "目标分析", icon: Target },
{ id: "result-planning-brand", label: "品牌策略", icon: Target },
{ id: "result-planning-content", label: "内容规划", icon: Target },
{ id: "result-planning-channel", label: "渠道规划", icon: Target },
{ id: "result-planning-narrative", label: "叙事策略", icon: Target },
],
},
{
id: "result-mnty",
label: "MNTY Results",
label: "MNTY结果",
icon: Brain,
children: [
{ id: "result-mnty-all", label: "All", icon: BarChart3 },
{ id: "result-mnty-mechanism", label: "Mechanism Research", icon: Brain },
{ id: "result-mnty-plan", label: "Plan Design", icon: Brain },
{ id: "result-mnty-zsty", label: "ZSTY Analysis", icon: Brain },
{ id: "result-mnty-all", label: "全部", icon: BarChart3 },
{ id: "result-mnty-mechanism", label: "机制研究", icon: Brain },
{ id: "result-mnty-plan", label: "规划设计", icon: Brain },
{ id: "result-mnty-zsty", label: "ZSTY分析", icon: Brain },
],
},
{
id: "result-effect-pg",
label: "Effect PG Results",
label: "效果PG结果",
icon: TrendingUp,
children: [
{ id: "result-effect-pg-all", label: "All", icon: BarChart3 },
{ id: "result-effect-pg-behavior", label: "Behavior PG", icon: TrendingUp },
{ id: "result-effect-pg-evaluation", label: "Effect Review", icon: TrendingUp },
{ id: "result-effect-pg-info", label: "Info PG", icon: TrendingUp },
{ id: "result-effect-pg-account", label: "Account PG", icon: TrendingUp },
{ id: "result-effect-pg-all", label: "全部", icon: BarChart3 },
{ id: "result-effect-pg-behavior", label: "行为PG", icon: TrendingUp },
{ id: "result-effect-pg-evaluation", label: "效果复盘", icon: TrendingUp },
{ id: "result-effect-pg-info", label: "信息PG", icon: TrendingUp },
{ id: "result-effect-pg-account", label: "账号PG", icon: TrendingUp },
],
},
{
id: "result-xk",
label: "XK Results",
label: "XK结果",
icon: Compass,
children: [
{ id: "result-xk-all", label: "All", icon: BarChart3 },
{ id: "result-xk-jc", label: "Task JC", icon: Compass },
{ id: "result-xk-dispatch", label: "Task Dispatch", icon: Compass },
{ id: "result-xk-all", label: "全部", icon: BarChart3 },
{ id: "result-xk-jc", label: "任务JC", icon: Compass },
{ id: "result-xk-dispatch", label: "任务调度", icon: Compass },
],
},
{
id: "result-dq",
label: "DQ Results",
label: "DQ结果",
icon: Database,
children: [
{ id: "result-dq-all", label: "All", icon: BarChart3 },
{ id: "result-dq-audience", label: "Audience Analysis", icon: Database },
{ id: "result-dq-kb", label: "Knowledge Research", icon: Database },
{ id: "result-dq-trend", label: "Trend Research", icon: Database },
{ id: "result-dq-all", label: "全部", icon: BarChart3 },
{ id: "result-dq-audience", label: "受众分析", icon: Database },
{ id: "result-dq-kb", label: "知识研究", icon: Database },
{ id: "result-dq-trend", label: "趋势研究", icon: Database },
],
},
{
id: "result-other",
label: "Other Results",
label: "其他结果",
icon: MoreHorizontal,
children: [
{ id: "result-other-all", label: "All", icon: BarChart3 },
{ id: "result-other-general", label: "General Analysis", icon: MoreHorizontal },
{ id: "result-other-temp", label: "Temp Tasks", icon: MoreHorizontal },
{ id: "result-other-other", label: "Other", icon: MoreHorizontal },
{ id: "result-other-all", label: "全部", icon: BarChart3 },
{ id: "result-other-general", label: "通用分析", icon: MoreHorizontal },
{ id: "result-other-temp", label: "临时任务", icon: MoreHorizontal },
{ id: "result-other-other", label: "其他", icon: MoreHorizontal },
],
},
],
},
{
id: "resource-management",
label: "Resource Management",
label: "资源管理",
icon: Database,
children: [
{ id: "resource-zz", label: "ZZ Resources", icon: FileBox },
{ id: "resource-network-actor", label: "Network Actor", icon: Network },
{ id: "resource-knowledge-base", label: "Knowledge Base", icon: Library },
{ id: "resource-evaluation-index", label: "Evaluation Index", icon: Scale },
{ id: "resource-zz", label: "ZZ资源", icon: FileBox },
{ id: "resource-network-actor", label: "网络达人", icon: Network },
{ id: "resource-knowledge-base", label: "知识库", icon: Library },
{ id: "resource-evaluation-index", label: "评估指标", icon: Scale },
],
},
];
@@ -233,6 +235,8 @@ export function PageSidebar({
onToggleCollapsed,
}: PageSidebarProps) {
const [expandedIds, setExpandedIds] = useState<Set<string>>(defaultExpandedIds);
const navigate = useNavigate();
const { pathname } = useLocation();
const iconButtonClass =
"rounded-lg p-2 text-gray-500 transition-all duration-300 ease-out hover:scale-105 hover:bg-red-50 hover:text-red-600";
@@ -256,14 +260,20 @@ export function PageSidebar({
const renderLeaf = (item: MenuItem, depth = 0) => {
const Icon = item.icon;
const isActive = !!item.path && pathname === item.path;
return (
<button
key={item.id}
type="button"
title={collapsed && depth === 0 ? item.label : undefined}
className={`flex w-full items-center rounded-lg py-2 text-left text-gray-600 transition-all duration-300 ease-out hover:-translate-y-0.5 hover:bg-red-50 hover:text-red-600 ${
onClick={() => item.path && navigate(item.path)}
className={`flex w-full items-center rounded-lg py-2 text-left transition-all duration-300 ease-out hover:-translate-y-0.5 ${
collapsed && depth === 0 ? "justify-center px-2" : "gap-2 px-3"
} ${
isActive
? "bg-red-50 text-red-600 font-semibold"
: "text-gray-600 hover:bg-red-50 hover:text-red-600"
}`}
>
<Icon className={`${depth === 0 ? "h-5 w-5" : "h-4 w-4"} flex-shrink-0 transition-transform duration-300 ease-out`} />
+8 -3
View File
@@ -53,6 +53,10 @@ function useSidebar() {
return context;
}
function useSidebarSafe() {
return React.useContext(SidebarContext);
}
function SidebarProvider({
defaultOpen = true,
open: openProp,
@@ -139,7 +143,7 @@ function SidebarProvider({
} as React.CSSProperties
}
className={cn(
"group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",
"group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex h-full w-full",
className,
)}
{...props}
@@ -229,7 +233,7 @@ function Sidebar({
<div
data-slot="sidebar-container"
className={cn(
"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",
"fixed bottom-0 z-10 hidden w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex [top:var(--header-height,4rem)]",
side === "left"
? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]"
: "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
@@ -309,7 +313,7 @@ function SidebarInset({ className, ...props }: React.ComponentProps<"main">) {
<main
data-slot="sidebar-inset"
className={cn(
"bg-[#fffdfa] relative flex w-full flex-1 flex-col",
"bg-background relative flex w-full flex-1 flex-col",
"md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",
className,
)}
@@ -723,4 +727,5 @@ export {
SidebarSeparator,
SidebarTrigger,
useSidebar,
useSidebarSafe,
};
@@ -6,7 +6,7 @@ import {
type ReactNode,
} from "react";
import { useSidebar } from "@/components/ui/sidebar";
import { useSidebarSafe } from "@/components/ui/sidebar";
import { env } from "@/env";
export interface ArtifactsContextType {
@@ -39,19 +39,19 @@ export function ArtifactsProvider({ children }: ArtifactsProviderProps) {
env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY === "true",
);
const [autoOpen, setAutoOpen] = useState(true);
const { setOpen: setSidebarOpen } = useSidebar();
const sidebar = useSidebarSafe();
const select = useCallback(
(artifact: string, autoSelect = false) => {
setSelectedArtifact(artifact);
if (env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY !== "true") {
setSidebarOpen(false);
sidebar?.setOpen(false);
}
if (!autoSelect) {
setAutoSelect(false);
}
},
[setSidebarOpen, setSelectedArtifact, setAutoSelect],
[sidebar, setSelectedArtifact, setAutoSelect],
);
const deselect = useCallback(() => {
@@ -80,12 +80,16 @@ import {
DropdownMenuTrigger,
} from "../ui/dropdown-menu";
import { useRecommendedQuestions } from "@/core/recommended-questions/hooks";
import { useThread } from "./messages/context";
import { ModeHoverGuide } from "./mode-hover-guide";
import { Tooltip } from "./tooltip";
type InputMode = "flash" | "thinking" | "pro" | "ultra";
function getResolvedMode(
mode: InputMode | undefined,
supportsThinking: boolean,
@@ -161,6 +165,8 @@ export function InputBox({
null,
);
const { questions: recommendedQuestions } = useRecommendedQuestions();
useEffect(() => {
if (models.length === 0) {
return;
@@ -430,7 +436,32 @@ export function InputBox({
}, [context.model_name, disabled, isMock, status, thread.messages, threadId]);
return (
<div ref={promptRootRef} className="relative flex flex-col gap-4">
<div ref={promptRootRef} className="relative flex flex-col gap-6">
{extraHeader && (
<div className="flex items-center justify-center">
{extraHeader}
</div>
)}
{isNewThread && searchParams.get("mode") !== "skill" && recommendedQuestions.length > 0 && (
<div className="flex flex-wrap justify-center gap-2.5 px-4 mb-[10px]">
{recommendedQuestions.map((q) => (
<button
key={q.id}
type="button"
className="rounded-full border border-[#e4e4e7] bg-white px-4 py-2 text-sm text-[#18181b] shadow-none transition-colors hover:bg-[#f4f4f5] cursor-pointer dark:border-slate-600 dark:bg-slate-700/50 dark:text-slate-300 dark:hover:bg-slate-700"
onClick={() => {
textInput.setInput(q.content);
setFollowupsHidden(true);
setTimeout(() => requestFormSubmit(), 0);
}}
>
{q.title}
</button>
))}
</div>
)}
{showFollowups && (
<div className="flex items-center justify-center pb-2">
<div className="flex items-center gap-2">
@@ -464,7 +495,7 @@ export function InputBox({
)}
<PromptInput
className={cn(
"rounded-[1.85rem] border border-[#eadfce] bg-white shadow-[0_24px_70px_-34px_rgba(120,83,42,0.32)] ring-1 ring-[#f6efe5] transition-all duration-300 ease-out *:data-[slot='input-group']:rounded-[1.85rem]",
"rounded-[1.85rem] border border-[#eadfce] bg-white shadow-[0_24px_70px_-34px_rgba(120,83,42,0.32)] ring-1 ring-[#f6efe5] transition-all duration-300 ease-out *:data-[slot='input-group']:rounded-[1.85rem] dark:bg-slate-800 dark:border-slate-700 dark:ring-slate-700 dark:shadow-none",
className,
)}
disabled={disabled}
@@ -473,20 +504,13 @@ export function InputBox({
onSubmit={handleSubmit}
{...props}
>
{extraHeader && (
<div className="absolute top-0 right-0 left-0 z-10">
<div className="absolute right-0 bottom-0 left-0 flex items-center justify-center">
{extraHeader}
</div>
</div>
)}
<PromptInputAttachments>
{(attachment) => <PromptInputAttachment data={attachment} />}
</PromptInputAttachments>
<PromptInputBody className="absolute top-0 right-0 left-0 z-3">
<PromptInputTextarea
className={cn(
"size-full px-2 py-1 text-[15px] leading-7 placeholder:text-[#b7ab9a]",
"size-full px-2 py-1 text-[15px] leading-7 placeholder:text-[#b7ab9a] dark:placeholder:text-slate-500",
)}
disabled={disabled}
placeholder={t.inputBox.placeholder}
@@ -494,7 +518,7 @@ export function InputBox({
defaultValue={initialValue}
/>
</PromptInputBody>
<PromptInputFooter className="flex items-center border-t border-[#f4ede4] px-2 pt-2.5 pb-1.5">
<PromptInputFooter className="flex items-center border-t border-[#f4ede4] dark:border-slate-700 px-2 pt-2.5 pb-1.5">
<PromptInputTools className="gap-1.5">
{/* TODO: Add more connectors here
<PromptInputActionMenu>
@@ -505,7 +529,7 @@ export function InputBox({
/>
</PromptInputActionMenuContent>
</PromptInputActionMenu> */}
<AddAttachmentsButton className="rounded-full border border-[#eee3d5] bg-[#fffaf5] px-2.5! shadow-none hover:bg-white" />
<AddAttachmentsButton className="rounded-full border border-[#eee3d5] bg-[#fffaf5] px-2.5! shadow-none hover:bg-white dark:border-slate-600 dark:bg-slate-700/50 dark:text-slate-300 dark:hover:bg-slate-700" />
<PromptInputActionMenu>
<ModeHoverGuide
mode={
@@ -517,7 +541,7 @@ export function InputBox({
: "flash"
}
>
<PromptInputActionMenuTrigger className="gap-1.5! rounded-full border border-[#eee3d5] bg-[#fffaf5] px-3! text-[#7e6a57] shadow-none hover:bg-white">
<PromptInputActionMenuTrigger className="gap-1.5! rounded-full border border-[#eee3d5] bg-[#fffaf5] px-3! text-[#7e6a57] shadow-none hover:bg-white dark:border-slate-600 dark:bg-slate-700/50 dark:text-slate-300 dark:hover:bg-slate-700">
<div>
{context.mode === "flash" && <ZapIcon className="size-3" />}
{context.mode === "thinking" && (
@@ -679,7 +703,7 @@ export function InputBox({
</PromptInputActionMenu>
{supportReasoningEffort && context.mode !== "flash" && (
<PromptInputActionMenu>
<PromptInputActionMenuTrigger className="gap-1.5! rounded-full border border-[#eee3d5] bg-[#fffaf5] px-3! text-[#7e6a57] shadow-none hover:bg-white">
<PromptInputActionMenuTrigger className="gap-1.5! rounded-full border border-[#eee3d5] bg-[#fffaf5] px-3! text-[#7e6a57] shadow-none hover:bg-white dark:border-slate-600 dark:bg-slate-700/50 dark:text-slate-300 dark:hover:bg-slate-700">
<div className="text-xs font-normal">
{t.inputBox.reasoningEffort}:
{context.reasoning_effort === "minimal" &&
@@ -800,7 +824,7 @@ export function InputBox({
onOpenChange={setModelDialogOpen}
>
<ModelSelectorTrigger asChild>
<PromptInputButton className="rounded-full border border-[#eee3d5] bg-[#fffaf5] px-3 shadow-none hover:bg-white">
<PromptInputButton className="rounded-full border border-[#eee3d5] bg-[#fffaf5] px-3 shadow-none hover:bg-white dark:border-slate-600 dark:bg-slate-700/50 dark:text-slate-300 dark:hover:bg-slate-700">
<div className="flex min-w-0 flex-col items-start text-left">
<ModelSelectorName className="text-xs font-normal">
{selectedModel?.display_name}
@@ -834,7 +858,7 @@ export function InputBox({
</ModelSelectorContent>
</ModelSelector>
<PromptInputSubmit
className="rounded-full border-[#e7d9c7] bg-white shadow-[0_10px_24px_-18px_rgba(120,83,42,0.34)]"
className="rounded-full border-[#e7d9c7] bg-white shadow-[0_10px_24px_-18px_rgba(120,83,42,0.34)] dark:bg-blue-500 dark:border-blue-500 dark:text-white dark:hover:bg-blue-400 dark:shadow-none"
disabled={disabled}
variant="outline"
status={status}
@@ -842,16 +866,10 @@ export function InputBox({
</PromptInputTools>
</PromptInputFooter>
{!isNewThread && (
<div className="absolute right-0 -bottom-[17px] left-0 z-0 h-4 bg-[#fffdfa]"></div>
<div className="absolute right-0 -bottom-[17px] left-0 z-0 h-4 bg-[#fffdfa] dark:bg-background"></div>
)}
</PromptInput>
{isNewThread && searchParams.get("mode") !== "skill" && (
<div className="flex items-center justify-center pt-2">
<SuggestionList />
</div>
)}
<Dialog open={confirmOpen} onOpenChange={setConfirmOpen}>
<DialogContent>
<DialogHeader>
@@ -68,7 +68,7 @@ export function MessageList({
<Conversation
className={cn("flex size-full flex-col justify-center", className)}
>
<ConversationContent className="mx-auto w-full max-w-(--container-width-md) gap-8 pt-12">
<ConversationContent className="mx-auto w-full max-w-(--container-width-lg) gap-8 pt-12">
{groupMessages(messages, (group) => {
if (group.type === "human" || group.type === "assistant") {
return group.messages.map((msg) => {
@@ -454,6 +454,7 @@ function ClarificationCard({
const payload = getClarificationPayload(message);
const [customAnswer, setCustomAnswer] = useState("");
const [submitting, setSubmitting] = useState(false);
const [submitted, setSubmitted] = useState(false);
const options = useMemo(
() =>
@@ -473,16 +474,17 @@ function ClarificationCard({
);
}
const disabled = isLoading || submitting || !onSubmit;
const disabled = false;
async function submitAnswer(answer: string) {
const trimmed = answer.trim();
if (!trimmed || disabled) {
if (!trimmed) {
return;
}
setSubmitting(true);
try {
await onSubmit?.(trimmed);
setSubmitted(true);
} finally {
setSubmitting(false);
}
@@ -24,7 +24,7 @@ function SkeletonBar({
export function MessageListSkeleton() {
let index = 0;
return (
<div className="flex w-full max-w-(--container-width-md) flex-col gap-12 p-8 pt-16">
<div className="flex w-full max-w-(--container-width-lg) flex-col gap-12 p-8 pt-16">
<div
role="human-message"
className="flex w-[50%] flex-col items-end gap-2 self-end"
@@ -50,23 +50,23 @@ export function Welcome({
</div>
{searchParams.get("mode") === "skill" ? (
<div className="text-muted-foreground text-sm">
{t.welcome.createYourOwnSkillDescription.includes("\n") ? (
{/* {t.welcome.createYourOwnSkillDescription.includes("\n") ? (
<pre className="font-sans whitespace-pre">
{t.welcome.createYourOwnSkillDescription}
</pre>
) : (
<p>{t.welcome.createYourOwnSkillDescription}</p>
)}
)} */}
</div>
) : (
<div className="text-muted-foreground text-sm">
{t.welcome.description.includes("\n") ? (
{/* {t.welcome.description.includes("\n") ? (
<pre className="font-sans whitespace-pre">
{t.welcome.description}
</pre>
) : (
<p>{t.welcome.description}</p>
)}
)} */}
</div>
)}
</div>
@@ -1,6 +1,6 @@
"use client";
import { ChevronsUpDown, Settings2Icon, SettingsIcon } from "lucide-react";
import { ChevronsUpDown, MessageSquarePlusIcon, Settings2Icon, SettingsIcon } from "lucide-react";
import { useEffect, useState } from "react";
import {
@@ -17,9 +17,12 @@ import {
SidebarMenuItem,
useSidebar,
} from "@/components/ui/sidebar";
import { getStoredAuth } from "@/core/auth";
import { useI18n } from "@/core/i18n/hooks";
import { NotificationBell } from "./notification-bell";
import { useNavigate } from "react-router-dom";
import { SettingsDialog } from "./settings";
function NavMenuButtonContent({
@@ -43,9 +46,11 @@ function NavMenuButtonContent({
}
export function WorkspaceNavMenu() {
const navigate = useNavigate();
const isAdmin = getStoredAuth()?.system_role === "admin";
const [settingsOpen, setSettingsOpen] = useState(false);
const [settingsDefaultSection, setSettingsDefaultSection] = useState<
"appearance" | "memory" | "tools" | "skills" | "notification" | "about"
"appearance" | "memory" | "tools" | "notification" | "about"
>("appearance");
const [mounted, setMounted] = useState(false);
const { open: isSidebarOpen } = useSidebar();
@@ -92,6 +97,16 @@ export function WorkspaceNavMenu() {
<Settings2Icon />
{t.common.settings}
</DropdownMenuItem>
{isAdmin && (
<DropdownMenuItem
onClick={() =>
navigate("/page/workspace/settings/recommended-questions")
}
>
<MessageSquarePlusIcon />
推荐问题配置
</DropdownMenuItem>
)}
</DropdownMenuGroup>
<DropdownMenuSeparator />
</DropdownMenuContent>