Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/jonnyjohnson1/topos-cli int…
Browse files Browse the repository at this point in the history
…o chris/debate_update_July

# Conflicts:
#	.env_dev
#	.gitignore
#	accounts.json
#	topos/api/websocket_handlers.py
#	topos/channel/debatesim.py
#	topos/chat_api/chat_server.py
#	topos/chat_api/client.py
  • Loading branch information
psionic81 committed Aug 10, 2024
2 parents 49d2f8b + 59db080 commit 918dceb
Show file tree
Hide file tree
Showing 61 changed files with 858 additions and 1,030 deletions.
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
/topos/test/_conv_cache/*
!/topos/test/_conv_cache/.gitignore

# cert files
*.pem

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down Expand Up @@ -99,7 +101,14 @@ ipython_config.py
/_cache
/_conv_cache

/.env
.DS_Store
/topos/test/accounts.json
/.env
.env
chat_api_gcp/
topos/credentials.json
topos/justfile
topos/cloudbuild.yaml
dockerfile

topos.app
32 changes: 25 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,21 @@
A simple api to use your local machine to play chat games over in the [chat arena](https://github.com/jonnyjohnson1/chat-arena).

Game options are:
1. Debate
1. Debate


## Install with nix (Recommended)
1. Install nix:
macos/linux: `sh <(curl -L https://nixos.org/nix/install)`
windows: `sh <(curl -L https://nixos.org/nix/install) --daemon`
2. Download this repo `git clone https://github.com/jonnyjohnson1/topos-cli`
3. `cd topos-cli`
4. build the backend service: `nix-shell`
5.
```
topos set --spacy trf // set this value. It only needs to be set once.
topos run // start topos
```

## Install Instructions
requires `brew install just`
Expand Down Expand Up @@ -34,16 +48,20 @@ Use the tag like this.
`topos run --local`

### Step 4a (zrok): Set up web proxy
We are going to expose our backend service to a public network so our phone/tablet can use it. In this case, we use zrok. Below, is an ngrok setup version.
We are going to expose our backend service to a public network so our phone/tablet can use it. In this case, we use zrok. Below is are the guides to set up ngrok.

zrok is opensourced and free.
ngrok has a gated requests/month under its free tier, then requires you pay for it.

1. [Install zrok command](https://docs.zrok.io/docs/getting-started/?_gl=1*1yet1eb*_ga*MTQ1MDc2ODAyNi4xNzE3MDE3MTE3*_ga_V2KMEXWJ10*MTcxNzAxNzExNi4xLjAuMTcxNzAxNzExNi42MC4wLjA.*_gcl_au*NDk3NjM1MzEyLjE3MTcwMTcxMTc.#installing-the-zrok-command)
2. `zrok enable <given_key>`
3. `zrok status` should show you information
4. Route local path through zrok: `zrok share public http://0.0.0.0:13341`
1. Be sure you have the `topos` server running already in another terminal.
2. [Install zrok command](https://docs.zrok.io/docs/getting-started/?_gl=1*1yet1eb*_ga*MTQ1MDc2ODAyNi4xNzE3MDE3MTE3*_ga_V2KMEXWJ10*MTcxNzAxNzExNi4xLjAuMTcxNzAxNzExNi42MC4wLjA.*_gcl_au*NDk3NjM1MzEyLjE3MTcwMTcxMTc.#installing-the-zrok-command)
3. `zrok enable <given_key>`
4. `zrok status` should show you information
5. Route local path through zrok: `zrok share public http://0.0.0.0:13341`
This will take you to a new screen with an https://<url> at the top.
Insert this url into the field under settings-> "Api Endpoints" -> "Custom API"
5. After you've insert it into the field, press the test button, and "hello world" should appear next to the button.
6. After you've insert it into the field, press the test button, and "hello world" should appear next to the button.

[ ] Enable permanent sharing of zrok url [docs](https://docs.zrok.io/docs/guides/docker-share/#permanent-public-share) (requires Docker)

### Step 4b (ngrok): Set up web proxy
Empty file removed active_sessions.pkl
Empty file.
1 change: 0 additions & 1 deletion config.yaml

This file was deleted.

16 changes: 16 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{ pkgs ? import <nixpkgs> {} }:

let
python = pkgs.python3;

in pkgs.mkShell {
buildInputs = [
pkgs.just
pkgs.poetry
];

shellHook = ''
just build
topos run
'';
}
11 changes: 10 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,13 @@ zrok_chat:
zrok share public http://0.0.0.0:13394

cert:
openssl req -x509 -newkey rsa:4096 -nodes -out cert.pem -keyout key.pem -days 365
openssl req -x509 -newkey rsa:4096 -nodes -out topos/cert.pem -keyout topos/key.pem -days 365

python:
pyi-makespec --onefile main.py
# add ('topos/config.yaml', 'topos/')
pyinstaller main.spec
create-dmg 'dist/main' --overwrite

dmg:
create-dmg topos.app --volicon "topos/assets/topos_blk_rounded.png" --icon "topos/assets/topos_blk_rounded.png"
Binary file removed plots/sentence_edge_detection.png
Binary file not shown.
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ homepage = "https://dialogues.ai"
python = "^3.9"
httpx = "^0.27.0"
fastapi = "0.109.2"
langchain = "0.1.4"
uvicorn = "0.20.0"
websockets = "11.0.3"
ollama = "0.1.9"
spacy = "3.7.2"
pydantic = "2.7.4"
transformers = "4.40.2"
torch = "2.3.0"
diffusers = "0.27.2"
Expand All @@ -39,6 +39,7 @@ python-multipart = "^0.0.9"
pytest-asyncio = "^0.23.7"
textblob = "^0.18.0.post0"
tk = "0.1.0"
pystray = "0.19.5"

supabase = "^2.6.0"
psycopg2-binary = "^2.9.9"
Expand Down
Binary file added topos.dmg
Binary file not shown.
6 changes: 6 additions & 0 deletions topos/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
NEO4J_URI="bolt://localhost:7687"
NEO4J_USER="neo4j"
NEO4J_PASSWORD="password"
NEO4J_TEST_DATABASE="neo4j"
NEO4J_SHOWROOM_DATABASE="neo4j"
JWT_SECRET="j1234cquwn09er8nvq0c9"
6 changes: 6 additions & 0 deletions topos/.env_dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
NEO4J_URI="bolt://localhost:7687"
NEO4J_USER="neo4j"
NEO4J_PASSWORD="password"
NEO4J_TEST_DATABASE="neo4j"
NEO4J_SHOWROOM_DATABASE="neo4j"
JWT_SECRET="terces_tj"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 0 additions & 1 deletion topos/FC/semantic_compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

# from dotenv import load_dotenv
from openai import OpenAI
from langchain_community.llms import Ollama
from topos.FC.cache_manager import CacheManager
from topos.FC.similitude_module import load_model, util

Expand Down
208 changes: 0 additions & 208 deletions topos/api-bak.py

This file was deleted.

7 changes: 6 additions & 1 deletion topos/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,9 @@ def start_local_api():
def start_web_api():
"""Function to start the API in web mode with SSL."""
certs = get_ssl_certificates()
uvicorn.run(app, host="0.0.0.0", port=13341, ssl_keyfile=certs['key_path'], ssl_certfile=certs['cert_path'])
uvicorn.run(app, host="0.0.0.0", port=13341, ssl_keyfile=certs['key_path'], ssl_certfile=certs['cert_path'])


def start_hosted_service():
"""Function to start the API in web mode with SSL."""
uvicorn.run(app, host="0.0.0.0", port=8000)
Loading

0 comments on commit 918dceb

Please sign in to comment.