From 8e0820516fcb536baaba589d0af33d2209d9304d Mon Sep 17 00:00:00 2001 From: a7m-1st Date: Thu, 28 Aug 2025 04:00:35 +0300 Subject: [PATCH 1/6] chore: redirect errors, remove warnings from console, hide url path logs --- electron/main/index.ts | 4 +++- electron/main/init.ts | 20 ++++++++++++++++++-- src/api/http.ts | 2 +- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/electron/main/index.ts b/electron/main/index.ts index f059716d..1cc8f6dd 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -123,6 +123,8 @@ nativeTheme.themeSource = 'light'; // Set log level log.transports.console.level = 'info'; log.transports.file.level = 'info'; +log.transports.console.format = '[{level}]{text}'; +log.transports.file.format = '[{level}]{text}'; // Disable GPU Acceleration for Windows 7 if (os.release().startsWith('6.1')) app.disableHardwareAcceleration() @@ -362,7 +364,7 @@ function registerIpcHandlers() { stderr += output; if (output.includes('OAuth callback server running at')) { const url = output.split('OAuth callback server running at')[1].trim(); - log.info(' detect OAuth callback URL:', url); + log.info('detect OAuth callback URL:', url); // Notify frontend to callback URL if (win && !win.isDestroyed()) { diff --git a/electron/main/init.ts b/electron/main/init.ts index e2922cf2..39346c97 100644 --- a/electron/main/init.ts +++ b/electron/main/init.ts @@ -302,6 +302,21 @@ export async function startBackend(setPort?: (port: number) => void): Promise { + if (!data) return; + const msg = data.toString().trimEnd(); + if (msg.toLowerCase().includes("error") || msg.toLowerCase().includes("traceback")) { + log.error(`BACKEND: ${msg}`); + } else if (msg.toLowerCase().includes("warn")) { + //Skip Warnings + // log.warn(`BACKEND: ${msg}`); + } else { + log.info(`BACKEND: ${msg}`); // treat uvicorn info logs as normal + } + } + return new Promise((resolve, reject) => { const node_process = spawn( uv_path, @@ -320,7 +335,7 @@ export async function startBackend(setPort?: (port: number) => void): Promise { - log.info(`fastapi output: ${data}`); + displayFilteredLogs(data); // check output content, judge if start success if (!started && data.toString().includes("Uvicorn running on")) { started = true; @@ -330,7 +345,8 @@ export async function startBackend(setPort?: (port: number) => void): Promise { - log.error(`fastapi stderr output: ${data}`); + displayFilteredLogs(data); + if (!started && data.toString().includes("Uvicorn running on")) { started = true; clearTimeout(startTimeout); diff --git a/src/api/http.ts b/src/api/http.ts index 32c49d42..39960be9 100644 --- a/src/api/http.ts +++ b/src/api/http.ts @@ -170,7 +170,7 @@ async function proxyFetchRequest( ...customHeaders, } - console.log('url', url, token) + console.debug('url', url, token) if (!url.includes('http://') && !url.includes('https://') && token) { headers['Authorization'] = `Bearer ${token}` } From ff5f2703f62a1bfd1a49c3be546dcc10170ae8d8 Mon Sep 17 00:00:00 2001 From: a7m-1st Date: Thu, 28 Aug 2025 04:35:48 +0300 Subject: [PATCH 2/6] chore: agent system message (to debug) --- backend/app/utils/agent.py | 4 ++-- electron/main/init.ts | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/app/utils/agent.py b/backend/app/utils/agent.py index a8cf613d..5d542b2b 100644 --- a/backend/app/utils/agent.py +++ b/backend/app/utils/agent.py @@ -221,7 +221,7 @@ class ListenChatAgent(ChatAgent): error_info = None message = None res = None - traceroot_logger.info(f"Agent {self.agent_name} starting async step with message: {input_message.content if isinstance(input_message, BaseMessage) else input_message}") + traceroot_logger.debug(f"Agent {self.agent_name} starting async step with message: {input_message.content if isinstance(input_message, BaseMessage) else input_message}") try: res = await super().astep(input_message, response_format) @@ -290,7 +290,7 @@ class ListenChatAgent(ChatAgent): task_lock = get_task_lock(self.api_task_id) toolkit_name = getattr(tool, "_toolkit_name") if hasattr(tool, "_toolkit_name") else "mcp_toolkit" - traceroot_logger.info(f"Agent {self.agent_name} executing tool: {func_name} from toolkit: {toolkit_name} with args: {json.dumps(args, ensure_ascii=False)}") + traceroot_logger.debug(f"Agent {self.agent_name} executing tool: {func_name} from toolkit: {toolkit_name} with args: {json.dumps(args, ensure_ascii=False)}") asyncio.create_task( task_lock.put_queue( ActionActivateToolkitData( diff --git a/electron/main/init.ts b/electron/main/init.ts index 39346c97..6d1589ca 100644 --- a/electron/main/init.ts +++ b/electron/main/init.ts @@ -312,6 +312,8 @@ export async function startBackend(setPort?: (port: number) => void): Promise Date: Thu, 28 Aug 2025 04:36:41 +0300 Subject: [PATCH 3/6] chore: no show >>>gen image<<< --- backend/app/utils/listen/toolkit_listen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/app/utils/listen/toolkit_listen.py b/backend/app/utils/listen/toolkit_listen.py index 542effbc..07404e43 100644 --- a/backend/app/utils/listen/toolkit_listen.py +++ b/backend/app/utils/listen/toolkit_listen.py @@ -129,7 +129,7 @@ def listen_toolkit( error = None res = None try: - print(">>>>", func.__name__, "<<<<") + logger.debug(">>>>", func.__name__, "<<<<") res = func(*args, **kwargs) # Safety check: if the result is a coroutine, we need to await it if asyncio.iscoroutine(res): From f6bb9c22ce7c82613e24e4fa04c18dee3e7c2edf Mon Sep 17 00:00:00 2001 From: sw3205933776 <3205933776@qq.com> Date: Thu, 28 Aug 2025 10:35:26 +0800 Subject: [PATCH 4/6] fix: open model button when switching sign-in accounts (#228) --- src/pages/Login.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/Login.tsx b/src/pages/Login.tsx index 8ee90257..2c8f932e 100644 --- a/src/pages/Login.tsx +++ b/src/pages/Login.tsx @@ -19,7 +19,7 @@ const HAS_STACK_KEYS = hasStackKeys(); let lock = false; export default function Login() { const app = HAS_STACK_KEYS ? useStackApp() : null; - const { setAuth } = useAuthStore(); + const { setAuth,setModelType } = useAuthStore(); const navigate = useNavigate(); const location = useLocation(); const [hidePassword, setHidePassword] = useState(true); @@ -100,6 +100,7 @@ export default function Login() { } setAuth({ email: formData.email, ...data }); + setModelType('cloud') navigate("/"); } catch (error: any) { console.error("Login failed:", error); @@ -120,6 +121,7 @@ export default function Login() { return; } console.log("data", data); + setModelType('cloud') setAuth({ email: formData.email, ...data }); navigate("/"); } catch (error: any) { From defe656c285f4eb2974f7fd0b0ced54f3514dfef Mon Sep 17 00:00:00 2001 From: sw3205933776 <3205933776@qq.com> Date: Thu, 28 Aug 2025 10:50:08 +0800 Subject: [PATCH 5/6] fix: add latest-x64-mac.yml to release artifacts for auto-update (#246) --- .github/workflows/build.yml | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 464ec63a..7ca06fad 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -99,7 +99,7 @@ jobs: run: | mkdir -p release/mac-x64 release/mac-arm64 release/win-x64 - # Download all artifacts with correct names + # Download all artifacts with correct names - name: Download mac-x64 artifact uses: actions/download-artifact@v4 with: @@ -120,38 +120,35 @@ jobs: # Move files to final release directory, removing any nested release/ directory - name: Move files to clean folders + shell: bash run: | # mac-x64 if [ -d "temp-mac-x64/release" ]; then - mv temp-mac-x64/release/* release/mac-x64/ - elif [ -d "temp-mac-x64" ]; then - mv temp-mac-x64/* release/mac-x64/ + mv temp-mac-x64/release/* release/mac-x64/ || true + else + mv temp-mac-x64/* release/mac-x64/ || true fi # mac-arm64 if [ -d "temp-mac-arm64/release" ]; then - mv temp-mac-arm64/release/* release/mac-arm64/ - elif [ -d "temp-mac-arm64" ]; then - mv temp-mac-arm64/* release/mac-arm64/ + mv temp-mac-arm64/release/* release/mac-arm64/ || true + else + mv temp-mac-arm64/* release/mac-arm64/ || true fi # win-x64 if [ -d "temp-win-x64/release" ]; then - mv temp-win-x64/release/* release/win-x64/ - elif [ -d "temp-win-x64" ]; then - mv temp-win-x64/* release/win-x64/ + mv temp-win-x64/release/* release/win-x64/ || true + else + mv temp-win-x64/* release/win-x64/ || true fi - name: Rename duplicate files run: | - if [ -f "release/mac-x64/latest-mac.yml" ]; then - mv release/mac-x64/latest-mac.yml release/mac-x64/latest-x64-mac.yml - fi - if [ -f "release/mac-arm64/latest-mac.yml" ]; then - mv release/mac-arm64/latest-mac.yml release/mac-arm64/latest-arm64-mac.yml - fi + mv release/mac-x64/latest-mac.yml release/mac-x64/latest-x64-mac.yml || true + mv release/mac-arm64/latest-mac.yml release/mac-arm64/latest-arm64-mac.yml || true - # 最终创建 GitHub Release + # Create GitHub Release - name: Create GitHub Release if: startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v1 @@ -161,4 +158,4 @@ jobs: release/mac-arm64/* release/win-x64/* env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From eee94906d9ba649691fce286795e480d415653fa Mon Sep 17 00:00:00 2001 From: Wendong-Fan Date: Fri, 29 Aug 2025 00:41:41 +0800 Subject: [PATCH 6/6] update log --- backend/app/utils/listen/toolkit_listen.py | 2 +- backend/main.py | 31 +++++++++------------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/backend/app/utils/listen/toolkit_listen.py b/backend/app/utils/listen/toolkit_listen.py index 07404e43..5c1900c7 100644 --- a/backend/app/utils/listen/toolkit_listen.py +++ b/backend/app/utils/listen/toolkit_listen.py @@ -129,7 +129,7 @@ def listen_toolkit( error = None res = None try: - logger.debug(">>>>", func.__name__, "<<<<") + logger.debug(f"Executing toolkit method: {toolkit_name}.{method_name} for agent '{toolkit.agent_name}'") res = func(*args, **kwargs) # Safety check: if the result is a coroutine, we need to await it if asyncio.iscoroutine(res): diff --git a/backend/main.py b/backend/main.py index 56dc9b98..f76059b9 100644 --- a/backend/main.py +++ b/backend/main.py @@ -5,24 +5,20 @@ import asyncio import atexit from app import api from loguru import logger -from app.utils import traceroot_wrapper as traceroot from app.component.environment import auto_include_routers, env -# Create traceroot logger for main application -traceroot_logger = traceroot.get_logger('main') - os.environ["PYTHONIOENCODING"] = "utf-8" # Log application startup -traceroot_logger.info("Starting Eigent Multi-Agent System API") -traceroot_logger.info(f"Python encoding: {os.environ.get('PYTHONIOENCODING')}") -traceroot_logger.info(f"Environment: {os.environ.get('ENVIRONMENT', 'development')}") +logger.info("Starting Eigent Multi-Agent System API") +logger.info(f"Python encoding: {os.environ.get('PYTHONIOENCODING')}") +logger.info(f"Environment: {os.environ.get('ENVIRONMENT', 'development')}") prefix = env("url_prefix", "") -traceroot_logger.info(f"Loading routers with prefix: '{prefix}'") +logger.info(f"Loading routers with prefix: '{prefix}'") auto_include_routers(api, prefix, "app/controller") -traceroot_logger.info("All routers loaded successfully") +logger.info("All routers loaded successfully") # Configure Loguru @@ -35,36 +31,34 @@ logger.add( level="DEBUG", # Log level encoding="utf-8", ) -traceroot_logger.info(f"Loguru configured with log file: {log_path}") +logger.info(f"Loguru configured with log file: {log_path}") dir = pathlib.Path(__file__).parent / "runtime" dir.mkdir(parents=True, exist_ok=True) # Write PID file asynchronously -@traceroot.trace() async def write_pid_file(): r"""Write PID file asynchronously""" import aiofiles async with aiofiles.open(dir / "run.pid", "w") as f: await f.write(str(os.getpid())) - traceroot_logger.info(f"PID file written: {os.getpid()}") + logger.info(f"PID file written: {os.getpid()}") # Create task to write PID pid_task = asyncio.create_task(write_pid_file()) -traceroot_logger.info("PID write task created") +logger.info("PID write task created") # Graceful shutdown handler shutdown_event = asyncio.Event() -@traceroot.trace() async def cleanup_resources(): r"""Cleanup all resources on shutdown""" logger.info("Starting graceful shutdown...") - traceroot_logger.info("Starting graceful shutdown process") + logger.info("Starting graceful shutdown process") from app.service.task import task_locks, _cleanup_task @@ -89,14 +83,13 @@ async def cleanup_resources(): pid_file.unlink() logger.info("Graceful shutdown completed") - traceroot_logger.info("All resources cleaned up successfully") + logger.info("All resources cleaned up successfully") -@traceroot.trace() def signal_handler(signum, frame): r"""Handle shutdown signals""" logger.info(f"Received signal {signum}") - traceroot_logger.warning(f"Received shutdown signal: {signum}") + logger.warning(f"Received shutdown signal: {signum}") asyncio.create_task(cleanup_resources()) shutdown_event.set() @@ -108,4 +101,4 @@ signal.signal(signal.SIGINT, signal_handler) atexit.register(lambda: asyncio.run(cleanup_resources())) # Log successful initialization -traceroot_logger.info("Application initialization completed successfully") +logger.info("Application initialization completed successfully")