mirror of https://github.com/buster-so/buster.git
Merge branch 'evals' of https://github.com/buster-so/buster into evals
This commit is contained in:
commit
5861f13a76
|
@ -1,6 +1,6 @@
|
|||
[workspace]
|
||||
members = [
|
||||
".",
|
||||
"server",
|
||||
"libs/handlers",
|
||||
"libs/litellm",
|
||||
"libs/database",
|
||||
|
@ -9,7 +9,9 @@ members = [
|
|||
"libs/sharing",
|
||||
"libs/sql_analyzer",
|
||||
"libs/search",
|
||||
"testkit",
|
||||
]
|
||||
resolver = "2"
|
||||
|
||||
# Define shared dependencies for all workspace members
|
||||
[workspace.dependencies]
|
||||
|
@ -99,90 +101,11 @@ rayon = "1.10.0"
|
|||
diesel_migrations = "2.0.0"
|
||||
html-escape = "0.2.13"
|
||||
|
||||
[package]
|
||||
name = "bi_api"
|
||||
version = "0.0.1"
|
||||
edition = "2021"
|
||||
default-run = "bi_api"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
# Use workspace dependencies
|
||||
anyhow = { workspace = true }
|
||||
arrow = { workspace = true }
|
||||
async-compression = { workspace = true }
|
||||
async-trait = { workspace = true }
|
||||
axum = { workspace = true }
|
||||
base64 = { workspace = true }
|
||||
bb8-redis = { workspace = true }
|
||||
chrono = { workspace = true }
|
||||
cohere-rust = { workspace = true }
|
||||
diesel = { workspace = true }
|
||||
diesel-async = { workspace = true }
|
||||
diesel_migrations = { workspace = true }
|
||||
dotenv = { workspace = true }
|
||||
futures = { workspace = true }
|
||||
futures-util = { workspace = true }
|
||||
gcp-bigquery-client = { workspace = true }
|
||||
html-escape = { workspace = true }
|
||||
indexmap = { workspace = true }
|
||||
jsonwebtoken = { workspace = true }
|
||||
lazy_static = { workspace = true }
|
||||
num-traits = { workspace = true }
|
||||
once_cell = { workspace = true }
|
||||
rand = { workspace = true }
|
||||
rayon = { workspace = true }
|
||||
redis = { workspace = true }
|
||||
regex = { workspace = true }
|
||||
reqwest = { workspace = true }
|
||||
resend-rs = { workspace = true }
|
||||
rustls = { workspace = true }
|
||||
rustls-native-certs = { workspace = true }
|
||||
sentry = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
serde_urlencoded = { workspace = true }
|
||||
serde_yaml = { workspace = true }
|
||||
snowflake-api = { workspace = true }
|
||||
sqlx = { workspace = true }
|
||||
tempfile = { workspace = true }
|
||||
tiberius = { workspace = true }
|
||||
tiktoken-rs = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
tokio-postgres = { workspace = true }
|
||||
tokio-postgres-rustls = { workspace = true }
|
||||
tokio-stream = { workspace = true }
|
||||
tokio-util = { workspace = true }
|
||||
tower-http = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
tracing-subscriber = { workspace = true }
|
||||
url = { workspace = true }
|
||||
uuid = { workspace = true }
|
||||
sqlparser = { workspace = true }
|
||||
|
||||
# Local dependencies
|
||||
handlers = { path = "libs/handlers" }
|
||||
litellm = { path = "libs/litellm" }
|
||||
database = { path = "libs/database" }
|
||||
agents = { path = "libs/agents" }
|
||||
query_engine = { path = "libs/query_engine" }
|
||||
braintrust = { path = "libs/braintrust" }
|
||||
middleware = { path = "libs/middleware" }
|
||||
sharing = { path = "libs/sharing" }
|
||||
search = { path = "libs/search" }
|
||||
|
||||
[dev-dependencies]
|
||||
mockito = { workspace = true }
|
||||
tokio-test = { workspace = true }
|
||||
async-trait = { workspace = true }
|
||||
|
||||
[profile.release]
|
||||
debug = false
|
||||
incremental = true
|
||||
|
||||
[profile.dev]
|
||||
incremental = true
|
||||
|
||||
opt-level = 0 # Ensure this is 0 for faster debug builds
|
||||
debug = 1 # Reduce debug info slightly while keeping enough for backtraces
|
|
@ -9,7 +9,7 @@ FROM chef AS builder
|
|||
COPY --from=planner /app/recipe.json recipe.json
|
||||
RUN cargo chef cook --release --recipe-path recipe.json
|
||||
COPY . .
|
||||
RUN cargo build --release --bin bi_api
|
||||
RUN cargo build --release --bin buster_server
|
||||
|
||||
FROM debian:bookworm-slim AS runtime
|
||||
WORKDIR /app
|
||||
|
@ -34,6 +34,6 @@ RUN update-ca-certificates
|
|||
ENV RUST_LOG=warn
|
||||
ENV RUST_BACKTRACE=0
|
||||
|
||||
COPY --from=builder /app/target/release/bi_api .
|
||||
COPY --from=builder /app/target/release/buster_server .
|
||||
EXPOSE 3001
|
||||
ENTRYPOINT ["./bi_api"]
|
||||
ENTRYPOINT ["./buster_server"]
|
||||
|
|
|
@ -30,4 +30,5 @@ reqwest = { workspace = true }
|
|||
|
||||
|
||||
[dev-dependencies]
|
||||
tokio-test = { workspace = true }
|
||||
tokio-test = { workspace = true }
|
||||
testkit = { path = "../../testkit" }
|
|
@ -0,0 +1,45 @@
|
|||
use anyhow::Result;
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_database_connection() -> Result<()> {
|
||||
// Get the database pool from testkit
|
||||
let pool = testkit::get_pg_pool();
|
||||
|
||||
// Test the connection by getting a connection from the pool
|
||||
let conn = pool.get().await?;
|
||||
|
||||
// If we got here without errors, the connection is working
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_with_isolation() -> Result<()> {
|
||||
// Get a unique test ID for data isolation
|
||||
let test_id = testkit::test_id();
|
||||
|
||||
// Get database pool
|
||||
let pool = testkit::get_pg_pool();
|
||||
|
||||
// Get a DB connection
|
||||
let mut conn = pool.get().await?;
|
||||
|
||||
// Here you would create test data with test_id for isolation
|
||||
// For example:
|
||||
// diesel::sql_query("INSERT INTO users (id, email, test_id) VALUES ($1, $2, $3)")
|
||||
// .bind::<diesel::sql_types::Uuid, _>(uuid::Uuid::new_v4())
|
||||
// .bind::<diesel::sql_types::Text, _>("test@example.com")
|
||||
// .bind::<diesel::sql_types::Text, _>(&test_id)
|
||||
// .execute(&mut conn)
|
||||
// .await?;
|
||||
|
||||
// Run assertions on the test data
|
||||
|
||||
// Clean up after the test
|
||||
// For example:
|
||||
// diesel::sql_query("DELETE FROM users WHERE test_id = $1")
|
||||
// .bind::<diesel::sql_types::Text, _>(&test_id)
|
||||
// .execute(&mut conn)
|
||||
// .await?;
|
||||
|
||||
Ok(())
|
||||
}
|
|
@ -9,7 +9,7 @@ dev:
|
|||
PGPASSWORD=postgres psql -h 127.0.0.1 -p 54322 -d postgres -U postgres -f libs/database/seed.sql && \
|
||||
export RUST_LOG=debug
|
||||
export CARGO_INCREMENTAL=1
|
||||
nice cargo watch -x run
|
||||
nice cargo watch -C server -x run
|
||||
|
||||
stop:
|
||||
docker compose down && \
|
||||
|
@ -19,4 +19,4 @@ stop:
|
|||
fast:
|
||||
export RUST_LOG=debug
|
||||
export CARGO_INCREMENTAL=1
|
||||
nice cargo watch -x run
|
||||
nice cargo watch -C server -x run
|
|
@ -0,0 +1,77 @@
|
|||
[package]
|
||||
name = "buster_server"
|
||||
version = "0.0.1"
|
||||
edition = "2021"
|
||||
default-run = "buster_server"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
# Use workspace dependencies
|
||||
anyhow = { workspace = true }
|
||||
arrow = { workspace = true }
|
||||
async-compression = { workspace = true }
|
||||
async-trait = { workspace = true }
|
||||
axum = { workspace = true }
|
||||
base64 = { workspace = true }
|
||||
bb8-redis = { workspace = true }
|
||||
chrono = { workspace = true }
|
||||
cohere-rust = { workspace = true }
|
||||
diesel = { workspace = true }
|
||||
diesel-async = { workspace = true }
|
||||
diesel_migrations = { workspace = true }
|
||||
dotenv = { workspace = true }
|
||||
futures = { workspace = true }
|
||||
futures-util = { workspace = true }
|
||||
gcp-bigquery-client = { workspace = true }
|
||||
html-escape = { workspace = true }
|
||||
indexmap = { workspace = true }
|
||||
jsonwebtoken = { workspace = true }
|
||||
lazy_static = { workspace = true }
|
||||
num-traits = { workspace = true }
|
||||
once_cell = { workspace = true }
|
||||
rand = { workspace = true }
|
||||
rayon = { workspace = true }
|
||||
redis = { workspace = true }
|
||||
regex = { workspace = true }
|
||||
reqwest = { workspace = true }
|
||||
resend-rs = { workspace = true }
|
||||
rustls = { workspace = true }
|
||||
rustls-native-certs = { workspace = true }
|
||||
sentry = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
serde_urlencoded = { workspace = true }
|
||||
serde_yaml = { workspace = true }
|
||||
snowflake-api = { workspace = true }
|
||||
sqlx = { workspace = true }
|
||||
tempfile = { workspace = true }
|
||||
tiberius = { workspace = true }
|
||||
tiktoken-rs = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
tokio-postgres = { workspace = true }
|
||||
tokio-postgres-rustls = { workspace = true }
|
||||
tokio-stream = { workspace = true }
|
||||
tokio-util = { workspace = true }
|
||||
tower-http = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
tracing-subscriber = { workspace = true }
|
||||
url = { workspace = true }
|
||||
uuid = { workspace = true }
|
||||
sqlparser = { workspace = true }
|
||||
|
||||
# Local dependencies
|
||||
handlers = { path = "../libs/handlers" }
|
||||
litellm = { path = "../libs/litellm" }
|
||||
database = { path = "../libs/database" }
|
||||
agents = { path = "../libs/agents" }
|
||||
query_engine = { path = "../libs/query_engine" }
|
||||
braintrust = { path = "../libs/braintrust" }
|
||||
middleware = { path = "../libs/middleware" }
|
||||
sharing = { path = "../libs/sharing" }
|
||||
search = { path = "../libs/search" }
|
||||
|
||||
[dev-dependencies]
|
||||
mockito = { workspace = true }
|
||||
tokio-test = { workspace = true }
|
||||
async-trait = { workspace = true }
|
|
@ -0,0 +1,35 @@
|
|||
# Buster Server
|
||||
|
||||
This directory contains the main server code for the Buster API. It provides the API endpoints, WebSocket handlers, and application logic for the Buster application.
|
||||
|
||||
## Structure
|
||||
|
||||
- `src/` - Main server code
|
||||
- `routes/` - API endpoints (REST, WebSocket)
|
||||
- `utils/` - Shared utilities
|
||||
- `types/` - Common type definitions
|
||||
|
||||
## Development
|
||||
|
||||
To run the server in development mode:
|
||||
|
||||
```bash
|
||||
# From the project root
|
||||
make dev
|
||||
|
||||
# Or to run with faster feedback loop
|
||||
make fast
|
||||
```
|
||||
|
||||
## Dependencies
|
||||
|
||||
The server depends on the following local libraries:
|
||||
|
||||
- `database` - Database access and models
|
||||
- `handlers` - Business logic handlers
|
||||
- `middleware` - HTTP middleware components
|
||||
- `query_engine` - SQL query engine
|
||||
- `sharing` - Asset sharing functionality
|
||||
- `search` - Search functionality
|
||||
|
||||
All dependencies are inherited from the workspace Cargo.toml.
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue