mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-01 23:56:39 +08:00
临时修复
This commit is contained in:
parent
0ff74f01d3
commit
1d04796ca0
@ -32,6 +32,7 @@ export function ChatItem(props: {
|
|||||||
index: number;
|
index: number;
|
||||||
narrow?: boolean;
|
narrow?: boolean;
|
||||||
mask: Mask;
|
mask: Mask;
|
||||||
|
provided;
|
||||||
}) {
|
}) {
|
||||||
const draggableRef = useRef<HTMLDivElement | null>(null);
|
const draggableRef = useRef<HTMLDivElement | null>(null);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -44,8 +45,6 @@ export function ChatItem(props: {
|
|||||||
|
|
||||||
const { pathname: currentPath } = useLocation();
|
const { pathname: currentPath } = useLocation();
|
||||||
return (
|
return (
|
||||||
<Draggable draggableId={`${props.id}`} index={props.index}>
|
|
||||||
{(provided) => (
|
|
||||||
<div
|
<div
|
||||||
className={`${styles["chat-item"]} ${
|
className={`${styles["chat-item"]} ${
|
||||||
props.selected &&
|
props.selected &&
|
||||||
@ -55,13 +54,11 @@ export function ChatItem(props: {
|
|||||||
onClick={props.onClick}
|
onClick={props.onClick}
|
||||||
ref={(ele) => {
|
ref={(ele) => {
|
||||||
draggableRef.current = ele;
|
draggableRef.current = ele;
|
||||||
provided.innerRef(ele);
|
props.provided.innerRef(ele);
|
||||||
}}
|
}}
|
||||||
{...provided.draggableProps}
|
{...props.provided.draggableProps}
|
||||||
{...provided.dragHandleProps}
|
{...props.provided.dragHandleProps}
|
||||||
title={`${props.title}\n${Locale.ChatItem.ChatItemCount(
|
title={`${props.title}\n${Locale.ChatItem.ChatItemCount(props.count)}`}
|
||||||
props.count,
|
|
||||||
)}`}
|
|
||||||
>
|
>
|
||||||
{props.narrow ? (
|
{props.narrow ? (
|
||||||
<div className={styles["chat-item-narrow"]}>
|
<div className={styles["chat-item-narrow"]}>
|
||||||
@ -71,9 +68,7 @@ export function ChatItem(props: {
|
|||||||
model={props.mask.modelConfig.model}
|
model={props.mask.modelConfig.model}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles["chat-item-narrow-count"]}>
|
<div className={styles["chat-item-narrow-count"]}>{props.count}</div>
|
||||||
{props.count}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
@ -98,8 +93,6 @@ export function ChatItem(props: {
|
|||||||
<DeleteIcon />
|
<DeleteIcon />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
</Draggable>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,12 +126,39 @@ export function ChatList(props: { narrow?: boolean }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DragDropContext
|
<DragDropContext onDragEnd={onDragEnd}>
|
||||||
onDragEnd={onDragEnd}
|
<Droppable
|
||||||
autoScrollerOptions={{ disabled: true }}
|
droppableId="chat-list"
|
||||||
|
renderClone={(provided, snapshot, rubic) => (
|
||||||
|
<ChatItem
|
||||||
|
title={sessions[rubic.source.index].topic}
|
||||||
|
time={new Date(
|
||||||
|
sessions[rubic.source.index].lastUpdate,
|
||||||
|
).toLocaleString()}
|
||||||
|
count={sessions[rubic.source.index].messages.length}
|
||||||
|
key={sessions[rubic.source.index].id}
|
||||||
|
id={sessions[rubic.source.index].id}
|
||||||
|
index={rubic.source.index}
|
||||||
|
selected={rubic.source.index === selectedIndex}
|
||||||
|
onClick={() => {
|
||||||
|
navigate(Path.Chat);
|
||||||
|
selectSession(rubic.source.index);
|
||||||
|
}}
|
||||||
|
onDelete={async () => {
|
||||||
|
if (
|
||||||
|
(!props.narrow && !isMobileScreen) ||
|
||||||
|
(await showConfirm(Locale.Home.DeleteChat))
|
||||||
|
) {
|
||||||
|
chatStore.deleteSession(rubic.source.index);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
narrow={props.narrow}
|
||||||
|
mask={sessions[rubic.source.index].mask}
|
||||||
|
provided={provided}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
>
|
>
|
||||||
<Droppable droppableId="chat-list">
|
{(provided, snapshot) => (
|
||||||
{(provided) => (
|
|
||||||
<div
|
<div
|
||||||
className={styles["chat-list"]}
|
className={styles["chat-list"]}
|
||||||
ref={provided.innerRef}
|
ref={provided.innerRef}
|
||||||
@ -146,10 +166,8 @@ export function ChatList(props: { narrow?: boolean }) {
|
|||||||
>
|
>
|
||||||
<QueueAnim
|
<QueueAnim
|
||||||
delay={300}
|
delay={300}
|
||||||
// className={motionStyles["queue-simple"]}
|
|
||||||
ease={["easeOutQuart", "easeInOutQuart"]}
|
ease={["easeOutQuart", "easeInOutQuart"]}
|
||||||
duration={[550, 450]}
|
duration={[550, 450]}
|
||||||
type={["right", "left"]}
|
|
||||||
animConfig={[
|
animConfig={[
|
||||||
{ opacity: [1, 0], translateY: [0, 30] },
|
{ opacity: [1, 0], translateY: [0, 30] },
|
||||||
{ height: 0 },
|
{ height: 0 },
|
||||||
@ -158,7 +176,9 @@ export function ChatList(props: { narrow?: boolean }) {
|
|||||||
// interval={150}
|
// interval={150}
|
||||||
>
|
>
|
||||||
{sessions.map((item, i) => (
|
{sessions.map((item, i) => (
|
||||||
<div key={i}>
|
<div key={item.id}>
|
||||||
|
<Draggable draggableId={`${item.id}`} index={i}>
|
||||||
|
{(provided, snapshot) => (
|
||||||
<ChatItem
|
<ChatItem
|
||||||
title={item.topic}
|
title={item.topic}
|
||||||
time={new Date(item.lastUpdate).toLocaleString()}
|
time={new Date(item.lastUpdate).toLocaleString()}
|
||||||
@ -181,7 +201,10 @@ export function ChatList(props: { narrow?: boolean }) {
|
|||||||
}}
|
}}
|
||||||
narrow={props.narrow}
|
narrow={props.narrow}
|
||||||
mask={item.mask}
|
mask={item.mask}
|
||||||
|
provided={provided}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
|
</Draggable>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</QueueAnim>
|
</QueueAnim>
|
||||||
|
Loading…
Reference in New Issue
Block a user