Skip to content

[Bug]: 使用ov chat后提示报错 #727

@yuanhechen

Description

@yuanhechen

Bug Description

使用ov chat后发送消息无法正确返回消息,提示系统提示词应该在用户消息后面

Steps to Reproduce

1、安装openviking
2、安装openviking-bot
3、配置本地部署的qwen3-embedding模型和qwen3.5的推理服务,修改配置文件
4、启动openviking-server --with-bot
5、在另一个端口启动ov chat然后输入问题后不能正常返回内容

Expected Behavior

应该返回response

Actual Behavior

Error calling LLM: litellm.BadRequestError: OpenAIException - System message must be at the beginning.

Minimal Reproducible Example

Error Logs

2026-03-18 12:03:38.377 | INFO     | vikingbot.channels.manager:add_channel:36 - Channel added: openapi (cli__default)
2026-03-18 12:03:38.377 | INFO     | vikingbot.cli.commands:prepare_channel:432 - OpenAPI channel enabled on port 18790
✓ Channels enabled: cli__default
2026-03-18 12:03:38.379 | WARNING  | vikingbot.cli.commands:prepare_agent_loop:297 - [SANDBOX] disabled (using DIRECT mode - commands run directly on host)
2026-03-18 12:03:38.380 | WARNING  | vikingbot.integrations.langfuse:get_instance:69 - [LANGFUSE] disabled
2026-03-18 12:03:38.380 | DEBUG    | vikingbot.hooks.manager:register_path:44 - Registered hook '<vikingbot.hooks.builtins.openviking_hooks.OpenVikingCompactHook object at 0x7428a71a0490>' for event 'message.compact'
2026-03-18 12:03:38.380 | DEBUG    | vikingbot.hooks.manager:register_path:44 - Registered hook '<vikingbot.hooks.builtins.openviking_hooks.OpenVikingPostCallHook object at 0x7428a71a04c0>' for event 'tool.post_call'
✓ Heartbeat: every 600s
2026-03-18 12:03:38.382 | INFO     | vikingbot.cron.service:start:156 - Cron service started with 0 jobs
2026-03-18 12:03:38.382 | INFO     | vikingbot.heartbeat.service:start:109 - Heartbeat started (every 600s)
2026-03-18 12:03:38.382 | INFO     | vikingbot.channels.manager:start_all:188 - Starting cli__default channel...
2026-03-18 12:03:38.382 | INFO     | vikingbot.agent.loop:run:189 - Agent loop started
INFO:     Started server process [432774]
INFO:     Waiting for application startup.
2026-03-18 12:03:38.393 | INFO     | vikingbot.channels.manager:_dispatch_outbound:216 - Outbound dispatcher started
2026-03-18 12:03:38.402 | INFO     | vikingbot.channels.openapi:_setup_routes:265 - OpenAPI routes registered at root path
2026-03-18 12:03:38.402 | INFO     | vikingbot.channels.openapi:start:103 - OpenAPI channel started
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:18790 (Press CTRL+C to quit)
INFO:     127.0.0.1:44632 - "POST /bot/v1/chat/stream HTTP/1.1" 200 OK
2026-03-18 12:03:50.118 | INFO     | vikingbot.agent.loop:_process_message:426 - Processing message from type='cli' channel_id='default' chat_id='d0b12c2623f54261a54be695bed7a525':cli_user: hello
2026-03-18 12:03:50.166 | INFO     | vikingbot.agent.context:build_system_prompt:143 - [READ_USER_PROFILE]: cost 0.05s, profile=None
2026-03-18 12:03:50.544 | INFO     | vikingbot.agent.memory:get_viking_memory_context:61 - [USER_MEMORY]: search success. res: 1. User's personalized preference memories. Stores preferences by topic (communication style, code s. cost 0.34
2026-03-18 12:03:50.544 | INFO     | vikingbot.agent.context:_build_user_memory:176 - [READ_USER_MEMORY]: cost 0.38s, memory=### user memories:
1. User's personalized preferen
2026-03-18 12:03:50.662 | INFO     | vikingbot.agent.loop:_process_message:501 - Response to type='cli' channel_id='default' chat_id='d0b12c2623f54261a54be695bed7a525': Error calling LLM: litellm.BadRequestError: OpenAIException - System message must be at the beginning.

OpenViking Version

0.2.1

Python Version

3.10.20

Operating System

Linux

Model Backend

OpenAI

Additional Context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions