Code Monkey home page Code Monkey logo

chroma-db-ui's Introduction

Chroma DB UI

A simple UI for Chroma database.

Using Ruby with Sinatra and Chroma Ruby Client.

screely-1691280117525-min

Run it locally

Clone the repo and run the following commands:

bundle install

ruby app.rb

To config the database, you can set the following environment variable:

export CHROMA_URL=http://localhost:8000
ruby app.rb

Run local Chroma in the docker

A docker-compose file is provided to run Chroma in a docker container.

docker-compose up chroma

Note: You need to wait for the Chroma to be ready before running the UI.

chroma-db-ui's People

Contributors

flanker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

chroma-db-ui's Issues

Getting following while accessing UI: SyntaxError - ../chroma-db-ui/views/index.erb:21: syntax error, unexpected `end' ...t_buf.<< " ".freeze; - end ; @_out_buf.<< "\n".freeze

Made following changes to get the app to run, as it was failing in bundle install before

  • Installed Ruby version 3.2.2, as 2.x version was failing in bundle install for incompatible chroma-db version:
$ ruby -v    
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-darwin20
  • Updated Gemfile with other dependencies as app was failing to come up:
$ cat Gemfile 
source 'https://rubygems.org'

gem 'chroma-db'
gem 'sinatra'
gem 'puma'        <-----------------
gem "dead_end"  <-----------------

Post above changes, bundle install went fine.

Started the app as:

== Sinatra (v3.1.0) has taken the stage on 4567 for development with backup from Puma
Puma starting in single mode...
* Puma version: 6.3.1 (ruby 3.2.2-p53) ("Mugi No Toki Itaru")
*  Min threads: 0
*  Max threads: 5
*  Environment: development
*          PID: 37747
* Listening on http://127.0.0.1:4567
* Listening on http://[::1]:4567
Use Ctrl-C to stop

but as soon as i access the URL, below is what i see on terminal and UI:

Terminal:

* Listening on http://[::1]:4567
Use Ctrl-C to stop



2023-08-23 18:57:08 - SyntaxError - ..../chroma-db-ui/views/index.erb:21: syntax error, unexpected `end'
...t_buf.<< "      ".freeze; - end ; @_out_buf.<< "\n".freeze
...                            ^~~
.../chroma-db-ui/views/index.erb:30: syntax error, unexpected `else'
..._buf.<< "      ".freeze; - else ; @_out_buf.<< "\n".freeze
...                           ^~~~
.../chroma-db-ui/views/index.erb:32: syntax error, unexpected `end'
...t_buf.<< "      ".freeze; - end ; @_out_buf.<< "\n".freeze
...                            ^~~
.../chroma-db-ui/views/index.erb:36: syntax error, unexpected `else'
..._buf.<< "      ".freeze; - else ; @_out_buf.<< "\n".freeze
...                           ^~~~
..../chroma-db-ui/views/index.erb:38: syntax error, unexpected `end'
...t_buf.<< "      ".freeze; - end ; @_out_buf.<< "\n".freeze
...                            ^~~
..../chroma-db-ui/views/index.erb:57: syntax error, unexpected `end'
...t_buf.<< "      ".freeze; - end ; @_out_buf.<< "\n".freeze
...                            ^~~
:
	/usr/local/lib/ruby/gems/3.2.0/gems/tilt-2.2.0/lib/tilt/template.rb:371:in `class_eval'
	/usr/local/lib/ruby/gems/3.2.0/gems/tilt-2.2.0/lib/tilt/template.rb:371:in `eval_compiled_method'
	/usr/local/lib/ruby/gems/3.2.0/gems/tilt-2.2.0/lib/tilt/template.rb:366:in `bind_compiled_method'
	/usr/local/lib/ruby/gems/3.2.0/gems/tilt-2.2.0/lib/tilt/template.rb:341:in `compile_template_method'
	/usr/local/lib/ruby/gems/3.2.0/gems/tilt-2.2.0/lib/tilt/template.rb:158:in `compiled_method'
	/usr/local/lib/ruby/gems/3.2.0/gems/tilt-2.2.0/lib/tilt/template.rb:208:in `evaluate'
	/usr/local/lib/ruby/gems/3.2.0/gems/tilt-2.2.0/lib/tilt/template.rb:104:in `render'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:866:in `render'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:748:in `erb'
	app.rb:17:in `block in <main>'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:1763:in `call'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:1763:in `block in compile!'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:1066:in `block (3 levels) in route!'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:1084:in `route_eval'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:1066:in `block (2 levels) in route!'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:1115:in `block in process_route'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:1113:in `catch'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:1113:in `process_route'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:1064:in `block in route!'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:1061:in `each'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:1061:in `route!'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:1185:in `block in dispatch!'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:1156:in `catch'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:1156:in `invoke'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:1180:in `dispatch!'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:996:in `block in call!'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:1156:in `catch'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:1156:in `invoke'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:996:in `call!'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:985:in `call'
	/usr/local/lib/ruby/gems/3.2.0/gems/rack-protection-3.1.0/lib/rack/protection/xss_header.rb:20:in `call'
	/usr/local/lib/ruby/gems/3.2.0/gems/rack-protection-3.1.0/lib/rack/protection/path_traversal.rb:18:in `call'
	/usr/local/lib/ruby/gems/3.2.0/gems/rack-protection-3.1.0/lib/rack/protection/json_csrf.rb:28:in `call'
	/usr/local/lib/ruby/gems/3.2.0/gems/rack-protection-3.1.0/lib/rack/protection/base.rb:53:in `call'
	/usr/local/lib/ruby/gems/3.2.0/gems/rack-protection-3.1.0/lib/rack/protection/base.rb:53:in `call'
	/usr/local/lib/ruby/gems/3.2.0/gems/rack-protection-3.1.0/lib/rack/protection/frame_options.rb:33:in `call'
	/usr/local/lib/ruby/gems/3.2.0/gems/rack-2.2.8/lib/rack/logger.rb:17:in `call'
	/usr/local/lib/ruby/gems/3.2.0/gems/rack-2.2.8/lib/rack/common_logger.rb:38:in `call'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:261:in `call'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:254:in `call'
	/usr/local/lib/ruby/gems/3.2.0/gems/rack-2.2.8/lib/rack/head.rb:12:in `call'
	/usr/local/lib/ruby/gems/3.2.0/gems/rack-2.2.8/lib/rack/method_override.rb:24:in `call'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/show_exceptions.rb:23:in `call'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:219:in `call'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:2074:in `call'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:1633:in `block in call'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:1849:in `synchronize'
	/usr/local/lib/ruby/gems/3.2.0/gems/sinatra-3.1.0/lib/sinatra/base.rb:1633:in `call'
	/usr/local/lib/ruby/gems/3.2.0/gems/puma-6.3.1/lib/puma/configuration.rb:270:in `call'
	/usr/local/lib/ruby/gems/3.2.0/gems/puma-6.3.1/lib/puma/request.rb:100:in `block in handle_request'
	/usr/local/lib/ruby/gems/3.2.0/gems/puma-6.3.1/lib/puma/thread_pool.rb:344:in `with_force_shutdown'
	/usr/local/lib/ruby/gems/3.2.0/gems/puma-6.3.1/lib/puma/request.rb:99:in `handle_request'
	/usr/local/lib/ruby/gems/3.2.0/gems/puma-6.3.1/lib/puma/server.rb:443:in `process_client'
	/usr/local/lib/ruby/gems/3.2.0/gems/puma-6.3.1/lib/puma/server.rb:245:in `block in run'
	/usr/local/lib/ruby/gems/3.2.0/gems/puma-6.3.1/lib/puma/thread_pool.rb:151:in `block in spawn_thread'
127.0.0.1 - - [23/Aug/2023:18:57:08 -0700] "GET /__sinatra__/500.png HTTP/1.1" 200 24378 0.0187
127.0.0.1 - - [23/Aug/2023:18:57:08 -0700] "GET /favicon.ico HTTP/1.1" 404 469 0.0023

UI:
Screen Shot 2023-08-23 at 6 58 53 PM

What is expected?

Able to connect to the Chroma DB.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.