fix: agentscope-ai components version HistoryPanel menu error (#86)
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<link rel="icon" type="image/svg+xml" href="/logo.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>AgentScope</title>
|
||||
<title>Alias</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
"preview": "vite preview --config vite.config.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@agentscope-ai/chat": "1.1.17",
|
||||
"@agentscope-ai/design": "1.0.11",
|
||||
"@agentscope-ai/chat": "^1.1.44",
|
||||
"@agentscope-ai/design": "^1.0.20",
|
||||
"@ahooksjs/use-url-state": "^3.5.1",
|
||||
"@ant-design/pro-components": "^2.8.7",
|
||||
"@codemirror/lang-css": "^6.3.1",
|
||||
|
||||
1
alias/frontend/public/logo.svg
Normal file
1
alias/frontend/public/logo.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="20" height="20" viewBox="0 0 20 20"><defs><clipPath id="master_svg0_75_00643"><rect x="0" y="0" width="20" height="20" rx="10"/></clipPath></defs><g clip-path="url(#master_svg0_75_00643)"><rect x="0" y="0" width="20" height="20" rx="10" fill="#1A1A1D" fill-opacity="1"/><g><g><path d="M9.83005,9.02303C9.66631,8.26922,9.09608,7.68054,8.36589,7.5115099999999995C9.09608,7.34248,9.66631,6.753807,9.83005,6C9.993780000000001,6.753807,10.56402,7.34248,11.2942,7.5115099999999995C10.56402,7.68054,9.993780000000001,8.26922,9.83005,9.02303ZM4.06223,8.17221L2,12.94819L3.09958,12.94819L3.5111,11.92647L5.65759,11.92647L6.06911,12.94819L7.18718,12.94819L5.12102,8.17221L4.06223,8.17221ZM5.3197600000000005,11.08769L4.584350000000001,9.261800000000001L3.84894,11.08769L5.3197600000000005,11.08769ZM7.47013,8.279959999999999L7.47013,12.94819L8.50114,12.94819L8.50114,8.279959999999999L7.47013,8.279959999999999ZM13.36,12.49623L13.36,12.94819L14.3292,12.94819L14.3292,10.851659999999999Q14.3292,10.01576,13.8808,9.620989999999999Q13.4324,9.22612,12.6162,9.22612Q12.1932,9.22612,11.78429,9.33945Q11.37535,9.45266,11.08208,9.66971L11.45022,10.41042Q11.64467,10.25339,11.91967,10.162659999999999Q12.1948,10.07183,12.4752,10.07183Q12.8945,10.07183,13.0963,10.26042Q13.2982,10.4489,13.2982,10.79186L13.2982,10.79249L12.4788,10.79249Q11.93692,10.79249,11.59996,10.93247Q11.2631,11.07234,11.10862,11.31871Q10.95413,11.564969999999999,10.95413,11.889479999999999Q10.95413,12.20599,11.11213,12.45844Q11.27013,12.71078,11.56753,12.85544Q11.86494,13,12.2798,13Q12.749,13,13.0465,12.81589Q13.2451,12.69305,13.36,12.49623ZM13.2982,11.78724L13.2982,11.41273L12.5931,11.41273Q12.2275,11.41273,12.0925,11.53448Q11.95757,11.65612,11.95757,11.84598Q11.95757,12.04555,12.1112,12.16591Q12.2649,12.286159999999999,12.5338,12.286159999999999Q12.7935,12.286159999999999,13.0002,12.16175Q13.2068,12.03734,13.2982,11.78724ZM15.4508,12.887319999999999Q15.8703,13,16.320999999999998,13Q16.8572,13,17.2316,12.85075Q17.606099999999998,12.70139,17.8031,12.43818Q18,12.17497,18,11.836490000000001Q18,11.52414,17.8836,11.32841Q17.767200000000003,11.132570000000001,17.5762,11.0201Q17.385199999999998,10.90752,17.1558,10.84686Q16.9264,10.78621,16.6971,10.75348Q16.4677,10.72064,16.276699999999998,10.681619999999999Q16.0856,10.642610000000001,15.9693,10.572890000000001Q15.8529,10.503160000000001,15.8529,10.36777Q15.8529,10.2213,16.011200000000002,10.12556Q16.1695,10.02983,16.5175,10.02983Q16.7608,10.02983,17.020400000000002,10.08783Q17.280099999999997,10.14582,17.5378,10.30274L17.883699999999997,9.541360000000001Q17.6314,9.38859,17.2568,9.30736Q16.882199999999997,9.22612,16.5136,9.22612Q15.9972,9.22612,15.63,9.3775Q15.2629,9.52878,15.0666,9.79476Q14.8704,10.060749999999999,14.8704,10.40733Q14.8704,10.72384,14.9868,10.921700000000001Q15.1032,11.11946,15.2941,11.23406Q15.4852,11.348559999999999,15.7158,11.40794Q15.9465,11.46732,16.1759,11.50004Q16.4054,11.53277,16.5964,11.56774Q16.787399999999998,11.602599999999999,16.9037,11.66891Q17.0201,11.73522,17.0201,11.862400000000001Q17.0201,12.01837,16.8704,12.10738Q16.7207,12.196290000000001,16.366,12.196290000000001Q16.0381,12.196290000000001,15.7038,12.09939Q15.3694,12.002369999999999,15.1276,11.84545L14.7817,12.60683Q15.0313,12.77463,15.4508,12.887319999999999ZM9.32727,9.67213L9.32727,12.94819L10.35828,12.94819L10.35828,9.67213L9.32727,9.67213Z" fill-rule="evenodd" fill="#FFFFFF" fill-opacity="1"/></g></g></g></svg>
|
||||
|
After Width: | Height: | Size: 3.5 KiB |
@@ -24,6 +24,7 @@ import {
|
||||
} from "@agentscope-ai/icons";
|
||||
import classNames from "classnames";
|
||||
import React, { memo, useEffect, useRef, useState } from "react";
|
||||
import { Conversation as HistoryConversation } from "@agentscope-ai/chat/lib/Conversations";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import Avatar from "../Avatar";
|
||||
import HabbitModal from "../Habbit";
|
||||
@@ -184,20 +185,28 @@ const Sidebar: React.FC<SidebarProps> = ({
|
||||
};
|
||||
|
||||
// Get delete menu item
|
||||
const getDeleteMenuItem = (id: string) => ({
|
||||
const getDeleteMenuItem = [
|
||||
{
|
||||
label: "Delete",
|
||||
key: "delete",
|
||||
icon: <SparkDeleteLine />,
|
||||
danger: true,
|
||||
onClick: () => deletedConversation(id),
|
||||
});
|
||||
onClick: (conv: HistoryConversation) => {
|
||||
deletedConversation(conv.key);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
// Get filtered conversation list
|
||||
const getFilteredConversations = (type: HistoryType) => {
|
||||
const getFilteredConversations = (type: HistoryType): Conversation[] => {
|
||||
if (type === "collected") {
|
||||
return conversations.filter((conv) => conv.collected);
|
||||
return Array.isArray(conversations)
|
||||
? conversations.filter((conv) => conv.collected)
|
||||
: [];
|
||||
}
|
||||
return conversations.filter((conv) => !conv.collected);
|
||||
return Array.isArray(conversations)
|
||||
? conversations.filter((conv) => !conv.collected)
|
||||
: [];
|
||||
};
|
||||
|
||||
// Render history panel
|
||||
@@ -238,9 +247,7 @@ const Sidebar: React.FC<SidebarProps> = ({
|
||||
|
||||
{showPanel && (
|
||||
<HistoryPanel
|
||||
menu={(session) => ({
|
||||
items: [getDeleteMenuItem(session.key)],
|
||||
})}
|
||||
menu={getDeleteMenuItem}
|
||||
items={filteredConversations.map((item) => ({
|
||||
key: item.id,
|
||||
label: item.name,
|
||||
@@ -260,9 +267,7 @@ const Sidebar: React.FC<SidebarProps> = ({
|
||||
<div className={styles.popoverContent}>
|
||||
<div className={styles.popoverHeader}>{title}</div>
|
||||
<HistoryPanel
|
||||
menu={(session) => ({
|
||||
items: [getDeleteMenuItem(session.key)],
|
||||
})}
|
||||
menu={getDeleteMenuItem}
|
||||
items={filteredConversations.map((item) => ({
|
||||
key: item.id,
|
||||
label: item.name,
|
||||
|
||||
Reference in New Issue
Block a user