sourcebot/packages/web/src/features/chat
2025-12-11 19:21:26 +08:00
..
components Merge 7341a49407 into d63f3cf9d9 2025-12-11 19:21:26 +08:00
actions.ts fix(web): Fix issue where creating a new Ask thread would result in a 404 (#641) 2025-11-28 23:01:33 -08:00
agent.ts fix(web): Fix loading issues with references / definitions list (#617) 2025-11-13 17:21:48 -08:00
constants.ts feat(ask_sb): Improved search tool ; tools for listing / searching repos ; removed search scope constraint (#400) 2025-07-29 10:41:01 -07:00
customSlateEditor.tsx feat: Ask Sourcebot (#392) 2025-07-23 11:25:15 -07:00
README.md feat: Ask Sourcebot (#392) 2025-07-23 11:25:15 -07:00
tools.ts chore(web): Scope code nav to current repository by default (#647) 2025-11-30 18:53:09 -08:00
types.ts fix(web): Ask sourcebot perf improvements (#632) 2025-11-27 16:56:11 -08:00
useCreateNewChatThread.ts fix(web): Ask sourcebot perf improvements (#632) 2025-11-27 16:56:11 -08:00
useCustomSlateEditor.ts feat: Ask Sourcebot (#392) 2025-07-23 11:25:15 -07:00
useExtractReferences.test.ts chore(web): Upgrade to NextJS 15 (#477) 2025-08-22 14:48:29 -04:00
useExtractReferences.ts fix(ask_sb): Various improvements to the references system (#396) 2025-07-25 18:34:33 -07:00
useMessagePairs.test.ts chore(web): Upgrade to NextJS 15 (#477) 2025-08-22 14:48:29 -04:00
useMessagePairs.ts feat: Ask Sourcebot (#392) 2025-07-23 11:25:15 -07:00
useSelectedLanguageModel.ts chore(worker,web): Repo indexing stability improvements + perf improvements to web (#563) 2025-10-18 16:31:22 -07:00
useTOCItems.ts feat: Ask Sourcebot (#392) 2025-07-23 11:25:15 -07:00
utils.test.ts feat(web,worker): Environment overrides (#597) 2025-11-04 21:22:31 -08:00
utils.ts fix(web): Ask sourcebot perf improvements (#632) 2025-11-27 16:56:11 -08:00

Sources and References

We have the concept of "sources" and "references" in sb:

  1. source - A source is some artifact that exists in the codebase (e.g., file, commit, etc.) that helps the LLM ground its answer in reality.
  2. references - A reference (or citation) is a pointer to a source that the LLM can output in it's response so that the developer can understand why the LLM got to the conclusion it got to.

Sources can be attached to a chat thread in two ways:

  1. The developer @ mentions a source (e.g., "what does @auth.ts do?") in their request.
  2. The LLM makes a tool call (e.g., readFile) in its response.

Sources are included in the chat thread using a custom data part as a JSON payload with the necessary data to allow us to retrieve the source at a later point (e.g., in ReferencedSourcesListView.tsx).

References are included in a LLMs response by embedding a known pattern (e.g., @file:{auth.ts:12-24}) that can be grepped and rendered with a custom component using a remark plugin. The LLM is instructed to use this pattern in the system prompt.

The process of resolving a reference to a source is inherently fuzzy since we are not guaranteed any determinism with LLMs (e.g., the LLM could hallucinate a source that doesn't exist). We perform reference resolution on a best-effort basis.