Conversation
…/20260303175537479_r_release_1003870_meow-agent-code
更新了`getEffectiveContent()`方法,使其能够将`content`字段和从`artifact.code`生成的内容进行拼接,而不是简单地返回其中一个值。这样可以更好地整合经验的不同部分,提供更完整的信息。 Co-developed-by: Aone Copilot <noreply@alibaba-inc.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the Experience domain model’s “effective content” assembly to combine user-authored content with code-derived content from artifact.code, so downstream prompt injection can include both sources when available.
Changes:
- Refactored
Experience#getEffectiveContent()to appendcontentfirst (if present), then append content generated fromartifact.code(if present), separated by a blank line. - Updated the Javadoc for
getEffectiveContent()to reflect the new merge behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (codeArtifact.getCode() != null && !codeArtifact.getCode().isBlank()) { | ||
| return buildContentFromCodeArtifact(codeArtifact); | ||
| if (!result.isEmpty()) { | ||
| result.append("\n\n"); | ||
| } | ||
| result.append(buildContentFromCodeArtifact(codeArtifact)); |
There was a problem hiding this comment.
getEffectiveContent() currently concatenates content and the generated artifact.code block whenever both are present. If existing data already stores the generated block in content (or overlaps heavily), this will duplicate the same guidance and contradict the PR description (“less redundant output”). Consider normalizing and de-duplicating before appending (e.g., compare trimmed/normalized strings, or skip appending when content already contains the generated block). Also consider trimming trailing newlines from content so the \n\n separator doesn’t accidentally introduce multiple blank lines.
This pull request refactors the logic for generating effective content in the
Experiencemodel to improve how content is assembled from multiple sources. Instead of returning eithercontentor the generated code artifact, the method now merges both if available, ensuring more comprehensive and less redundant output.Content merging logic improvements:
getEffectiveContentmethod inExperience.javanow concatenates bothcontentand the generated content fromartifact.codeif both are present, separated by a blank line, instead of returning only one or the other. This reduces redundancy and ensures all relevant information is included.