fix(ai): lisibilite des modeles + contexte @ en mode General (BUG-010, BUG-011)
BUG-011: popover des modeles aligne a droite (right:0), largeur 340px bornee, noms sur plusieurs lignes + title. BUG-010: la selection @ capture le vault renvoye par tree-search et _contextVault() le propage aux requetes /context et /chat, corrigeant le contexte ad-hoc en mode General.
This commit is contained in:
@@ -760,6 +760,41 @@ async function main() {
|
||||
b._panel.remove();
|
||||
});
|
||||
|
||||
// ── 35b. `@` captures the vault for General-mode ad-hoc context (BUG-010) ──
|
||||
await test("mention selection stores its vault and feeds the context request", async () => {
|
||||
localStorage.clear();
|
||||
globalThis.fetch = async (url) => {
|
||||
if (String(url).includes("/api/tree-search")) {
|
||||
return {
|
||||
ok: true, status: 200,
|
||||
json: async () => ({ results: [{ vault: "TestVault", path: "notes/a.md", type: "file" }] }),
|
||||
};
|
||||
}
|
||||
return { ok: true, status: 200, json: async () => ({}) };
|
||||
};
|
||||
const b = new BooksLM();
|
||||
b._panel = b._render();
|
||||
document.body.appendChild(b._panel);
|
||||
b._mode = MODE.GENERAL;
|
||||
b._vault = null;
|
||||
|
||||
await b._showMentionMenu("notes");
|
||||
b._selectMention({ id: "notes/a.md", type: "file", vault: "TestVault" });
|
||||
assert.equal(b._adhocFiles[0].vault, "TestVault", "ad-hoc entry keeps its vault");
|
||||
assert.equal(b._contextVault(), "TestVault", "context vault derives from the ad-hoc entry");
|
||||
|
||||
let posted = null;
|
||||
globalThis.fetch = async (url, opts) => {
|
||||
if (String(url).includes("/api/ai/bookslm/context")) posted = JSON.parse(opts.body);
|
||||
return { ok: true, status: 200, json: async () => ({ files: [], scope: "documents" }) };
|
||||
};
|
||||
await b._loadContext();
|
||||
assert.equal(posted.vault, "TestVault", "context request carries the vault");
|
||||
assert.deepEqual(posted.extra_files, ["notes/a.md"]);
|
||||
b._panel.remove();
|
||||
localStorage.clear();
|
||||
});
|
||||
|
||||
// ── 36. Capability checklist rendering (#81) ──
|
||||
await test("capability list renders checked and unchecked flags", () => {
|
||||
const caps = {
|
||||
|
||||
Reference in New Issue
Block a user