feat: 清除header的阴影;取消发送按钮的空值disabled检查;新增删除clearSkill,tag的逻辑;

This commit is contained in:
肖应宇 2026-03-17 17:05:41 +08:00
parent 32f581cf50
commit 7e3901fe21
5 changed files with 27 additions and 14 deletions

View File

@ -90,13 +90,15 @@ export default function ChatPage() {
"absolute top-0 right-0 left-0 z-30 mx-[20px] grid h-[58px] shrink-0 grid-cols-3 items-center rounded-t-[20px] border-b py-[15px]", "absolute top-0 right-0 left-0 z-30 mx-[20px] grid h-[58px] shrink-0 grid-cols-3 items-center rounded-t-[20px] border-b py-[15px]",
isNewThread isNewThread
? "bg-background/0 backdrop-blur-none" ? "bg-background/0 backdrop-blur-none"
: "bg-background/80 shadow-xs backdrop-blur", : "bg-background/80 backdrop-blur",
)} )}
> >
{/* 返回查看结果左箭头 */} {/* 返回查看结果左箭头 */}
<div className="flex h-full w-full items-center text-sm font-medium"> <div className="flex h-full w-full items-center text-sm font-medium">
<button <Button
className="bg-transparent" size="sm"
variant="ghost"
className="h-full px-[10px] py-[5px] text-sm font-medium"
onClick={() => setShowExitDialog(true)} onClick={() => setShowExitDialog(true)}
> >
<svg <svg
@ -114,7 +116,7 @@ export default function ChatPage() {
strokeLinejoin="round" strokeLinejoin="round"
/> />
</svg> </svg>
</button> </Button>
</div> </div>
<div className="flex h-full w-full items-center justify-center overflow-hidden text-sm font-medium"> <div className="flex h-full w-full items-center justify-center overflow-hidden text-sm font-medium">
<ThreadTitle threadId={threadId} thread={thread} /> <ThreadTitle threadId={threadId} thread={thread} />

View File

@ -1077,18 +1077,23 @@ export const PromptInputSubmit = ({
: false; : false;
// 正在 streaming 时不允许发送 // 正在 streaming 时不允许发送
const isStreaming = status === "streaming" || status === "submitted"; // const isStreaming = status === "streaming" || status === "submitted";
const isDisabled = disabled || !hasContent || isStreaming; // const isDisabled = disabled || !hasContent || isStreaming;
let Icon = <ArrowUpIcon className="size-4" />; let Icon = <ArrowUpIcon className="size-4" />;
let text: string = "发送";
if (status === "submitted") { if (status === "submitted") {
Icon = <Loader2Icon className="size-4 animate-spin" />; Icon = <Loader2Icon className="size-4 animate-spin" />;
text = "生成中...";
} else if (status === "streaming") { } else if (status === "streaming") {
Icon = <SquareIcon className="size-4" />; Icon = <SquareIcon className="size-4" />;
text = "停止";
} else if (status === "error") { } else if (status === "error") {
Icon = <XIcon className="size-4" />; Icon = <XIcon className="size-4" />;
text = "错误";
} }
return ( return (
@ -1097,19 +1102,19 @@ export const PromptInputSubmit = ({
// 被button{bgc:#fff}覆盖了,只能加"!" // 被button{bgc:#fff}覆盖了,只能加"!"
className={cn( className={cn(
"h-[40px] w-[140px] rounded-[10px] border-0 font-bold transition-all", "h-[40px] w-[140px] rounded-[10px] border-0 font-bold transition-all",
isDisabled // isDisabled
? "cursor-not-allowed !bg-gray-200 text-gray-400" // ? "cursor-not-allowed !bg-gray-200 text-gray-400":
: "!bg-[#F0E8FB] text-[#8E47F0] hover:!bg-[#8E47F0] hover:text-[#FFFFFF]", "!bg-[#F0E8FB] text-[#8E47F0] hover:!bg-[#8E47F0] hover:text-[#FFFFFF]",
className, className,
)} )}
size={size} size={size}
type="submit" type="submit"
variant={variant} variant={variant}
disabled={isDisabled} // disabled={isDisabled}
{...props} {...props}
> >
{children ?? Icon} {/* {children ?? Icon} */}
{text}
</InputGroupButton> </InputGroupButton>
); );
}; };

View File

@ -826,7 +826,7 @@ export function InputBox({
variant="outline" variant="outline"
status={status} status={status}
/> />
{/* TODO: 神秘空div */} {/* MARK: 神秘空div */}
{/* {!isNewThread && ( {/* {!isNewThread && (
<div className="bg-background absolute right-0 -bottom-[17px] left-0 z-0 h-4"></div> <div className="bg-background absolute right-0 -bottom-[17px] left-0 z-0 h-4"></div>
)} */} )} */}

View File

@ -24,6 +24,8 @@ export const enUS: Translations = {
delete: "Delete", delete: "Delete",
rename: "Rename", rename: "Rename",
share: "Share", share: "Share",
fullScreen: "fullScreen",
closeFullScreen: "closeFullScreen",
openInNewWindow: "Open in new window", openInNewWindow: "Open in new window",
close: "Close", close: "Close",
more: "More", more: "More",

View File

@ -60,9 +60,13 @@ export function useIframeSkill(): UseIframeSkillReturn {
window.parent.postMessage(message, "*"); window.parent.postMessage(message, "*");
}, []); }, []);
// 清除选中 // 清除选中并发送 skill_id=0 给主页
const clearSkill = useCallback(() => { const clearSkill = useCallback(() => {
setSelectedSkill(null); setSelectedSkill(null);
// 发送 skill_id=0 给主页,通知取消选择
const message = { type: MESSAGE_TYPES.SELECT_SKILL, skill_id: "0" };
console.log("[useIframeSkill] clearSkill, sending skill_id=0:", message);
window.parent.postMessage(message, "*");
}, []); }, []);
return { selectedSkill, sendSelectSkill, openSkillDialog, clearSkill }; return { selectedSkill, sendSelectSkill, openSkillDialog, clearSkill };