Repository navigation
Attach files and images, search the web, and ask for the user's name - #25
Merged
Merged
Conversation
Attachments - New POST /v1/attachments reads uploaded files (nothing is stored): text from PDF, Office Open XML, OpenDocument, EPUB, HTML, RTF, notebooks and anything that decodes as text; images are converted to a resized JPEG. Other binary files are described by name and type. - Chat messages carry `attachments` (documents) and `images`. The server folds documents into the prompt within a size budget that gives the newest message priority, and forwards images to vision models. For an Ollama model without the vision capability, images are replaced with a note so the model can suggest a vision model. - The chat box gets an attach button, drag and drop, and paste. Sent messages show the files. Their content is kept in IndexedDB rather than localStorage, and deleted with the conversation. Web search - New Web search toggle (off by default, remembered). With it on, the server searches for the latest message, reads the top pages, and adds them as context the model cites as [1], [2]. A `web_search` SSE event sends the sources first so the answer's citations link to them. - Requests with web search or attachments go straight to the engine, since agents only see the latest message's text. Also send images in the right shape on the direct Ollama and OpenAI paths, and add pdfplumber and Pillow to the desktop and server extras.
Replace the first-launch "Win a Mac mini" dialog, left over from upstream, with "What should Locus call you?": first name, last name and nickname, all optional. - New GET/PUT /v1/profile stores the name in a marked block in the persona's USER.md, leaving the rest of the file alone. The system prompt already includes USER.md, and the block tells the assistant to address the user by their nickname (or first name), so it applies to the next message, in the app and the CLI. - The dialog shows once after setup. The side panel's Leaderboard section becomes "You", showing what Locus calls you and reopening the dialog. - Remove the giveaway dialog, its analytics prompt and their tests, and the giveaway wording in the Savings dashboard and docs.
pdfplumber is now in the server extra CI installs, so the test fed its fake PDF to the real parser. Simulate the missing dependency so the test checks the ImportError it's named for either way.
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.
Summary
Three chat features:
Attachments
POST /v1/attachments(src/locus/server/attachments.py) reads uploaded files and stores nothing:.doc/.xls/.pptfiles get a "save as a newer format" note.attachments(documents) andimages. Documents are folded into the prompt within about 40K characters, newest message first, so they fit the 16K-token default context.visioncapability, the images are replaced with a note so the model can suggest a vision model, instead of the request failing. Images are also sent correctly on the direct Ollama and OpenAI paths, which used to drop them.pdfplumberandpilloware added to thedesktopandserverextras. Both were already inuv.lock, so no versions change.Web search
src/locus/server/web_context.py, using the existingWebSearchTool), reads the top three pages, and adds them as context that the model cites as[1],[2]. A message containing a URL reads that page instead.web_searchSSE event sends the sources before the answer, so the existing citation renderer links[n]. A "Searched the web for …" list appears under the answer. The search context is marked so it doesn't suppress the server's identity prompt.Name instead of the giveaway
GET/PUT /v1/profile(src/locus/server/profile_routes.py) writes a marked block in the persona'sUSER.mdand leaves the rest of the file alone.USER.mdis already part of every system prompt, and the block tells the assistant to address the user by their nickname, or their first name if no nickname is set. This applies to the next message, in the app and the CLI.docs/leaderboard.mdanddocs/telemetry.md.Testing
USER.mdcontent, cleaning input, and the nickname reaching the system prompt. Server tests show no new failures againstmain.tsc --noEmitand all 118 frontend tests pass, including new tests for attachments and the profile.[1]was linked, and the files survived a reload.USER.md. The next message told the model to call the user "Ary", and the side panel showed "Locus calls you Ary".