Repository navigation
feat(composer): show the skills a person types most above the input - #74
Merged
Merged
Conversation
A chip row above the composer lists up to five skills the person called with /name in this bot's threads, most used first. A chip puts the call at the start of the draft, or right after a built-in command such as /learn.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
A chip row above the composer lists the skills the person calls most with
/namein this bot's threads, up to five, most used first. A chip puts/nameinto the draft and returns focus to the input. Nothing is sent.server/index.tsdoes not callexpandSkillCommandfor it) is not counted.useFrequentSkillsfetches when the bot or thread changes and when the newest/line of the thread changes. The existing/menu hook (useSlashSkills) is untouched, so that menu keeps refreshing each time it opens..ui-pill, horizontal scroll, each chip at most14remwith an ellipsis. No history, or every used skill disabled: no row is drawn. Same place in Simple and Advanced mode and on the phone layout. Rooms and the locked composer show nothing.server/routes/bot-skills.ts:GET /skillsand the new route share onebotSkillslist builder and oneaskedThreadcheck (the thread names a folder on disk, so only a thread of this bot may pick it). The/skillsresponse has the same keys as before.typedSlashLinesis inserver/message-db-typed-lines.ts, next tomessage-db-attention.ts, becauseserver/message-db.tsis exactly 1,000 lines and the size ratchet does not let it grow.composer.frequentSkills.ariais added in English and Korean. The other languages fall back to English, whichi18n:checkallows.server/routes/bot-skills.test.tsonly gets the two new route deps in its three constructor calls so it compiles.Why
Typing
/and scrolling a menu of every skill is slow for the two or three a person uses all the time. The person asked for their frequently used skills at the top of the input.How it was verified
Isolated fixture (
scripts/control-omb.ts launch, fake engine), Vite on top of it, the built-in browser. Pepper has seven skills installed (fable-deslopdisabled) and a history of typed/skilllines.Before (
origin/main1abb463, same fixture, same conversation): no row above the composer.After (this branch): five chips, most used first, the long name cut with an ellipsis, one line.
typedSlashLinesagainst a scratch database, one thread, ten lines (OMB_DATA_DIRset to a temp folder):Draft handling in the browser, same fixture:
/mobpool/mobpool/socratic-tutor(click/socratic-tutoragain)/learn make a skill from this/learn /mobpool make a skill from this/mobpoolA room (group chat) with the same bots has no chip row (0
[data-frequent-skills]nodes). The row is one line of 28 px at 390 and 760 px wide, withscrollWidth748 andoverflow-x: auto.Checks:
pnpm typecheckpasses.oxlint --deny-warnings server srcpasses.pnpm i18n:check: locale catalogs valid.bot-skills,composer-commands,Composer.*,message-db,src/locales/(including the vocabulary guard) and the static job's ratchets (file-size,index-route,store-read,tighten-ratchets,comment-history,lazy-server-modules, copy-text and Select guards): 178 passed, 3 todo.json_eachjoin on themessages_threadindex): 19 ms median for the biggest bot (581 threads, 23,369 rows), under 10 ms for the others. The route reads the skills folder only when there is a count to match.Not verified:
use plantuml-skill) is not counted. That is on purpose: only a/namecall is a signal that the person ran it./skillcalls are rare (about one a day across all bots on the owner's machine), so most bots show zero to two chips at first./line. The chip then calls a skill that is off./nameis unknown, so a chip clicked in a goal draft may not run the skill.Found while verifying, not changed here: the
/menu and the chips also offer a skill while the bot is working, but a message sent then is a steer and a steer does not expand skills.Merge danger
Door: two-way. It adds a read-only route and a row in the composer, and writes nothing. Revert the PR, or drop the
FrequentSkillChipsline inComposer.tsx.Blast radius: every one-to-one composer. The new
GETreads person-typed lines of the bot's own threads, only those the viewer may see, and on a shared place only the viewer's own lines. A failed request leaves the row empty.