yuanflow-cli 0.1.31 → 0.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/package.json +1 -1
- package/skills/yuanflow-skill//345/205/254/344/274/227/345/217/267/347/224/237/346/210/220/344/270/216/345/217/221/345/270/203/SKILL.md +7 -0
- package/skills/yuanflow-skill//345/205/254/344/274/227/345/217/267/347/224/237/346/210/220/344/270/216/345/217/221/345/270/203/scripts/wechat_format.py +52 -2
- package/skills/yuanflow-skill//347/224/237/345/233/276/346/212/200/350/203/275/SKILL.md +7 -0
package/README.md
CHANGED
|
@@ -214,6 +214,7 @@ yuanflow-cli browser dry-run --platform xiaohongshu --task publish --account mai
|
|
|
214
214
|
- 生成图片:`/v1/images/generations`,主模型 `gpt-image-2-c`,备用模型 `gpt-image-2`,请求体使用 `prompt`。
|
|
215
215
|
- 编辑图片:`/v1/images/edits`,必须使用 multipart/form-data 上传本地图片文件。
|
|
216
216
|
- `gpt-image-2-c` 通常返回 URL,`gpt-image-2` 通常返回 `b64_json`;两种返回都应缓存后再展示。
|
|
217
|
+
- 中文用户或中文任务默认使用中文语境生图;如果画面必须出现文字,提示词应明确要求清晰简体中文。正文配图优先要求无文字、无字母、无 Logo、无水印,避免生成英文占位内容。
|
|
217
218
|
- 生成图片必填参数:`prompt`。可选参数:`size`(默认 `1024x1024`)、`quality`(默认 `standard`)、`style`(默认 `vivid`)、`n`(默认 `1`,范围 `1~10`)、`response_format`(默认 `url`)。
|
|
218
219
|
- 编辑图片除 `prompt` 外还必须上传本地图片文件,Skill 内使用 `image_path` 表示本地文件路径,实际请求以 `multipart/form-data` 的 `image` 字段上传。
|
|
219
220
|
|
package/package.json
CHANGED
|
@@ -63,6 +63,13 @@ Agent 在排版前应做结构化增强,但不能改变事实:
|
|
|
63
63
|
- 用户要求生成插图:调用 `生图技能` 生成图片,使用工具返回的本地缓存路径插入 Markdown。
|
|
64
64
|
- 用户只要求封面:只生成或使用封面,不在正文里额外插图。
|
|
65
65
|
|
|
66
|
+
生成公众号正文插图时必须遵守中文默认规则:
|
|
67
|
+
|
|
68
|
+
- 中文公众号文章默认生成中文语境图片。生图提示词必须写明:画面中如出现文字、标签、标题、图表标注,全部使用清晰简体中文。
|
|
69
|
+
- 正文配图优先选择“无文字、无字母、无 Logo、无水印”的视觉图,避免生成英文占位内容。
|
|
70
|
+
- 如果文章段落确实需要图中文字,只允许使用与文章一致的简体中文短句,并明确列出具体中文文字。
|
|
71
|
+
- 除非用户明确要求英文或双语,不要在正文插图、封面图或预览图里生成英文。
|
|
72
|
+
|
|
66
73
|
推送草稿箱时使用 `scripts/wechat_draft.py`:
|
|
67
74
|
|
|
68
75
|
```bash
|
|
@@ -140,14 +140,64 @@ def build_theme_gallery(markdown: str, title: str, *, limit: int = 20) -> dict[s
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
|
|
143
|
+
def _inline_style(styles: dict[str, Any], key: str, fallback: dict[str, str]) -> str:
|
|
144
|
+
configured = styles.get(key)
|
|
145
|
+
return _style(configured if isinstance(configured, dict) else fallback)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def _render_inline(text: str, styles: dict[str, Any]) -> str:
|
|
149
|
+
pattern = re.compile(
|
|
150
|
+
r"(`([^`]+)`|\*\*([^*\n]+)\*\*|__([^_\n]+)__|\*([^*\n]+)\*|_([^_\n]+)_|\[([^\]]+)\]\(([^)]+)\))"
|
|
151
|
+
)
|
|
152
|
+
output: list[str] = []
|
|
153
|
+
last = 0
|
|
154
|
+
for match in pattern.finditer(text):
|
|
155
|
+
output.append(html.escape(text[last : match.start()]))
|
|
156
|
+
code_text = match.group(2)
|
|
157
|
+
strong_text = match.group(3) or match.group(4)
|
|
158
|
+
emphasis_text = match.group(5) or match.group(6)
|
|
159
|
+
link_text = match.group(7)
|
|
160
|
+
link_href = match.group(8)
|
|
161
|
+
if code_text is not None:
|
|
162
|
+
style = _inline_style(
|
|
163
|
+
styles,
|
|
164
|
+
"inline_code",
|
|
165
|
+
{
|
|
166
|
+
"font_family": "Menlo,Consolas,monospace",
|
|
167
|
+
"background_color": "rgba(15,23,42,0.08)",
|
|
168
|
+
"border_radius": "4px",
|
|
169
|
+
"padding": "1px 4px",
|
|
170
|
+
},
|
|
171
|
+
)
|
|
172
|
+
output.append(f'<code style="{style}">{html.escape(code_text)}</code>')
|
|
173
|
+
elif strong_text is not None:
|
|
174
|
+
style = _inline_style(styles, "strong", {"font_weight": "700"})
|
|
175
|
+
output.append(f'<strong style="{style}">{html.escape(strong_text)}</strong>')
|
|
176
|
+
elif emphasis_text is not None:
|
|
177
|
+
style = _inline_style(styles, "em", {"font_style": "italic"})
|
|
178
|
+
output.append(f'<em style="{style}">{html.escape(emphasis_text)}</em>')
|
|
179
|
+
elif link_text is not None and link_href is not None:
|
|
180
|
+
style = _inline_style(
|
|
181
|
+
styles,
|
|
182
|
+
"a",
|
|
183
|
+
{"color": "#2563eb", "text_decoration": "underline"},
|
|
184
|
+
)
|
|
185
|
+
output.append(
|
|
186
|
+
f'<a href="{html.escape(link_href)}" style="{style}">{html.escape(link_text)}</a>'
|
|
187
|
+
)
|
|
188
|
+
last = match.end()
|
|
189
|
+
output.append(html.escape(text[last:]))
|
|
190
|
+
return "".join(output)
|
|
191
|
+
|
|
192
|
+
|
|
143
193
|
def _paragraph(text: str, styles: dict[str, Any]) -> str:
|
|
144
|
-
return f'<p style="{_style(styles.get("p", {}))}">{
|
|
194
|
+
return f'<p style="{_style(styles.get("p", {}))}">{_render_inline(text, styles)}</p>'
|
|
145
195
|
|
|
146
196
|
|
|
147
197
|
def _render_list(items: list[str], ordered: bool, styles: dict[str, Any]) -> str:
|
|
148
198
|
tag = "ol" if ordered else "ul"
|
|
149
199
|
li_style = _style(styles.get("li", styles.get("p", {})))
|
|
150
|
-
rendered = "".join(f'<li style="{li_style}">{
|
|
200
|
+
rendered = "".join(f'<li style="{li_style}">{_render_inline(item, styles)}</li>' for item in items)
|
|
151
201
|
return f'<{tag} style="{_style(styles.get(tag, {}))}">{rendered}</{tag}>'
|
|
152
202
|
|
|
153
203
|
|
|
@@ -19,6 +19,13 @@ description: 当用户要求生成图片、画图、出图、制作海报或视
|
|
|
19
19
|
- 不要主动加入案例中的真实品牌、真实人物、个人签名、Logo、水印或作者标识。
|
|
20
20
|
- 中文海报、信息图、社交截图等含文字场景,需要明确要求文字清晰、简体中文、不乱码、层级正确。
|
|
21
21
|
|
|
22
|
+
## 默认语言规则
|
|
23
|
+
|
|
24
|
+
- 中文用户或中文任务默认按中文视觉内容处理,提示词必须明确“画面中如出现文字、标签、标题、按钮、图表标注,全部使用清晰简体中文”。
|
|
25
|
+
- 除非用户明确要求英文、双语或其它语言,不要生成英文标题、英文标签、英文 UI 文案或英文图表标注。
|
|
26
|
+
- 如果图片只是正文插图、配图、氛围图,优先要求“无文字、无字母、无 Logo、无水印”,避免模型自行生成英文占位字。
|
|
27
|
+
- 如果必须包含文字,文字内容应短、少、准确,并在提示词里逐条写出要出现的中文文字。
|
|
28
|
+
|
|
22
29
|
## YuanFlow 内置环境
|
|
23
30
|
|
|
24
31
|
如果当前 Agent 可用 `yuanflow_image_request`,优先使用该受控工具。它会自动注入当前用户 token,并把接口返回的 URL 或 base64 图片缓存为可预览资源。
|