feat(route): 前往对话页的按钮
This commit is contained in:
parent
c6c06e93a7
commit
80c964de09
|
|
@ -527,37 +527,31 @@ export default function ChatPage() {
|
|||
)}
|
||||
>
|
||||
{!(showWelcomeStyle && thread.isThreadLoading) ? (
|
||||
<InputBox
|
||||
<><InputBox
|
||||
className={cn("w-full rounded-[20px] bg-[#FBFAFC]")}
|
||||
threadId={threadId}
|
||||
showWelcomeStyle={showWelcomeStyle}
|
||||
hasSubmitted={hasSubmitted}
|
||||
autoFocus={showWelcomeStyle}
|
||||
status={
|
||||
thread.error
|
||||
? "error"
|
||||
: isUploading || thread.isLoading
|
||||
? "streaming"
|
||||
: "ready"
|
||||
}
|
||||
status={thread.error
|
||||
? "error"
|
||||
: isUploading || thread.isLoading
|
||||
? "streaming"
|
||||
: "ready"}
|
||||
context={settings.context}
|
||||
extraHeader={
|
||||
<div className="flex flex-col gap-4">
|
||||
{showWelcomeStyle && !hasSubmitted && (
|
||||
<Welcome mode={settings.context.mode} />
|
||||
)}
|
||||
</div>
|
||||
}
|
||||
disabled={
|
||||
env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY === "true" ||
|
||||
extraHeader={<div className="flex flex-col gap-4">
|
||||
{showWelcomeStyle && !hasSubmitted && (
|
||||
<Welcome mode={settings.context.mode} />
|
||||
)}
|
||||
</div>}
|
||||
disabled={env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY === "true" ||
|
||||
isSelectedSkillBootstrapping ||
|
||||
isUploading ||
|
||||
(isNewThread && !safeThreadId)
|
||||
}
|
||||
(isNewThread && !safeThreadId)}
|
||||
onContextChange={(context) => setSettings("context", context)}
|
||||
onSubmit={handleSubmit}
|
||||
onStop={handleStop}
|
||||
/>
|
||||
onStop={handleStop} /></>
|
||||
|
||||
) : (
|
||||
// <InputBoxSkeleton />
|
||||
''
|
||||
|
|
@ -583,7 +577,7 @@ export default function ChatPage() {
|
|||
<DevDialogTitle>提示</DevDialogTitle>
|
||||
</DevDialogHeader>
|
||||
<p className="text-muted-foreground text-sm">
|
||||
(测试中:计划销毁但是现在没有销毁) 退出后,当前会话结束并销毁,请先下载保存当前结果!
|
||||
历史记录每七天自动删除,现在将返回欢迎页,是否继续?
|
||||
</p>
|
||||
<DevDialogFooter>
|
||||
<Button
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
"use client";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
|
||||
|
||||
import type { ChatStatus } from "ai";
|
||||
import {
|
||||
CheckIcon,
|
||||
|
|
@ -86,6 +90,7 @@ import {
|
|||
|
||||
import { ModeHoverGuide } from "./mode-hover-guide";
|
||||
import { Tooltip } from "./tooltip";
|
||||
import type { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
||||
|
||||
export function InputBox({
|
||||
className,
|
||||
|
|
@ -132,7 +137,7 @@ export function InputBox({
|
|||
const searchParams = useSearchParams();
|
||||
const iframeSkill = useIframeSkill({ threadId: threadIdFromProps });
|
||||
const isInputDisabled = (disabled ?? false) || iframeSkill.isBootstrapping;
|
||||
|
||||
const router = useRouter();
|
||||
const threadId = threadIdFromProps;
|
||||
const { textInput } = usePromptInputController();
|
||||
const attachments = usePromptInputAttachments();
|
||||
|
|
@ -362,7 +367,7 @@ export function InputBox({
|
|||
className={cn(
|
||||
"flex transition-all duration-300 ease-out",
|
||||
!effectiveIsFocused &&
|
||||
"pointer-events-none invisible h-[0px] translate-y-2 p-[0px] opacity-0",
|
||||
"pointer-events-none invisible h-[0px] translate-y-2 p-[0px] opacity-0",
|
||||
)}
|
||||
>
|
||||
<PromptInputTools className="min-w-0 flex-1">
|
||||
|
|
@ -375,6 +380,11 @@ export function InputBox({
|
|||
/>
|
||||
</PromptInputActionMenuContent>
|
||||
</PromptInputActionMenu> */}
|
||||
<HistoryButton
|
||||
className="px-2!"
|
||||
router={router}
|
||||
threadId={threadIdFromProps}
|
||||
/>
|
||||
<AddAttachmentsButton className="px-2!" />
|
||||
<IframeSkillDialogButton
|
||||
className="px-2!"
|
||||
|
|
@ -383,6 +393,7 @@ export function InputBox({
|
|||
openSkillDialog={iframeSkill.openSkillDialog}
|
||||
clearSkill={iframeSkill.clearSkill}
|
||||
/>
|
||||
|
||||
{/* 参考 kexue 版本隐藏运行模式切换按钮 */}
|
||||
</PromptInputTools>
|
||||
{/* <ModelSelector
|
||||
|
|
@ -636,6 +647,20 @@ function AddAttachmentsButton({ className }: { className?: string }) {
|
|||
</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
|
||||
function IframeSkillDialogButton({
|
||||
className,
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ export const enUS: Translations = {
|
|||
sendMessagePrice:
|
||||
"Please note, this feature will consume tokens. Ensure your account balance is greater than 200 credits.",
|
||||
addAttachments: "Add attachments",
|
||||
history: "History",
|
||||
selectSkill: "Select Skill",
|
||||
mode: "Mode",
|
||||
flashMode: "Flash",
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ export interface Translations {
|
|||
placeholder: string;
|
||||
createSkillPrompt: string;
|
||||
addAttachments: string;
|
||||
history: string;
|
||||
selectSkill: string;
|
||||
mode: string;
|
||||
flashMode: string;
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ export const zhCN: Translations = {
|
|||
sendMessagePrice:
|
||||
"请注意,此功能将消耗token,请保证账户余额大于200可学豆。",
|
||||
addAttachments: "添加附件",
|
||||
history: "历史记录",
|
||||
selectSkill: "选择Skill",
|
||||
mode: "模式",
|
||||
flashMode: "闪速",
|
||||
|
|
|
|||
Loading…
Reference in New Issue