Skip to content

Commit

Permalink
WebUI (#186)
Browse files Browse the repository at this point in the history
* with vite

* snapshot

* checkpoint

* htmx sidebar nav

* checkpoint sessions

* more test data

* session details

* chat history + metadata rendering

* message view + pager

* add summaries

* user countAll

* session counts

* add settings

* new middlewares, 404 page

* index

* session.CountAll + polish

* nav menu

* more nav work; no data cards

* dashboard

* config control over webui

* tests passing; update deps

* table sorting

* user session filtering

* user table

* message table

* lint

* file cleanup

* development mode in contributing

* render disable webui

* log webui status

* lint issue

* clean nlp server CI envs

* fix embedder test

* fix TestMemorySearch
  • Loading branch information
danielchalef authored Sep 17, 2023
1 parent 6236c19 commit b2dbf77
Show file tree
Hide file tree
Showing 121 changed files with 144,238 additions and 1,009 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ jobs:
--health-retries 5
nlp:
image: ghcr.io/getzep/zep-nlp-server:latest
env:
ENABLE_EMBEDDINGS: true
options: >-
--health-cmd "timeout 10s bash -c ':> /dev/tcp/127.0.0.1/5557' || exit 1"
--health-interval 10s
Expand Down
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ Thank you for your interest in contributing to Zep! We appreciate your efforts a
git checkout -b feature/your-feature-name
```

### Setting "Development" Mode
"Development" mode forces Zep's log level to "debug" and disables caching of the web UI. This is useful when developing Zep locally.

To enable "development" mode, set the `ZEP_DEVELOPMENT` environment variable to `true`:

```
export ZEP_DEVELOPMENT=true
```

or modify your `.env` file accordingly.


### Building Zep

Follow these steps to build Zep locally:
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ swagger:
lint:
golangci-lint run --deadline=90s --sort-results -c golangci.yaml

## Go Watch for web development
## https://github.com/mitranim/gow
gow:
gow -e=go,mod,html,css -i=node_modules run .

# Build web assets
web:
cd pkg/web && npx tailwindcss -i static/input.css -o static/output.css

## Docker:
docker-build: ## Use the dockerfile to build the container
DOCKER_BUILDKIT=1 docker build --rm --tag $(BINARY_NAME) .
Expand Down
2 changes: 1 addition & 1 deletion cmd/zep/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func run() {

handleCLIOptions(cfg)

log.Infof("Starting zep server version %s", config.VersionString)
log.Infof("Starting Zep server version %s", config.VersionString)

config.SetLogLevel(cfg)
appState := NewAppState(cfg)
Expand Down
6 changes: 6 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ store:
postgres:
dsn: "postgres://postgres:postgres@localhost:5432/?sslmode=disable"
server:
# Specify the host to listen on. Defaults to 0.0.0.0
host: 0.0.0.0
port: 8000
# Is the Web UI enabled?
# Warning: The Web UI is not secured by authentication and should not be enabled if
# Zep is exposed to the public internet.
web_enabled: true
auth:
# Set to true to enable authentication
required: false
Expand Down
6 changes: 6 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ var EnvVars = map[string]string{
"llm.anthropic_api_key": "ZEP_ANTHROPIC_API_KEY",
"llm.openai_api_key": "ZEP_OPENAI_API_KEY",
"auth.secret": "ZEP_AUTH_SECRET",
"development": "ZEP_DEVELOPMENT",
}

// LoadConfig loads the config file and ENV variables into a Config struct
Expand Down Expand Up @@ -81,6 +82,11 @@ func bindEnv(key string, envVar string) {

// SetLogLevel sets the log level based on the config file. Defaults to INFO if not set or invalid
func SetLogLevel(cfg *Config) {
if cfg.Development {
internal.SetLogLevel(logrus.DebugLevel)
log.Info("Development mode. Setting log level to: ", logrus.DebugLevel)
return
}
level, err := logrus.ParseLevel(cfg.Log.Level)
if err != nil {
level = logrus.InfoLevel
Expand Down
23 changes: 13 additions & 10 deletions config/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ package config
// Config holds the configuration of the application
// Use cmd.NewConfig to create a new instance
type Config struct {
LLM LLM `mapstructure:"llm"`
NLP NLP `mapstructure:"nlp"`
Memory MemoryConfig `mapstructure:"memory"`
Extractors ExtractorsConfig `mapstructure:"extractors"`
Store StoreConfig `mapstructure:"store"`
Server ServerConfig `mapstructure:"server"`
Log LogConfig `mapstructure:"log"`
Auth AuthConfig `mapstructure:"auth"`
DataConfig DataConfig `mapstructure:"data"`
LLM LLM `mapstructure:"llm"`
NLP NLP `mapstructure:"nlp"`
Memory MemoryConfig `mapstructure:"memory"`
Extractors ExtractorsConfig `mapstructure:"extractors"`
Store StoreConfig `mapstructure:"store"`
Server ServerConfig `mapstructure:"server"`
Log LogConfig `mapstructure:"log"`
Auth AuthConfig `mapstructure:"auth"`
DataConfig DataConfig `mapstructure:"data"`
Development bool `mapstructure:"development"`
}

type StoreConfig struct {
Expand Down Expand Up @@ -48,7 +49,9 @@ type PostgresConfig struct {
}

type ServerConfig struct {
Port int `mapstructure:"port"`
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
WebEnabled bool `mapstructure:"web_enabled"`
}

type LogConfig struct {
Expand Down
128 changes: 0 additions & 128 deletions docs.http

This file was deleted.

29 changes: 0 additions & 29 deletions fly.toml

This file was deleted.

31 changes: 20 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,39 @@ require (
github.com/chi-middleware/logrus-logger v0.2.0
github.com/go-chi/chi/v5 v5.0.10
github.com/go-chi/jwtauth/v5 v5.1.1
github.com/go-playground/validator/v10 v10.15.1
github.com/go-playground/validator/v10 v10.15.4
github.com/golang-jwt/jwt/v5 v5.0.0
github.com/google/uuid v1.3.1
github.com/jinzhu/copier v0.4.0
github.com/joho/godotenv v1.5.1
github.com/oiime/logrusbun v0.1.1
github.com/pgvector/pgvector-go v0.1.1
github.com/pkoukk/tiktoken-go v0.1.5
github.com/pkoukk/tiktoken-go v0.1.6
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.7.0
github.com/spf13/viper v1.16.0
github.com/stretchr/testify v1.8.4
github.com/swaggo/swag/v2 v2.0.0-rc3
github.com/uptrace/bun v1.1.14
github.com/uptrace/bun/dialect/pgdialect v1.1.14
github.com/uptrace/bun/driver/pgdriver v1.1.14
github.com/uptrace/bun v1.1.15
github.com/uptrace/bun/dialect/pgdialect v1.1.15
github.com/uptrace/bun/driver/pgdriver v1.1.15
gonum.org/v1/gonum v0.14.0
)

require (
github.com/Masterminds/sprig/v3 v3.2.3
github.com/alecthomas/chroma v0.10.0
github.com/hashicorp/go-retryablehttp v0.7.4
github.com/tmc/langchaingo v0.0.0-20230827001633-72b07a1c060f
github.com/uptrace/bun/dbfixture v1.1.14
github.com/uptrace/bun/extra/bundebug v1.1.14
github.com/tmc/langchaingo v0.0.0-20230910230029-9c8845b2b019
github.com/uptrace/bun/dbfixture v1.1.15
github.com/uptrace/bun/extra/bundebug v1.1.15
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/dlclark/regexp2 v1.10.0 // indirect
Expand All @@ -54,6 +58,8 @@ require (
github.com/goccy/go-json v0.10.2 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.11 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jackc/pgx/v5 v5.4.2 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
Expand All @@ -69,11 +75,14 @@ require (
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
Expand All @@ -83,10 +92,10 @@ require (
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
golang.org/x/crypto v0.10.0 // indirect
golang.org/x/crypto v0.13.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.9.0 // indirect
golang.org/x/text v0.10.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/tools v0.8.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
Loading

0 comments on commit b2dbf77

Please sign in to comment.