crush-level-web/src/app/(main)/chat/[id]/Drawer/MaxToken.tsx

46 lines
1.5 KiB
TypeScript
Raw Normal View History

2025-12-17 10:13:47 +00:00
'use client';
import { useState } from 'react';
import { Checkbox } from '@/components/ui/checkbox';
import { Button } from '@/components/ui/button';
import { cn } from '@/lib/utils';
2025-12-18 10:14:12 +00:00
import { useStreamChatStore } from '@/app/(main)/chat/[id]/stream-chat';
2025-12-09 09:13:46 +00:00
type TokenOption = {
2025-12-17 10:13:47 +00:00
value: number;
label: string;
};
2025-12-09 09:13:46 +00:00
export default function MaxToken() {
2025-12-18 10:14:12 +00:00
const chatSetting = useStreamChatStore((store) => store.chatSetting);
const setChatSetting = useStreamChatStore((store) => store.setChatSetting);
2025-12-09 09:13:46 +00:00
const tokenOptions: TokenOption[] = [
{ value: 800, label: '800' },
{ value: 1000, label: '1000' },
{ value: 1200, label: '1200' },
{ value: 1500, label: '1500' },
2025-12-17 10:13:47 +00:00
];
2025-12-09 09:13:46 +00:00
return (
<div className="flex h-full flex-col">
<div className="flex-1">
<div className="flex flex-col gap-3">
{tokenOptions.map((option) => (
<div
key={option.value}
className={cn(
'bg-surface-element-normal flex h-12 cursor-pointer items-center justify-between rounded-lg px-5 transition-colors',
2025-12-18 10:14:12 +00:00
chatSetting.maximumReplies === option.value && 'bg-surface-element-hover'
2025-12-09 09:13:46 +00:00
)}
2025-12-18 10:14:12 +00:00
onClick={() => setChatSetting({ maximumReplies: option.value })}
2025-12-09 09:13:46 +00:00
>
<div className="txt-title-s">{option.label}</div>
2025-12-18 10:14:12 +00:00
<Checkbox shape="round" checked={chatSetting.maximumReplies === option.value} />
2025-12-09 09:13:46 +00:00
</div>
))}
</div>
</div>
</div>
2025-12-17 10:13:47 +00:00
);
2025-12-09 09:13:46 +00:00
}