Skip to content

Commit 742640d

Browse files
committed
Merge branch 'develop' of https://github.com/ModelEngine-Group/nexent into pyh/feat_agent_configuration_develop
2 parents 7aae3c4 + ea542c5 commit 742640d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2847
-1695
lines changed

backend/database/agent_db.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,15 @@ def create_agent(agent_info, tenant_id: str, user_id: str):
7676
:param user_id:
7777
:return: Created agent object
7878
"""
79-
agent_info.update({
79+
info_with_metadata = dict(agent_info)
80+
info_with_metadata.setdefault("max_steps", 5)
81+
info_with_metadata.update({
8082
"tenant_id": tenant_id,
8183
"created_by": user_id,
8284
"updated_by": user_id,
83-
"max_steps": 5
8485
})
8586
with get_db_session() as session:
86-
new_agent = AgentInfo(**filter_property(agent_info, AgentInfo))
87+
new_agent = AgentInfo(**filter_property(info_with_metadata, AgentInfo))
8788
new_agent.delete_flag = 'N'
8889
session.add(new_agent)
8990
session.flush()

doc/docs/zh/opensource-memorial-wall.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
每条消息应包含您的姓名/昵称和日期。
1616
请保持消息的礼貌和尊重,符合我们的行为准则。
1717
-->
18+
1819
::: info happyzhang - 2025-11-13
1920
也许我们正见证着未来的“后起之秀”😀
2021
:::
@@ -413,3 +414,10 @@ Nexent功能如此之强大,给我很多帮助,感谢开发者!厉害
413414
第一次参加,加油
414415
:::
415416

417+
::: info user - 2025-11-17
418+
感谢 Nexent 让我第一次接触到智能体,希望参加ICT比赛过程中可以学到更多知识!
419+
:::
420+
421+
::: tip kon-do - 2025-11-17
422+
感谢 Nexent 让我踏上了开源之旅!这个项目的文档真的很棒,帮助我快速上手。
423+
:::

frontend/app/[locale]/setup/agents/config.tsx renamed to frontend/app/[locale]/agents/AgentConfiguration.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import { configStore } from "@/lib/config";
3636
import AgentSetupOrchestrator from "./components/AgentSetupOrchestrator";
3737
import DebugConfig from "./components/DebugConfig";
3838

39-
import "../../i18n";
39+
import "../i18n";
4040

4141
// Layout Height Constant Configuration
4242
const LAYOUT_CONFIG: LayoutConfig = AGENT_SETUP_LAYOUT_DEFAULT;
@@ -525,13 +525,13 @@ export default forwardRef<AgentConfigHandle, AgentConfigProps>(function AgentCon
525525
className="w-full mx-auto"
526526
style={{
527527
maxWidth: SETUP_PAGE_CONTAINER.MAX_WIDTH,
528-
height: SETUP_PAGE_CONTAINER.MAIN_CONTENT_HEIGHT,
528+
padding: `0 ${SETUP_PAGE_CONTAINER.HORIZONTAL_PADDING}`,
529529
}}
530530
>
531531
<div
532532
className={STANDARD_CARD.BASE_CLASSES}
533533
style={{
534-
height: "100%",
534+
height: SETUP_PAGE_CONTAINER.MAIN_CONTENT_HEIGHT,
535535
...STANDARD_CARD.CONTENT_SCROLL,
536536
}}
537537
>
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
"use client";
2+
3+
import React, {useState, useEffect, useRef} from "react";
4+
import {motion} from "framer-motion";
5+
6+
import {useSetupFlow} from "@/hooks/useSetupFlow";
7+
import {
8+
ConnectionStatus,
9+
} from "@/const/modelConfig";
10+
11+
import AgentConfig, {AgentConfigHandle} from "./AgentConfiguration";
12+
import SaveConfirmModal from "./components/SaveConfirmModal";
13+
14+
interface AgentsContentProps {
15+
/** Whether currently saving */
16+
isSaving?: boolean;
17+
/** Connection status */
18+
connectionStatus?: ConnectionStatus;
19+
/** Is checking connection */
20+
isCheckingConnection?: boolean;
21+
/** Check connection callback */
22+
onCheckConnection?: () => void;
23+
/** Callback to expose connection status */
24+
onConnectionStatusChange?: (status: ConnectionStatus) => void;
25+
/** Callback to expose saving state */
26+
onSavingStateChange?: (isSaving: boolean) => void;
27+
}
28+
29+
/**
30+
* AgentsContent - Main component for agent configuration
31+
* Can be used in setup flow or as standalone page
32+
*/
33+
export default function AgentsContent({
34+
isSaving: externalIsSaving,
35+
connectionStatus: externalConnectionStatus,
36+
isCheckingConnection: externalIsCheckingConnection,
37+
onCheckConnection: externalOnCheckConnection,
38+
onConnectionStatusChange,
39+
onSavingStateChange,
40+
}: AgentsContentProps) {
41+
const agentConfigRef = useRef<AgentConfigHandle | null>(null);
42+
const [showSaveConfirm, setShowSaveConfirm] = useState(false);
43+
const pendingNavRef = useRef<null | (() => void)>(null);
44+
45+
// Use custom hook for common setup flow logic
46+
const {
47+
canAccessProtectedData,
48+
pageVariants,
49+
pageTransition,
50+
} = useSetupFlow({
51+
requireAdmin: true,
52+
externalConnectionStatus,
53+
externalIsCheckingConnection,
54+
onCheckConnection: externalOnCheckConnection,
55+
onConnectionStatusChange,
56+
nonAdminRedirect: "/setup/knowledges",
57+
});
58+
59+
const [internalIsSaving, setInternalIsSaving] = useState(false);
60+
const isSaving = externalIsSaving ?? internalIsSaving;
61+
62+
// Update external saving state
63+
useEffect(() => {
64+
onSavingStateChange?.(isSaving);
65+
}, [isSaving, onSavingStateChange]);
66+
67+
return (
68+
<>
69+
<motion.div
70+
initial="initial"
71+
animate="in"
72+
exit="out"
73+
variants={pageVariants}
74+
transition={pageTransition}
75+
style={{width: "100%", height: "100%"}}
76+
>
77+
{canAccessProtectedData ? (
78+
<AgentConfig ref={agentConfigRef} canAccessProtectedData={canAccessProtectedData} />
79+
) : null}
80+
</motion.div>
81+
82+
<SaveConfirmModal
83+
open={showSaveConfirm}
84+
onCancel={async () => {
85+
// Reload data from backend to discard changes
86+
await agentConfigRef.current?.reloadCurrentAgentData?.();
87+
setShowSaveConfirm(false);
88+
const go = pendingNavRef.current;
89+
pendingNavRef.current = null;
90+
if (go) go();
91+
}}
92+
onSave={async () => {
93+
try {
94+
setInternalIsSaving(true);
95+
await agentConfigRef.current?.saveAllChanges?.();
96+
setShowSaveConfirm(false);
97+
const go = pendingNavRef.current;
98+
pendingNavRef.current = null;
99+
if (go) go();
100+
} catch (e) {
101+
// errors are surfaced by underlying save
102+
} finally {
103+
setInternalIsSaving(false);
104+
}
105+
}}
106+
/>
107+
</>
108+
);
109+
}
110+

frontend/app/[locale]/setup/agents/components/AgentSetupOrchestrator.tsx renamed to frontend/app/[locale]/agents/components/AgentSetupOrchestrator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useState, useEffect, useCallback, useRef, useMemo } from "react";
44
import { useTranslation } from "react-i18next";
55
import { TFunction } from "i18next";
66

7-
import { App, Modal, Typography, Button } from "antd";
7+
import { App, Modal, Button } from "antd";
88
import { WarningFilled } from "@ant-design/icons";
99

1010
import { TooltipProvider } from "@/components/ui/tooltip";

frontend/app/[locale]/setup/agents/components/DebugConfig.tsx renamed to frontend/app/[locale]/agents/components/DebugConfig.tsx

File renamed without changes.

frontend/app/[locale]/setup/agents/components/McpConfigModal.tsx renamed to frontend/app/[locale]/agents/components/McpConfigModal.tsx

File renamed without changes.

frontend/app/[locale]/setup/agents/components/PromptManager.tsx renamed to frontend/app/[locale]/agents/components/PromptManager.tsx

File renamed without changes.

frontend/app/[locale]/setup/agents/components/SaveConfirmModal.tsx renamed to frontend/app/[locale]/agents/components/SaveConfirmModal.tsx

File renamed without changes.

frontend/app/[locale]/setup/agents/components/agent/AgentCallRelationshipModal.tsx renamed to frontend/app/[locale]/agents/components/agent/AgentCallRelationshipModal.tsx

File renamed without changes.

0 commit comments

Comments
 (0)