-
Notifications
You must be signed in to change notification settings - Fork 113
feat: Ask Sourcebot #392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: Ask Sourcebot #392
Changes from all commits
Commits
Show all changes
123 commits
Select commit
Hold shift + click to select a range
5e400bd
wip
brendan-kellam e4ee716
wip
brendan-kellam c73b00d
wip: add inline citations
brendan-kellam fb0e44a
Add read file tool
brendan-kellam 446112b
code block rendering
brendan-kellam 571b55f
Add find all refs / get defs tool
brendan-kellam c7a771a
Add range field to citations
brendan-kellam bbf4bec
wip on context system
brendan-kellam 4c1ebae
wip on adding context window panel
brendan-kellam fe8479e
wip on adding context system
brendan-kellam 36202ee
Add useBrowsePath
brendan-kellam 8534924
try out claude
brendan-kellam f7ab5f9
clickable links
brendan-kellam 53fcb5a
WIP: playing around with slate to drive @ mentions
brendan-kellam 187a092
experiment: reduce input token usage by altering file search payload …
brendan-kellam 97bbebd
small improvements
brendan-kellam cea3962
further improvements to @ mention system
brendan-kellam 2b1952f
chat persistance + working on new chat UI
brendan-kellam 828ba99
add input message support
brendan-kellam aea6c18
switch to openai
brendan-kellam 824c2bf
fix
brendan-kellam 1ab148b
fix
brendan-kellam b76ca87
Add markdown rendering using marked
brendan-kellam 63b87e8
formatting nits
brendan-kellam a9bb163
wip on annotations using markdown
brendan-kellam fd02802
Add line numbers to source to make it easier for LLMs to reference sp…
brendan-kellam d9facb2
nits
brendan-kellam aa21412
centralize vscode icons
brendan-kellam 74b3517
stylelized read files tool component
brendan-kellam 14a985c
much progress on styled tool results
brendan-kellam b1997da
fix bug with scroll area width
brendan-kellam d8816fb
switch over to rendering using react-markdown. Render code blocks usi…
brendan-kellam fea6e47
Add metadata to generated codeblocks. Make codemirror rendering nicer
brendan-kellam 5d1e1e6
fix: only encode path part
brendan-kellam 83cda04
fix: remove forced session update on settings dropdown since that was…
brendan-kellam 1e6e18d
wip on perf improvements: render lightweight code editor when streaming
brendan-kellam d661bde
resolve conflicts
brendan-kellam bb02fb1
scroll restoration + some improvements to code block rendering
brendan-kellam 1d65f25
fix
brendan-kellam 907027a
rendering nits + auto scroll
brendan-kellam 90992da
Add hints to inline code blocks
brendan-kellam 4ec001e
fix issues with scroll restoration
brendan-kellam 6f32b76
refactor everything into seperate components
brendan-kellam 956d98e
proper initial message handling
brendan-kellam f4e3bf8
Make the repo selector actually do something
brendan-kellam d40acaa
configurable model providers
brendan-kellam 83a6231
save search mode to local storage. Other small nits
brendan-kellam 9059907
Add support for gemini
brendan-kellam c468a3c
Add bedrock support
brendan-kellam 70a9395
small ux nits: submit button, keyboard shortcuts, auto focus, etc.
brendan-kellam 10cdcba
persist chats to DB
brendan-kellam 8c4ad65
feat: Add chat history side panel
brendan-kellam d9fcdcf
Add chat title summarization
brendan-kellam cafbcd8
add ability to rename / delete chats
brendan-kellam 3662977
chore: add chat name to top-bar; make things work when user is unauth…
brendan-kellam ddc9159
Add stop button
brendan-kellam 752d8b8
wip: Add reasoning output
brendan-kellam 5b8ace7
chore: upgrade to ai-sdk v5 beta
brendan-kellam 466695b
Add remark reference plugin
brendan-kellam 1bfd7ee
small overhall in how we present the chat thread
brendan-kellam af45097
Add table of contents
brendan-kellam 624b48b
Adds a navigation guard to chat that warns the user that leaving the …
brendan-kellam 9fb0503
fix issue with rendering code blocks
brendan-kellam f2100c9
fix docker build errors
msukkari 2f253a6
Revert "fix docker build errors"
brendan-kellam ec96fd2
wip: Reference list viewer
brendan-kellam 25ceee2
nits
brendan-kellam 1c3e93b
chore: remove full codemirror cell output in chat thread
brendan-kellam 7e3a658
Add tool UX for find refs / defs
brendan-kellam df50e28
Clarify the concept of a source and a reference. Various cleanup work
brendan-kellam cb0fe49
Add reference scrolling
brendan-kellam 9071159
scroll handling
brendan-kellam 87f3381
small nit
brendan-kellam c16fcfc
improved highlight range styling
brendan-kellam e1f616a
color selection tweak
brendan-kellam 90187f6
color tweak
brendan-kellam b5a3d74
feat: Add code folding to file reference viewer
brendan-kellam 5b50c04
Collapsable code cells
brendan-kellam 86c56d0
Small UX improvements like collapsable chat
brendan-kellam 4193a21
support file references with only a start line
brendan-kellam 27fbb78
cleanup & some devex improvements to how we handle file references
brendan-kellam e20d810
output openai reasoning tokens
brendan-kellam fe6fdcc
Add tooltip to mention elements
brendan-kellam 44e28d0
wip on refactoring homepage
brendan-kellam 35b5a46
feat: Add repo suggestions. todo: wire up repo selector to chat box
brendan-kellam 281d8f0
wip on homepage redesign - add agentic search examples
brendan-kellam 110d1d7
Add model provider info to 'new chat' page
brendan-kellam 3e7acf8
wip: source selected repos from @ mentions found in the chat box
brendan-kellam 6b2df65
chore: add a mechanism to truncate large files
brendan-kellam cc06480
chore: bump to latest ai sdk version
brendan-kellam e38f469
Various refactors, including: 1) move LLM invocation into a sperate '…
brendan-kellam 6d2081b
resolve conflicts
brendan-kellam 585d3ed
Add back table of contents
brendan-kellam 507d537
Copy button
brendan-kellam c349add
Add support for like / dislike buttons
brendan-kellam 27ef6d3
Add chat history to LLM input
brendan-kellam dd99109
switch over to using config.json for configuring models. Add language…
brendan-kellam cda8a7f
Add tooltips explaining each search mode
brendan-kellam 9270f29
more nits with search mode tooltip
brendan-kellam 8a5c7e7
Load repos in server component. Various other nit fixes and improvements
brendan-kellam 4fbb459
Remove repositories from being a mentionable item, instead opting for…
brendan-kellam 4293cbd
simplification: remove file truncation
brendan-kellam ac8126c
instruct the LLM to output the answer and stop researching when we ar…
brendan-kellam 334ac73
Add news data
brendan-kellam da21a5b
Add basic chat history component to homepag
brendan-kellam 253b055
small tweaks here and there
brendan-kellam 6e531fd
rename to ask sourcebot
brendan-kellam 14e9660
update readme
msukkari e61ae50
Improved anonymous access handling: add concept of chat visibility an…
brendan-kellam 3e0c5b1
Fix build errors
brendan-kellam c9a7fcc
add support for google vertex
msukkari 0d894cf
small nits with example queries
brendan-kellam fca9c68
add antrhopic vertex support:
msukkari 95cfd11
remove log
msukkari 0377e2f
changelog
brendan-kellam 096b245
Make repo selection required
brendan-kellam d54ffd7
docs
msukkari 64b9f99
Add langfuse integration
brendan-kellam 2cc5027
Update og metadata description
brendan-kellam eea0e06
nits
brendan-kellam fa74f03
readme nit
brendan-kellam 1707be8
more docs
msukkari d29a972
feedback
brendan-kellam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
title: Config File | ||
sidebarTitle: Config file | ||
--- | ||
|
||
When self-hosting Sourcebot, you **must** provide it a config file. This is done by defining a config file in a volume that's mounted to Sourcebot, and providing the path to this | ||
file in the `CONFIG_PATH` environment variable. For example: | ||
|
||
```bash icon="terminal" Passing in a CONFIG_PATH to Sourcebot | ||
docker run \ | ||
-v $(pwd)/config.json:/data/config.json \ | ||
-e CONFIG_PATH=/data/config.json \ | ||
... \ # other options | ||
ghcr.io/sourcebot-dev/sourcebot:latest | ||
``` | ||
|
||
The config file tells Sourcebot which repos to index, what language models to use, and various other settings as defined in the [schema](#config-file-schema). | ||
|
||
# Config File Schema | ||
|
||
The config file you provide Sourcebot must follow the [schema](https://github.com/sourcebot-dev/sourcebot/blob/main/schemas/v3/index.json). This schema consists of the following properties: | ||
|
||
- [Connections](/docs/connections/overview) (`connections`): Defines a set of connections that tell Sourcebot which repos to index and from where | ||
- [Language Models](/docs/configuration/language-model-providers) (`models`): Defines a set of language model providers for use with [Ask Sourcebot](/docs/features/ask) | ||
- [Settings](#settings) (`settings`): Additional settings to tweak your Sourcebot deployment | ||
- [Search Contexts](/docs/features/search/search-contexts) (`contexts`): Groupings of repos that you can search against | ||
|
||
# Config File Syncing | ||
|
||
Sourcebot syncs the config file on startup, and automatically whenever a change is detected. | ||
|
||
# Settings | ||
|
||
The following are settings that can be provided in your config file to modify Sourcebot's behavior | ||
|
||
| Setting | Type | Default | Minimum | Description / Notes | | ||
|-------------------------------------------|---------|------------|---------|----------------------------------------------------------------------------------------| | ||
| `maxFileSize` | number | 2 MB | 1 | Maximum size (bytes) of a file to index. Files exceeding this are skipped. | | ||
| `maxTrigramCount` | number | 20 000 | 1 | Maximum trigrams per document. Larger files are skipped. | | ||
| `reindexIntervalMs` | number | 1 hour | 1 | Interval at which all repositories are re‑indexed. | | ||
| `resyncConnectionIntervalMs` | number | 24 hours | 1 | Interval for checking connections that need re‑syncing. | | ||
| `resyncConnectionPollingIntervalMs` | number | 1 second | 1 | DB polling rate for connections that need re‑syncing. | | ||
| `reindexRepoPollingIntervalMs` | number | 1 second | 1 | DB polling rate for repos that should be re‑indexed. | | ||
| `maxConnectionSyncJobConcurrency` | number | 8 | 1 | Concurrent connection‑sync jobs. | | ||
| `maxRepoIndexingJobConcurrency` | number | 8 | 1 | Concurrent repo‑indexing jobs. | | ||
| `maxRepoGarbageCollectionJobConcurrency` | number | 8 | 1 | Concurrent repo‑garbage‑collection jobs. | | ||
| `repoGarbageCollectionGracePeriodMs` | number | 10 seconds | 1 | Grace period to avoid deleting shards while loading. | | ||
| `repoIndexTimeoutMs` | number | 2 hours | 1 | Timeout for a single repo‑indexing run. | | ||
| `enablePublicAccess` **(deprecated)** | boolean | false | — | Use the `FORCE_ENABLE_ANONYMOUS_ACCESS` environment variable instead. | |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,184 @@ | ||
--- | ||
title: Language Model Providers | ||
sidebarTitle: Language model providers | ||
--- | ||
|
||
To use [Ask Sourcebot](/docs/features/ask) you must define at least one Language Model Provider. These providers are defined within the [config file](/docs/configuration/config-file) you | ||
provide Sourcebot. | ||
|
||
|
||
```json wrap icon="code" Example config with language model provider | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json", | ||
"models": [ | ||
// 1. Google Vertex config for Gemini 2.5 Pro | ||
{ | ||
"provider": "google-vertex", | ||
"model": "gemini-2.5-pro", | ||
"displayName": "Gemini 2.5 Pro", | ||
"project": "sourcebot", | ||
"credentials": { | ||
"env": "GOOGLE_APPLICATION_CREDENTIALS" | ||
} | ||
}, | ||
// 2. OpenAI config for o3 | ||
{ | ||
"provider": "openai", | ||
"model": "o3", | ||
"displayName": "o3", | ||
"token": { | ||
"env": "OPENAI_API_KEY" | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
|
||
# Supported Providers | ||
|
||
Sourcebot uses the [Vercel AI SDK](https://ai-sdk.dev/docs/introduction), so it can integrate with any provider the SDK supports. If you don't see your provider below please submit | ||
a [feature request](https://github.com/sourcebot-dev/sourcebot/discussions/categories/feature-requests). | ||
|
||
For a detailed description of all the providers, please refer to the [schema](https://github.com/sourcebot-dev/sourcebot/blob/main/schemas/v3/languageModel.json). | ||
|
||
<Note>Any parameter defined using `env` will read the value from the corresponding environment variable you provide Sourcebot</Note> | ||
|
||
### Amazon Bedrock | ||
|
||
[Vercel AI SDK Amazon Bedrock Docs](https://ai-sdk.dev/providers/ai-sdk-providers/amazon-bedrock) | ||
|
||
```json wrap icon="code" Example config with Amazon Bedrock provider | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json", | ||
"models": [ | ||
{ | ||
"provider": "amazon-bedrock", | ||
"model": "YOUR_MODEL_HERE", | ||
"displayName": "OPTIONAL_DISPLAY_NAME", | ||
"accessKeyId": { | ||
"env": "AWS_ACCESS_KEY_ID" | ||
}, | ||
"accessKeySecret": { | ||
"env": "AWS_SECRET_ACCESS_KEY" | ||
}, | ||
"region": "YOUR_REGION_HERE", // defaults to the AWS_REGION env var if not set | ||
"baseUrl": "OPTIONAL_BASE_URL" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
### Anthropic | ||
|
||
[Vercel AI SDK Anthropic Docs](https://ai-sdk.dev/providers/ai-sdk-providers/anthropic) | ||
|
||
```json wrap icon="code" Example config with Anthropic provider | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json", | ||
"models": [ | ||
{ | ||
"provider": "anthropic", | ||
"model": "YOUR_MODEL_HERE", | ||
"displayName": "OPTIONAL_DISPLAY_NAME", | ||
"token": { | ||
"env": "ANTHROPIC_API_KEY" | ||
}, | ||
"baseUrl": "OPTIONAL_BASE_URL" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
### Google Generative AI | ||
|
||
[Vercel AI SDK Google Generative AI Docs](https://ai-sdk.dev/providers/ai-sdk-providers/google-generative-ai) | ||
|
||
```json wrap icon="code" Example config with Google Generative AI provider | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json", | ||
"models": [ | ||
{ | ||
"provider": "google-generative-ai", | ||
"model": "YOUR_MODEL_HERE", | ||
"displayName": "OPTIONAL_DISPLAY_NAME", | ||
"token": { | ||
"env": "GOOGLE_GENERATIVE_AI_API_KEY" | ||
}, | ||
"baseUrl": "OPTIONAL_BASE_URL" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
### Google Vertex | ||
|
||
<Note>If you're using an Anthropic model on Google Vertex, you must define a [Google Vertex Anthropic](#google-vertex-anthropic) provider instead</Note> | ||
<Note>The `credentials` paramater here expects a **path** to a [credentials](https://console.cloud.google.com/apis/credentials) file. This file **must be in a volume mounted by Sourcebot** for it to be readable.</Note> | ||
|
||
[Vercel AI SDK Google Vertex AI Docs](https://ai-sdk.dev/providers/ai-sdk-providers/google-vertex) | ||
|
||
```json wrap icon="code" Example config with Google Vertex provider | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json", | ||
"models": [ | ||
{ | ||
"provider": "google-vertex", | ||
"model": "YOUR_MODEL_HERE", // e.g., "gemini-2.0-flash-exp", "gemini-1.5-pro", "gemini-1.5-flash" | ||
"displayName": "OPTIONAL_DISPLAY_NAME", | ||
"project": "YOUR_PROJECT_ID", // defaults to the GOOGLE_VERTEX_PROJECT env var if not set | ||
"region": "YOUR_REGION_HERE", // defaults to the GOOGLE_VERTEX_REGION env var if not set, e.g., "us-central1", "us-east1", "europe-west1" | ||
"credentials": { | ||
"env": "GOOGLE_APPLICATION_CREDENTIALS" | ||
}, | ||
"baseUrl": "OPTIONAL_BASE_URL" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
### Google Vertex Anthropic | ||
|
||
<Note>The `credentials` paramater here expects a **path** to a [credentials](https://console.cloud.google.com/apis/credentials) file. This file **must be in a volume mounted by Sourcebot** for it to be readable.</Note> | ||
|
||
|
||
[Vercel AI SDK Google Vertex Anthropic Docs](https://ai-sdk.dev/providers/ai-sdk-providers/google-vertex#google-vertex-anthropic-provider-usage) | ||
|
||
```json wrap icon="code" Example config with Google Vertex Anthropic provider | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json", | ||
"models": [ | ||
{ | ||
"provider": "google-vertex-anthropic", | ||
"model": "YOUR_MODEL_HERE", // e.g., "claude-sonnet-4" | ||
"displayName": "OPTIONAL_DISPLAY_NAME", | ||
"project": "YOUR_PROJECT_ID", // defaults to the GOOGLE_VERTEX_PROJECT env var if not set | ||
"region": "YOUR_REGION_HERE", // defaults to the GOOGLE_VERTEX_REGION env var if not set, e.g., "us-central1", "us-east1", "europe-west1" | ||
"credentials": { | ||
"env": "GOOGLE_APPLICATION_CREDENTIALS" | ||
}, | ||
"baseUrl": "OPTIONAL_BASE_URL" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
### OpenAI | ||
|
||
[Vercel AI SDK OpenAI Docs](https://ai-sdk.dev/providers/ai-sdk-providers/openai) | ||
|
||
```json wrap icon="code" Example config with OpenAI provider | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json", | ||
"models": [ | ||
{ | ||
"provider": "openai", | ||
"model": "YOUR_MODEL_HERE", // e.g., "gpt-4.1", "o4-mini", "o3", "o3-deep-research" | ||
"displayName": "OPTIONAL_DISPLAY_NAME", | ||
"token": { | ||
"env": "OPENAI_API_KEY" | ||
}, | ||
"baseUrl": "OPTIONAL_BASE_URL" | ||
} | ||
] | ||
} | ||
``` |
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
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
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.