sourcebot/packages/web/src/features/chat
Brendan Kellam 4ebe4e0475
Some checks failed
Publish to ghcr / build (linux/amd64, blacksmith-4vcpu-ubuntu-2404) (push) Has been cancelled
Publish to ghcr / build (linux/arm64, blacksmith-8vcpu-ubuntu-2204-arm) (push) Has been cancelled
Publish to ghcr / merge (push) Has been cancelled
chore(worker,web): Repo indexing stability improvements + perf improvements to web (#563)
2025-10-18 16:31:22 -07:00
..
components chore(worker,web): Repo indexing stability improvements + perf improvements to web (#563) 2025-10-18 16:31:22 -07:00
actions.ts feat(ask_sb): Fallback on fromNodeProviderChain if access key or sessionToken are not provided (#513) 2025-09-17 13:07:45 -07:00
agent.ts [experimental] feat(ee): GitHub permission syncing (#508) 2025-09-20 16:51:14 -07: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 [experimental] feat(ee): GitHub permission syncing (#508) 2025-09-20 16:51:14 -07:00
types.ts chore(worker,web): Repo indexing stability improvements + perf improvements to web (#563) 2025-10-18 16:31:22 -07:00
useCreateNewChatThread.ts chore(ask_sb): Add PostHog telemetry event for new chat thread creation (#418) 2025-07-31 17:49:06 -07: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(ask_sb): Improved search tool ; tools for listing / searching repos ; removed search scope constraint (#400) 2025-07-29 10:41:01 -07:00
utils.ts chore(worker,web): Repo indexing stability improvements + perf improvements to web (#563) 2025-10-18 16:31:22 -07: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.