sourcebot/packages/web/src/features/chat
2025-09-04 18:02:49 -04:00
..
components chore(web): Upgrade to NextJS 15 (#477) 2025-08-22 14:48:29 -04:00
actions.ts feat(ask_sb): Add support for queryParams to OpenAI compatible language model providers (#490) 2025-09-04 18:02:49 -04:00
agent.ts feat(ask_sb): Add headers param to config to allow users to specify custom headers (#449) 2025-08-08 14:49:00 -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 feat(ask_sb): Improved search tool ; tools for listing / searching repos ; removed search scope constraint (#400) 2025-07-29 10:41:01 -07:00
types.ts fix(ask_sb): Fix '413 content too large' error (#416) 2025-07-31 16:38:10 -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 feat: Ask Sourcebot (#392) 2025-07-23 11:25:15 -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 fix(ask_sb): Fix long generation times on first message in thread (#447) 2025-08-07 21:56:56 -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.