From 0cd936853501e271d46337cbd5fac04f2a9fb2b7 Mon Sep 17 00:00:00 2001
From: sidiluo <820235256@qq.com>
Date: Thu, 25 Dec 2025 18:00:52 +0800
Subject: [PATCH] fix: agentscope-ai components version HistoryPanel menu
error (#86)
---
alias/frontend/index.html | 4 +-
alias/frontend/package.json | 4 +-
alias/frontend/public/logo.svg | 1 +
.../frontend/src/pages/Chat/Sidebar/index.tsx | 37 +++++++++++--------
4 files changed, 26 insertions(+), 20 deletions(-)
create mode 100644 alias/frontend/public/logo.svg
diff --git a/alias/frontend/index.html b/alias/frontend/index.html
index 314117a..b6230ba 100644
--- a/alias/frontend/index.html
+++ b/alias/frontend/index.html
@@ -2,9 +2,9 @@
-
+
- AgentScope
+ Alias
diff --git a/alias/frontend/package.json b/alias/frontend/package.json
index 45be2ab..01baf16 100644
--- a/alias/frontend/package.json
+++ b/alias/frontend/package.json
@@ -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",
diff --git a/alias/frontend/public/logo.svg b/alias/frontend/public/logo.svg
new file mode 100644
index 0000000..78f8123
--- /dev/null
+++ b/alias/frontend/public/logo.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/alias/frontend/src/pages/Chat/Sidebar/index.tsx b/alias/frontend/src/pages/Chat/Sidebar/index.tsx
index d742f00..46028f8 100644
--- a/alias/frontend/src/pages/Chat/Sidebar/index.tsx
+++ b/alias/frontend/src/pages/Chat/Sidebar/index.tsx
@@ -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 = ({
};
// Get delete menu item
- const getDeleteMenuItem = (id: string) => ({
- label: "Delete",
- key: "delete",
- icon: ,
- danger: true,
- onClick: () => deletedConversation(id),
- });
+ const getDeleteMenuItem = [
+ {
+ label: "Delete",
+ key: "delete",
+ icon: ,
+ danger: true,
+ 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 = ({
{showPanel && (
({
- items: [getDeleteMenuItem(session.key)],
- })}
+ menu={getDeleteMenuItem}
items={filteredConversations.map((item) => ({
key: item.id,
label: item.name,
@@ -260,9 +267,7 @@ const Sidebar: React.FC = ({
{title}
({
- items: [getDeleteMenuItem(session.key)],
- })}
+ menu={getDeleteMenuItem}
items={filteredConversations.map((item) => ({
key: item.id,
label: item.name,