adjust system prompt
Project CI / Native shell checks (pull_request) Successful in 4m41s
Project CI / Repository checks (pull_request) Failing after 29s
Project CI / Backend checks (pull_request) Failing after 38s

This commit is contained in:
2026-07-21 20:28:52 +08:00
parent 9949e8d06b
commit be3fe47187
5 changed files with 14 additions and 9 deletions
@@ -157,9 +157,9 @@ pub async fn editor_agent_message(
let now = now_rfc3339();
if !attachments.is_empty() {
let mut attachment_info = String::new();
attachment_info.push_str("user has just uploaded attachments of the order: ");
for attachment in &attachments {
attachment_info.push_str(&format!("{} ,", attachment.clone().into_image_id()));
attachment_info.push_str("user added these image ids to context: ");
for (i,attachment) in attachments.iter().enumerate() {
attachment_info.push_str(&format!("[{i}]: {}, ", attachment.clone().into_image_id()));
}
document.messages.push(EditorAgentMessage {
id: document.messages.len(),
@@ -625,8 +625,13 @@ mod tests {
}
fn editor_agent_system_prompt() -> &'static str {
r#"
你是 Genarrative 图片画布 Agent,只负责帮助用户理解、规划和触发画布生成工具。
对话回复要简短,不能承诺免费生成;实际生成工具由后端按模型定价扣泥点。
* image_id str format is like: sha256:*
* when user referenced/uploaded image, a system message will notify you the image id(s).
YOU MUST USE THESE IMAGE IDs(or more from former context) IN YOUR TOOL CALLS.(or why user upload them?)
* 用户所说的 规范图/参考图/生成的图/... 没有本质区别,all can be some image_id
* 实际生成工具由后端按模型定价扣泥点, 不能承诺免费生成
你是 Genarrative 图片画布 Agent,负责帮助用户理解、规划和触发画布生成工具. 对话回复要简短.
"#
}
@@ -47,7 +47,7 @@ impl Tool for GenerateCharacterTool {
"properties": {
"prompt": { "type": "string", "description": "角色外貌、服装、姿势、画风和构图的完整描述。" },
"model": image_model_parameter_schema(),
"reference_image_ids": { "type": "array", "items": { "type": "string" }, "description": "可选角色或画风参考图 ID。" },
"reference_image_ids": { "type": "array", "items": { "type": "string" }, "description": "image_id(s) for desc 角色或画风" },
"aspect_ratio": image_aspect_ratio_parameter_schema(),
"image_size": image_size_parameter_schema(),
},
@@ -126,7 +126,7 @@ impl Tool for GenerateIconSpritesheetTool {
"properties": {
"reference_image_id": { "type": "string", "description": "必填的图标规范或风格参考图 ID。" },
"model": image_model_parameter_schema(),
"reference_image_ids": { "type": "array", "items": { "type": "string" }, "description": "可选的额外参考图 ID。" },
"reference_image_ids": { "type": "array", "items": { "type": "string" }, "description": "image_id(s) for desc" },
"icon_descriptions": { "type": "array", "items": { "type": "string" }, "minItems": 1, "maxItems": GenerateIconSpritesheetTool::MAX_ICON_DESCRIPTIONS, "description": "要生成的多个图标描述,数量必须在 1 到 100 个之间。" },
"aspect_ratio": image_aspect_ratio_parameter_schema(),
"image_size": image_size_parameter_schema()
@@ -106,7 +106,7 @@ impl Tool for GenerateImageTool {
"reference_image_ids": {
"type": "array",
"items": { "type": "string" },
"description": "可选参考图 ID 列表,用于提供画风或元素参考"
"description": "image_id(s) for desc 画风或元素。"
},
"aspect_ratio": image_aspect_ratio_parameter_schema(),
"image_size": image_size_parameter_schema()
@@ -55,7 +55,7 @@ impl Tool for GenerateUiDesignTool {
"default": GPT_IMAGE_2_MODEL,
"description": "UI 设计图固定使用 gpt-image-2。"
},
"reference_image_ids": { "type": "array", "items": { "type": "string" }, "description": "可选 UI 风格或布局参考图 ID。" },
"reference_image_ids": { "type": "array", "items": { "type": "string" }, "description": "image_id(s) for desc UI 风格或布局" },
"aspect_ratio": image_aspect_ratio_parameter_schema(),
"image_size": image_size_parameter_schema()
},