pygmalion 0.1.7 → 0.1.8
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/package.json +1 -1
- package/src/llm-provider.js +22 -1
- package/src/persona.js +1 -1
- package/src/web-public/app.js +2 -0
- package/src/web-public/index.html +1 -0
package/package.json
CHANGED
package/src/llm-provider.js
CHANGED
|
@@ -42,6 +42,21 @@ export function roleUsesCustomSubagentApi(role) {
|
|
|
42
42
|
return Boolean(v.apiUrl && v.apiKey && v.model);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
/** 常见多模态模型 id 特征(启发式,用于主模型未显式标记时推断视觉能力)。 */
|
|
46
|
+
const VISION_MODEL_HINTS = /vision|multimodal|omni|glm-4v|qwen-vl|-vl\b|\b4o\b/i;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 主模型是否视觉(决定主 provider route 是否声明 image 输入,主 agent 才能直接看图):
|
|
50
|
+
* 显式 `model.vision === true`(管理页开关)优先,其次模型 id 命中多模态特征(vision/4o/vl 等)。
|
|
51
|
+
*/
|
|
52
|
+
export function mainModelHasVision(role) {
|
|
53
|
+
const m = role?.model || {};
|
|
54
|
+
if (m.vision === true) return true;
|
|
55
|
+
if (m.vision === false) return false;
|
|
56
|
+
const id = typeof m.model === 'string' ? m.model.trim() : '';
|
|
57
|
+
return id.length > 0 && VISION_MODEL_HINTS.test(id);
|
|
58
|
+
}
|
|
59
|
+
|
|
45
60
|
/**
|
|
46
61
|
* subagent 视觉 API 的 route 名:显式 memeCollection.vision.provider 优先,
|
|
47
62
|
* 否则自动 `pygmalion-meme-<roleId>`(与主 provider route 独立,避免撞名)。
|
|
@@ -78,9 +93,15 @@ export async function registerRoleProvider(ctx, role, log) {
|
|
|
78
93
|
const envName = apiKeyEnvName(role.roleId);
|
|
79
94
|
try {
|
|
80
95
|
await credentials.set(envName, m.apiKey);
|
|
96
|
+
// 主模型若支持图片(显式 model.vision 或模型 id 命中多模态特征),声明 image 输入——
|
|
97
|
+
// 否则 dsh 判定主模型为纯文本,导演收不到用户图片(只能走 meme_read 兜底)。
|
|
98
|
+
const mainInput = mainModelHasVision(role) ? ['text', 'image'] : undefined;
|
|
81
99
|
await settings.update(SETTINGS_NS, {
|
|
82
100
|
providers: {
|
|
83
|
-
[route]: {
|
|
101
|
+
[route]: {
|
|
102
|
+
baseURL: m.apiUrl, api: PROVIDER_API, apiKeyEnv: envName,
|
|
103
|
+
models: [{ id: m.model, ...(mainInput ? { input: mainInput } : {}) }],
|
|
104
|
+
},
|
|
84
105
|
},
|
|
85
106
|
});
|
|
86
107
|
registered++;
|
package/src/persona.js
CHANGED
|
@@ -37,7 +37,7 @@ export function dataRoot() {
|
|
|
37
37
|
return process.env.PYGMALION_DATA?.trim() || defaultDataRoot();
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
export const DEFAULT_MODEL = { provider: '', model: 'deepseek-v4-flash' };
|
|
40
|
+
export const DEFAULT_MODEL = { provider: '', model: 'deepseek-v4-flash', vision: false };
|
|
41
41
|
export const DEFAULT_PROACTIVE = {
|
|
42
42
|
enabled: true, quietHours: [], maxWakeupsPerDay: 5,
|
|
43
43
|
lifeEnabled: true, archiveIdleMinutes: 45, eveningCheck: '20:00',
|
package/src/web-public/app.js
CHANGED
|
@@ -177,6 +177,7 @@ function openEditor(rid) {
|
|
|
177
177
|
$('#f-model').value = m.model || '';
|
|
178
178
|
$('#f-apiurl').value = m.apiUrl || '';
|
|
179
179
|
$('#f-apikey').value = m.apiKey || '';
|
|
180
|
+
$('#f-model-vision').checked = m.vision === true;
|
|
180
181
|
const pr = role?.proactive || {};
|
|
181
182
|
$('#f-proactive-enabled').checked = pr.enabled !== false;
|
|
182
183
|
$('#f-maxwake').value = pr.maxWakeupsPerDay ?? 5;
|
|
@@ -228,6 +229,7 @@ $('#role-form').addEventListener('submit', async (e) => {
|
|
|
228
229
|
model: $('#f-model').value.trim(),
|
|
229
230
|
apiUrl: $('#f-apiurl').value.trim(),
|
|
230
231
|
apiKey: $('#f-apikey').value.trim(),
|
|
232
|
+
vision: $('#f-model-vision').checked,
|
|
231
233
|
};
|
|
232
234
|
const proactive = {
|
|
233
235
|
enabled: $('#f-proactive-enabled').checked,
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
<label>model(必填) <input id="f-model" placeholder="deepseek-v4-flash"></label>
|
|
71
71
|
<label>apiUrl(选填,OpenAI 兼容接口;填了即用自定义端点) <input id="f-apiurl" placeholder="https://api.deepseek.com/v1"></label>
|
|
72
72
|
<label>apiKey(选填,配自定义 apiUrl 时必填) <input id="f-apikey" type="password" placeholder="sk-..."></label>
|
|
73
|
+
<label class="inline"><input type="checkbox" id="f-model-vision"> 支持图片输入(多模态模型;导演可直接看图,否则只能经 meme_read 兜底)</label>
|
|
73
74
|
</fieldset>
|
|
74
75
|
<fieldset>
|
|
75
76
|
<legend>主动策略</legend>
|