feat(route): 前往对话页的按钮

This commit is contained in:
肖应宇 2026-04-11 21:42:04 +08:00
parent a6759e2e3a
commit d9c9c8f242
5 changed files with 46 additions and 24 deletions

View File

@ -527,37 +527,31 @@ export default function ChatPage() {
)} )}
> >
{!(showWelcomeStyle && thread.isThreadLoading) ? ( {!(showWelcomeStyle && thread.isThreadLoading) ? (
<InputBox <><InputBox
className={cn("w-full rounded-[20px] bg-[#FBFAFC]")} className={cn("w-full rounded-[20px] bg-[#FBFAFC]")}
threadId={threadId} threadId={threadId}
showWelcomeStyle={showWelcomeStyle} showWelcomeStyle={showWelcomeStyle}
hasSubmitted={hasSubmitted} hasSubmitted={hasSubmitted}
autoFocus={showWelcomeStyle} autoFocus={showWelcomeStyle}
status={ status={thread.error
thread.error
? "error" ? "error"
: isUploading || thread.isLoading : isUploading || thread.isLoading
? "streaming" ? "streaming"
: "ready" : "ready"}
}
context={settings.context} context={settings.context}
extraHeader={ extraHeader={<div className="flex flex-col gap-4">
<div className="flex flex-col gap-4">
{showWelcomeStyle && !hasSubmitted && ( {showWelcomeStyle && !hasSubmitted && (
<Welcome mode={settings.context.mode} /> <Welcome mode={settings.context.mode} />
)} )}
</div> </div>}
} disabled={env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY === "true" ||
disabled={
env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY === "true" ||
isSelectedSkillBootstrapping || isSelectedSkillBootstrapping ||
isUploading || isUploading ||
(isNewThread && !safeThreadId) (isNewThread && !safeThreadId)}
}
onContextChange={(context) => setSettings("context", context)} onContextChange={(context) => setSettings("context", context)}
onSubmit={handleSubmit} onSubmit={handleSubmit}
onStop={handleStop} onStop={handleStop} /></>
/>
) : ( ) : (
// <InputBoxSkeleton /> // <InputBoxSkeleton />
'' ''
@ -583,7 +577,7 @@ export default function ChatPage() {
<DevDialogTitle></DevDialogTitle> <DevDialogTitle></DevDialogTitle>
</DevDialogHeader> </DevDialogHeader>
<p className="text-muted-foreground text-sm"> <p className="text-muted-foreground text-sm">
退
</p> </p>
<DevDialogFooter> <DevDialogFooter>
<Button <Button

View File

@ -1,5 +1,9 @@
"use client"; "use client";
import { useRouter } from "next/navigation";
import type { ChatStatus } from "ai"; import type { ChatStatus } from "ai";
import { import {
CheckIcon, CheckIcon,
@ -86,6 +90,7 @@ import {
import { ModeHoverGuide } from "./mode-hover-guide"; import { ModeHoverGuide } from "./mode-hover-guide";
import { Tooltip } from "./tooltip"; import { Tooltip } from "./tooltip";
import type { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
export function InputBox({ export function InputBox({
className, className,
@ -132,7 +137,7 @@ export function InputBox({
const searchParams = useSearchParams(); const searchParams = useSearchParams();
const iframeSkill = useIframeSkill({ threadId: threadIdFromProps }); const iframeSkill = useIframeSkill({ threadId: threadIdFromProps });
const isInputDisabled = (disabled ?? false) || iframeSkill.isBootstrapping; const isInputDisabled = (disabled ?? false) || iframeSkill.isBootstrapping;
const router = useRouter();
const threadId = threadIdFromProps; const threadId = threadIdFromProps;
const { textInput } = usePromptInputController(); const { textInput } = usePromptInputController();
const attachments = usePromptInputAttachments(); const attachments = usePromptInputAttachments();
@ -375,6 +380,11 @@ export function InputBox({
/> />
</PromptInputActionMenuContent> </PromptInputActionMenuContent>
</PromptInputActionMenu> */} </PromptInputActionMenu> */}
<HistoryButton
className="px-2!"
router={router}
threadId={threadIdFromProps}
/>
<AddAttachmentsButton className="px-2!" /> <AddAttachmentsButton className="px-2!" />
<IframeSkillDialogButton <IframeSkillDialogButton
className="px-2!" className="px-2!"
@ -383,6 +393,7 @@ export function InputBox({
openSkillDialog={iframeSkill.openSkillDialog} openSkillDialog={iframeSkill.openSkillDialog}
clearSkill={iframeSkill.clearSkill} clearSkill={iframeSkill.clearSkill}
/> />
{/* 参考 kexue 版本隐藏运行模式切换按钮 */} {/* 参考 kexue 版本隐藏运行模式切换按钮 */}
</PromptInputTools> </PromptInputTools>
{/* <ModelSelector {/* <ModelSelector
@ -636,6 +647,20 @@ function AddAttachmentsButton({ className }: { className?: string }) {
</Tooltip> </Tooltip>
); );
} }
function HistoryButton({ className, router, threadId }: { className?: string; router: AppRouterInstance; threadId: string; }) {
const { t } = useI18n();
return (
<Tooltip content={t.inputBox.history}>
<PromptInputButton
className={cn("group px-2! hover:bg-[#EAE2F5]", className)}
onClick={() => router.replace(`/workspace/chats/${threadId}?is_chatting=true`)}>
<svg className="[&>path:first-child]:group-hover:fill-[#8E47F0] [&>path:last-child]:group-hover:stroke-[#8E47F0]" xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#1f1f1f"><path d="M480-120q-138 0-240.5-91.5T122-440h82q14 104 92.5 172T480-200q117 0 198.5-81.5T760-480q0-117-81.5-198.5T480-760q-69 0-129 32t-101 88h110v80H120v-240h80v94q51-64 124.5-99T480-840q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-480q0 75-28.5 140.5t-77 114q-48.5 48.5-114 77T480-120Zm112-192L440-464v-216h80v184l128 128-56 56Z"/></svg>
</PromptInputButton>
</Tooltip>
);
}
// 启动iframeSkillDialog // 启动iframeSkillDialog
function IframeSkillDialogButton({ function IframeSkillDialogButton({
className, className,

View File

@ -81,6 +81,7 @@ export const enUS: Translations = {
sendMessagePrice: sendMessagePrice:
"Please note, this feature will consume tokens. Ensure your account balance is greater than 200 credits.", "Please note, this feature will consume tokens. Ensure your account balance is greater than 200 credits.",
addAttachments: "Add attachments", addAttachments: "Add attachments",
history: "History",
selectSkill: "Select Skill", selectSkill: "Select Skill",
mode: "Mode", mode: "Mode",
flashMode: "Flash", flashMode: "Flash",

View File

@ -72,6 +72,7 @@ export interface Translations {
placeholder: string; placeholder: string;
createSkillPrompt: string; createSkillPrompt: string;
addAttachments: string; addAttachments: string;
history: string;
selectSkill: string; selectSkill: string;
mode: string; mode: string;
flashMode: string; flashMode: string;

View File

@ -83,6 +83,7 @@ export const zhCN: Translations = {
sendMessagePrice: sendMessagePrice:
"请注意此功能将消耗token请保证账户余额大于200可学豆。", "请注意此功能将消耗token请保证账户余额大于200可学豆。",
addAttachments: "添加附件", addAttachments: "添加附件",
history: "历史记录",
selectSkill: "选择Skill", selectSkill: "选择Skill",
mode: "模式", mode: "模式",
flashMode: "闪速", flashMode: "闪速",