feat(skills): add search filter and select-all in category + assignment picker (0.9.3)
This commit is contained in:
parent
03e78d95d8
commit
3d23769899
|
|
@ -1766,6 +1766,7 @@ window.__ModuleLoader__.load({
|
||||||
assign: {
|
assign: {
|
||||||
sourceId: source.id,
|
sourceId: source.id,
|
||||||
groupId: group.id,
|
groupId: group.id,
|
||||||
|
search: '',
|
||||||
selection: (Array.isArray(group.skills) ? group.skills : []).map(function (skill) {
|
selection: (Array.isArray(group.skills) ? group.skills : []).map(function (skill) {
|
||||||
return skill.folder
|
return skill.folder
|
||||||
}),
|
}),
|
||||||
|
|
@ -2526,13 +2527,25 @@ window.__ModuleLoader__.load({
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
var assignSearch = String(tree.assign.search === undefined ? '' : tree.assign.search)
|
||||||
|
var assignNeedle = assignSearch.trim().toLowerCase()
|
||||||
|
var filteredAssignable = assignNeedle === ''
|
||||||
|
? assignable
|
||||||
|
: assignable.filter(function (skill) {
|
||||||
|
var hay = (String(skill.name || '') + ' ' + String(skill.folder || '') + ' ' + String(skill.description || '')).toLowerCase()
|
||||||
|
return hay.indexOf(assignNeedle) >= 0
|
||||||
|
})
|
||||||
assignBox = h(
|
assignBox = h(
|
||||||
'div',
|
'div',
|
||||||
{ style: styles.row },
|
{ style: styles.row },
|
||||||
h(
|
h(
|
||||||
'div',
|
'div',
|
||||||
{ style: styles.rowHead },
|
{ style: styles.rowHead },
|
||||||
h('span', { style: styles.rowTitle }, '加入分类:' + String(assignGroup === undefined ? '' : assignGroup.name)),
|
h(
|
||||||
|
'span',
|
||||||
|
{ style: styles.rowTitle },
|
||||||
|
'加入分类:' + String(assignGroup === undefined ? '' : assignGroup.name) + '(已选 ' + String(tree.assign.selection.length) + ' 项)',
|
||||||
|
),
|
||||||
h(Btn, {
|
h(Btn, {
|
||||||
label: '关闭',
|
label: '关闭',
|
||||||
variant: 'small',
|
variant: 'small',
|
||||||
|
|
@ -2544,27 +2557,71 @@ window.__ModuleLoader__.load({
|
||||||
h('p', { style: styles.hint }, '勾选要放进这个分类的技能;一个技能只会属于一个分类,取消勾选即回到「未分类」。'),
|
h('p', { style: styles.hint }, '勾选要放进这个分类的技能;一个技能只会属于一个分类,取消勾选即回到「未分类」。'),
|
||||||
h(
|
h(
|
||||||
'div',
|
'div',
|
||||||
{ style: { display: 'flex', flexDirection: 'column', gap: '4px', maxHeight: '240px', overflow: 'auto' } },
|
{ style: { display: 'flex', gap: '8px', alignItems: 'center', flexWrap: 'wrap' } },
|
||||||
assignable.map(function (skill) {
|
h('input', {
|
||||||
var checked = tree.assign.selection.indexOf(skill.folder) >= 0
|
type: 'search',
|
||||||
return h(
|
style: Object.assign({}, styles.input, { flex: '1 1 200px', minWidth: 0 }),
|
||||||
'label',
|
value: assignSearch,
|
||||||
{ key: String(skill.folder), style: styles.checkboxRow },
|
placeholder: '搜索技能(按名称、目录或描述筛选)',
|
||||||
h('input', {
|
'aria-label': '搜索要加入分类的技能',
|
||||||
type: 'checkbox',
|
onChange: function (event) {
|
||||||
checked: checked,
|
patchTree({ assign: Object.assign({}, tree.assign, { search: event.target.value }) })
|
||||||
onChange: function (event) {
|
},
|
||||||
|
}),
|
||||||
|
filteredAssignable.length > 0
|
||||||
|
? h(Btn, {
|
||||||
|
label: '全选当前结果',
|
||||||
|
variant: 'small',
|
||||||
|
disabled: tree.busy !== '',
|
||||||
|
onClick: function () {
|
||||||
var next = tree.assign.selection.slice()
|
var next = tree.assign.selection.slice()
|
||||||
var at = next.indexOf(skill.folder)
|
filteredAssignable.forEach(function (skill) {
|
||||||
if (event.target.checked && at < 0) next.push(skill.folder)
|
if (next.indexOf(skill.folder) < 0) next.push(skill.folder)
|
||||||
if (!event.target.checked && at >= 0) next.splice(at, 1)
|
})
|
||||||
patchTree({ assign: Object.assign({}, tree.assign, { selection: next }) })
|
patchTree({ assign: Object.assign({}, tree.assign, { selection: next }) })
|
||||||
},
|
},
|
||||||
}),
|
})
|
||||||
h('span', { style: { minWidth: 0 } }, String(skill.name) + ' ', h('span', { style: styles.hint }, '· ' + String(skill.folder))),
|
: null,
|
||||||
)
|
assignSearch !== ''
|
||||||
}),
|
? h(Btn, {
|
||||||
|
label: '清空搜索',
|
||||||
|
variant: 'small',
|
||||||
|
onClick: function () {
|
||||||
|
patchTree({ assign: Object.assign({}, tree.assign, { search: '' }) })
|
||||||
|
},
|
||||||
|
})
|
||||||
|
: null,
|
||||||
),
|
),
|
||||||
|
filteredAssignable.length === 0
|
||||||
|
? h('p', { style: styles.hint }, assignable.length === 0 ? '当前来源还没有可分配的技能。' : '没有匹配「' + assignSearch + '」的技能。')
|
||||||
|
: h(
|
||||||
|
'div',
|
||||||
|
{ style: { display: 'flex', flexDirection: 'column', gap: '4px', maxHeight: '240px', overflow: 'auto' } },
|
||||||
|
filteredAssignable.map(function (skill) {
|
||||||
|
var checked = tree.assign.selection.indexOf(skill.folder) >= 0
|
||||||
|
return h(
|
||||||
|
'label',
|
||||||
|
{ key: String(skill.folder), style: styles.checkboxRow },
|
||||||
|
h('input', {
|
||||||
|
type: 'checkbox',
|
||||||
|
checked: checked,
|
||||||
|
onChange: function (event) {
|
||||||
|
var next = tree.assign.selection.slice()
|
||||||
|
var at = next.indexOf(skill.folder)
|
||||||
|
if (event.target.checked && at < 0) next.push(skill.folder)
|
||||||
|
if (!event.target.checked && at >= 0) next.splice(at, 1)
|
||||||
|
patchTree({ assign: Object.assign({}, tree.assign, { selection: next }) })
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
h(
|
||||||
|
'span',
|
||||||
|
{ style: { minWidth: 0 } },
|
||||||
|
String(skill.name) + ' ',
|
||||||
|
h('span', { style: styles.hint }, '· ' + String(skill.folder) + (skill.description ? ' · ' + String(skill.description) : '')),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}),
|
||||||
|
),
|
||||||
h(
|
h(
|
||||||
'div',
|
'div',
|
||||||
{ style: styles.actions },
|
{ style: styles.actions },
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ export const name = 'dsh-brain';
|
||||||
/** Services required before `apply` runs. */
|
/** Services required before `apply` runs. */
|
||||||
export const inject = ['webServer'];
|
export const inject = ['webServer'];
|
||||||
/** Version reported by the status card. */
|
/** Version reported by the status card. */
|
||||||
const VERSION = '0.9.2';
|
const VERSION = '0.9.3';
|
||||||
/** How often the skill directory is reconciled with the cloud center. */
|
/** How often the skill directory is reconciled with the cloud center. */
|
||||||
const SKILL_SYNC_INTERVAL_MS = 15 * 60_000;
|
const SKILL_SYNC_INTERVAL_MS = 15 * 60_000;
|
||||||
/** How often queued reports are retried. */
|
/** How often queued reports are retried. */
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ import { descriptor } from "./descriptor.js";
|
||||||
import { LongMemoryProvider } from "./driver.js";
|
import { LongMemoryProvider } from "./driver.js";
|
||||||
export { LongMemoryProvider, descriptor };
|
export { LongMemoryProvider, descriptor };
|
||||||
/** Keep in sync with the package version (asserted by the verify script). */
|
/** Keep in sync with the package version (asserted by the verify script). */
|
||||||
const PROVIDER_VERSION = '0.9.2';
|
const PROVIDER_VERSION = '0.9.3';
|
||||||
export const definition = defineMemorySpaceProviderDefinition({
|
export const definition = defineMemorySpaceProviderDefinition({
|
||||||
manifest: {
|
manifest: {
|
||||||
apiVersion: MEMORY_SPACE_PROVIDER_API_VERSION,
|
apiVersion: MEMORY_SPACE_PROVIDER_API_VERSION,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "dsh-brain",
|
"name": "dsh-brain",
|
||||||
"version": "0.9.2",
|
"version": "0.9.3",
|
||||||
"description": "Cloud memory for DSH: report one activity turn per conversation round and expose memory_search / memory_read / memory_add tools against a LongMemory cloud endpoint.",
|
"description": "Cloud memory for DSH: report one activity turn per conversation round and expose memory_search / memory_read / memory_add tools against a LongMemory cloud endpoint.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ export const name = 'dsh-brain'
|
||||||
export const inject = ['webServer']
|
export const inject = ['webServer']
|
||||||
|
|
||||||
/** Version reported by the status card. */
|
/** Version reported by the status card. */
|
||||||
const VERSION = '0.9.2'
|
const VERSION = '0.9.3'
|
||||||
|
|
||||||
/** How often the skill directory is reconciled with the cloud center. */
|
/** How often the skill directory is reconciled with the cloud center. */
|
||||||
const SKILL_SYNC_INTERVAL_MS = 15 * 60_000
|
const SKILL_SYNC_INTERVAL_MS = 15 * 60_000
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import { LongMemoryProvider } from './driver.ts'
|
||||||
export { LongMemoryProvider, descriptor }
|
export { LongMemoryProvider, descriptor }
|
||||||
|
|
||||||
/** Keep in sync with the package version (asserted by the verify script). */
|
/** Keep in sync with the package version (asserted by the verify script). */
|
||||||
const PROVIDER_VERSION = '0.9.2'
|
const PROVIDER_VERSION = '0.9.3'
|
||||||
|
|
||||||
export const definition = defineMemorySpaceProviderDefinition({
|
export const definition = defineMemorySpaceProviderDefinition({
|
||||||
manifest: {
|
manifest: {
|
||||||
|
|
|
||||||
|
|
@ -483,8 +483,11 @@ check('clicking the import button reveals foreign sources as import candidates',
|
||||||
openedImport.includes('Codex') && openedImport.includes('收起') && !openedImport.includes('仅本卡'))
|
openedImport.includes('Codex') && openedImport.includes('收起') && !openedImport.includes('仅本卡'))
|
||||||
|
|
||||||
const openedAssign = await drive('skills', true, '把技能加入 QQ-Skill')
|
const openedAssign = await drive('skills', true, '把技能加入 QQ-Skill')
|
||||||
check('clicking + on a category opens the inline skill assignment picker',
|
check('clicking + on a category opens the inline skill assignment picker with search',
|
||||||
openedAssign.includes('加入分类:QQ-Skill') && openedAssign.includes('保存分类') && openedAssign.includes('parked-one'))
|
openedAssign.includes('加入分类:QQ-Skill') &&
|
||||||
|
openedAssign.includes('全选当前结果') &&
|
||||||
|
openedAssign.includes('保存分类') &&
|
||||||
|
openedAssign.includes('parked-one'))
|
||||||
|
|
||||||
// Categories start collapsed; expanding one must reveal its skills.
|
// Categories start collapsed; expanding one must reveal its skills.
|
||||||
const expandedSkills = await drive('skills', true, '展开或收起 未分类')
|
const expandedSkills = await drive('skills', true, '展开或收起 未分类')
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ async function post(path, body) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const caps = await get('/dsh-brain/capabilities')
|
const caps = await get('/dsh-brain/capabilities')
|
||||||
check('capabilities answers with 0.9.2', caps.body?.version === '0.9.2', String(caps.body?.version))
|
check('capabilities answers with 0.9.3', caps.body?.version === '0.9.3', String(caps.body?.version))
|
||||||
check('P3 market is advertised with one provider', caps.body?.features?.skillsMarketplace === true && caps.body?.features?.marketProviders === 1)
|
check('P3 market is advertised with one provider', caps.body?.features?.skillsMarketplace === true && caps.body?.features?.marketProviders === 1)
|
||||||
check('P3 update and sync-resolve are advertised', caps.body?.features?.skillUpdate === true && caps.body?.features?.syncResolve === true)
|
check('P3 update and sync-resolve are advertised', caps.body?.features?.skillUpdate === true && caps.body?.features?.syncResolve === true)
|
||||||
check('P4/P5/v1.1 flags are advertised', caps.body?.features?.multiClient === true && caps.body?.features?.brainMigration === 'ready')
|
check('P4/P5/v1.1 flags are advertised', caps.body?.features?.multiClient === true && caps.body?.features?.brainMigration === 'ready')
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ for (const name of readdirSync(libDir)) {
|
||||||
}
|
}
|
||||||
check('no personal domain remains in shipped lib/', leaked.length === 0, leaked.join(','))
|
check('no personal domain remains in shipped lib/', leaked.length === 0, leaked.join(','))
|
||||||
const pkg = JSON.parse(readFileSync(join(process.cwd(), 'package.json'), 'utf8'))
|
const pkg = JSON.parse(readFileSync(join(process.cwd(), 'package.json'), 'utf8'))
|
||||||
check('package version is the delivery version', pkg.version === '0.9.2', pkg.version)
|
check('package version is the delivery version', pkg.version === '0.9.3', pkg.version)
|
||||||
|
|
||||||
const passed = results.filter((r) => r.ok).length
|
const passed = results.filter((r) => r.ok).length
|
||||||
console.log(`\n${passed}/${results.length} passed`)
|
console.log(`\n${passed}/${results.length} passed`)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue