Skip to content

[BUG] chatbot里面无法动态管理prompt #3996

@zhuxingsheng

Description

@zhuxingsheng

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

版本:1.1.0.0-RC2

项目使用实现chatbot,结合spring-ai-alibaba-admin动态管理prompt

依赖项:
spring-ai-alibaba-studio
spring-ai-alibaba-starter-config-nacos

`protected void registryPrompt(NacosOptions nacosOptions, ReactAgent reactAgent, ObservationMetadataAwareOptions observationMetadataAwareOptions, String promptKey) {

	Listener listener = new AbstractListener() {
		@Override
		public void receiveConfigInfo(String configInfo) {
			PromptVO promptVO = JSON.parseObject(configInfo, PromptVO.class);
			try {
				Map<String, String> metadata = getMetadata(promptVO);
				observationMetadataAwareOptions.getObservationMetadata().putAll(metadata);
				reactAgent.setInstruction(promptVO.getTemplate());
			}
			catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
	};`

动态更新的instruction属性,但在ExecutionController.executeAgent 方法中,调用的是agent.stream方法,并没有使用到instruction属性

@Aias00 提醒,其实在AgentToSubCompiledGraphNodeAdapter中是有完整的instruction属性的使用的。但agent.stream中缺失了这段逻辑

Expected Behavior

No response

Steps To Reproduce

No response

Environment

Spring AI Alibaba version(s):

Debug logs

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions