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: {
|
||||
sourceId: source.id,
|
||||
groupId: group.id,
|
||||
search: '',
|
||||
selection: (Array.isArray(group.skills) ? group.skills : []).map(function (skill) {
|
||||
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(
|
||||
'div',
|
||||
{ style: styles.row },
|
||||
h(
|
||||
'div',
|
||||
{ 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, {
|
||||
label: '关闭',
|
||||
variant: 'small',
|
||||
|
|
@ -2544,27 +2557,71 @@ window.__ModuleLoader__.load({
|
|||
h('p', { style: styles.hint }, '勾选要放进这个分类的技能;一个技能只会属于一个分类,取消勾选即回到「未分类」。'),
|
||||
h(
|
||||
'div',
|
||||
{ style: { display: 'flex', flexDirection: 'column', gap: '4px', maxHeight: '240px', overflow: 'auto' } },
|
||||
assignable.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) {
|
||||
{ style: { display: 'flex', gap: '8px', alignItems: 'center', flexWrap: 'wrap' } },
|
||||
h('input', {
|
||||
type: 'search',
|
||||
style: Object.assign({}, styles.input, { flex: '1 1 200px', minWidth: 0 }),
|
||||
value: assignSearch,
|
||||
placeholder: '搜索技能(按名称、目录或描述筛选)',
|
||||
'aria-label': '搜索要加入分类的技能',
|
||||
onChange: function (event) {
|
||||
patchTree({ assign: Object.assign({}, tree.assign, { search: event.target.value }) })
|
||||
},
|
||||
}),
|
||||
filteredAssignable.length > 0
|
||||
? h(Btn, {
|
||||
label: '全选当前结果',
|
||||
variant: 'small',
|
||||
disabled: tree.busy !== '',
|
||||
onClick: function () {
|
||||
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)
|
||||
filteredAssignable.forEach(function (skill) {
|
||||
if (next.indexOf(skill.folder) < 0) next.push(skill.folder)
|
||||
})
|
||||
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(
|
||||
'div',
|
||||
{ style: styles.actions },
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ export const name = 'dsh-brain';
|
|||
/** Services required before `apply` runs. */
|
||||
export const inject = ['webServer'];
|
||||
/** 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. */
|
||||
const SKILL_SYNC_INTERVAL_MS = 15 * 60_000;
|
||||
/** How often queued reports are retried. */
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import { descriptor } from "./descriptor.js";
|
|||
import { LongMemoryProvider } from "./driver.js";
|
||||
export { LongMemoryProvider, descriptor };
|
||||
/** 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({
|
||||
manifest: {
|
||||
apiVersion: MEMORY_SPACE_PROVIDER_API_VERSION,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"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.",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ export const name = 'dsh-brain'
|
|||
export const inject = ['webServer']
|
||||
|
||||
/** 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. */
|
||||
const SKILL_SYNC_INTERVAL_MS = 15 * 60_000
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import { LongMemoryProvider } from './driver.ts'
|
|||
export { LongMemoryProvider, descriptor }
|
||||
|
||||
/** 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({
|
||||
manifest: {
|
||||
|
|
|
|||
|
|
@ -483,8 +483,11 @@ check('clicking the import button reveals foreign sources as import candidates',
|
|||
openedImport.includes('Codex') && openedImport.includes('收起') && !openedImport.includes('仅本卡'))
|
||||
|
||||
const openedAssign = await drive('skills', true, '把技能加入 QQ-Skill')
|
||||
check('clicking + on a category opens the inline skill assignment picker',
|
||||
openedAssign.includes('加入分类:QQ-Skill') && openedAssign.includes('保存分类') && openedAssign.includes('parked-one'))
|
||||
check('clicking + on a category opens the inline skill assignment picker with search',
|
||||
openedAssign.includes('加入分类:QQ-Skill') &&
|
||||
openedAssign.includes('全选当前结果') &&
|
||||
openedAssign.includes('保存分类') &&
|
||||
openedAssign.includes('parked-one'))
|
||||
|
||||
// Categories start collapsed; expanding one must reveal its skills.
|
||||
const expandedSkills = await drive('skills', true, '展开或收起 未分类')
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ async function post(path, body) {
|
|||
}
|
||||
|
||||
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 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')
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ for (const name of readdirSync(libDir)) {
|
|||
}
|
||||
check('no personal domain remains in shipped lib/', leaked.length === 0, leaked.join(','))
|
||||
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
|
||||
console.log(`\n${passed}/${results.length} passed`)
|
||||
|
|
|
|||
Loading…
Reference in New Issue