Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
fix: exit with error if --with-bot fail (#1175)
MaojiaSheng5951d7e38b54
diff --git a/docs/zh/faq/faq.md b/docs/zh/faq/faq.mdindex 956016aa7..cba33546b 100644--- a/docs/zh/faq/faq.md+++ b/docs/zh/faq/faq.md@@ -385,7 +385,7 @@ client = ov.AsyncHTTPClient(url="http://localhost:1933", api_key="your-key")### OpenViking 是开源的吗?-是的,OpenViking 完全开源,采用 Apache 2.0 许可证。+是的,OpenViking 完全开源,主体采用 AGPLv3 许可证,详见 README.md 说明。## 相关文档diff --git a/openviking/server/bootstrap.py b/openviking/server/bootstrap.pyindex 3ec355d59..2a02d860f 100644--- a/openviking/server/bootstrap.py+++ b/openviking/server/bootstrap.py@@ -137,23 +137,21 @@ def main():# Configure logging for Uvicornconfigure_uvicorn_logging()- # Create and run app- app = create_app(config)- workers_info = f" (workers: {config.workers})" if config.workers > 1 else ""- print(f"OpenViking HTTP Server is running on {config.host}:{config.port}{workers_info}")+ bot_process: Optional[BotProcess] = Noneif config.with_bot:print(f"Bot API proxy enabled, forwarding to {config.bot_api_url}")-- # Determine if bot logging should be enabled- enable_bot_logging = args.enable_bot_logging- if enable_bot_logging is None:- enable_bot_logging = args.with_bot-- # Start vikingbot gateway if --with-bot is set- bot_process: Optional[BotProcess] = None- if args.with_bot:+ # Determine if bot logging should be enabled+ enable_bot_logging = args.enable_bot_logging+ if enable_bot_logging is None:+ enable_bot_logging = args.with_bot+ # Start vikingbot gateway if --with-bot is setbot_process = _start_vikingbot_gateway(enable_bot_logging, args.bot_log_dir)+ # Create and run server app+ app = create_app(config)+ workers_info = f" (workers: {config.workers})" if config.workers > 1 else ""+ print(f"OpenViking HTTP Server is running on {config.host}:{config.port}{workers_info}")+try:workers = config.workersif workers > 1:@@ -177,6 +175,25 @@ def main():_stop_vikingbot_gateway(bot_process)+def _handle_vikingbot_failure(output: str, returncode: int) -> None:+ """Handle vikingbot startup failure and provide helpful error messages."""+ print(f"\nError: vikingbot gateway exited early (code {returncode})", file=sys.stderr)++ # Check for common dependency errors+ if "ModuleNotFoundError" in output:+ print("\nMissing dependencies detected!", file=sys.stderr)+ print(+ "\nTo use --with-bot, you need to install openviking with bot dependencies:",+ file=sys.stderr,+ )+ print(' pip install "openviking[bot]"', file=sys.stderr)+ print(" # Or for development:", file=sys.stderr)+ print(' uv pip install -e ".[bot,dev]"', file=sys.stderr)++ if output:+ print(f"\nDetailed error:\n{output}", file=sys.stderr)++def _start_vikingbot_gateway(enable_logging: bool, log_dir: str) -> Optional[BotProcess]:"""Start vikingbot gateway as a subprocess."""print("Starting vikingbot gateway...")@@ -247,15 +264,11 @@ def _start_vikingbot_gateway(enable_logging: bool, log_dir: str) -> Optional[Botif log_file_path:with open(log_file_path, "r") as f:output = f.read()- print(f"Warning: vikingbot gateway exited early (code {process.returncode})")- if output:- print(f"Output: {output[:500]}")+ _handle_vikingbot_failure(output, process.returncode)else:stdout, stderr = process.communicate(timeout=1)- print(f"Warning: vikingbot gateway exited early (code {process.returncode})")- if stderr:- print(f"Error: {stderr[:500]}")- return None+ _handle_vikingbot_failure(stderr, process.returncode)+ sys.exit(1)print(f"Vikingbot gateway started (PID: {process.pid})")