Skip to content

Commit

Permalink
+ new postgres table schemas to nix.flake
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnyjohnson1 committed Oct 31, 2024
1 parent d45c87b commit e5d04b7
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .env_dev
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ONE_API_API_KEY="sk-oneapi.local123"
SUPABASE_URL=
SUPABASE_KEY=
POSTGRES_DB=test_topos_db
POSTGRES_USER=username
POSTGRES_PASSWORD=your_password
POSTGRES_USER=jonny
POSTGRES_PASSWORD=1234589034
POSTGRES_HOST=127.0.0.1
POSTGRES_PORT=5432
15 changes: 15 additions & 0 deletions .env_template
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
NEO4J_URI="bolt://localhost:7687"
NEO4J_USER="neo4j"
NEO4J_PASSWORD="password"
NEO4J_TEST_DATABASE="neo4j"
NEO4J_SHOWROOM_DATABASE="neo4j"
JWT_SECRET="terces_tj"
OPEN_AI_API_KEY="sk-openai.com123"
ONE_API_API_KEY="sk-oneapi.local123"
SUPABASE_URL=
SUPABASE_KEY=
POSTGRES_DB=test_topos_db
POSTGRES_USER=username
POSTGRES_PASSWORD=your_password_here
POSTGRES_HOST=127.0.0.1
POSTGRES_PORT=5432
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,6 @@ topos/cloudbuild.yaml
dockerfile

topos.app
/pgdata
/pgdata
/data
/result
29 changes: 26 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,30 @@
<img src="https://github.com/jonnyjohnson1/topos-cli/blob/main/topos/assets/topos_blk_rounded.png" style="width: 70px; height: 70px;" alt="Private LLMs" />
</p>
<p align="center">
<em>Private AI Backend Service</em>
<em>Private, Personal AI Backend Service</em>
</p>

---

# Topos
A personal intelligence service, using your own computer to power private conversations with friends, family, and coworkers, collect/store your own private data, and use AI privately. Runs great with the [chat arena](https://github.com/jonnyjohnson1/chat-arena) app available on desktop and mobile.
Topos is a private, personal AI and database management service.
It comes as an easy-to-install server for your AI apps to connect to.

Tech: ollama, postgres, FastAPI, nixOS, huggingface-transformers
It is a personal intelligence service, using your own computer to power private conversations with friends, family, and coworkers, collect/store your own private data, and use AI privately.

Apps Using Topos:
- [chat arena](https://github.com/jonnyjohnson1/chat-arena) #desktop #mobile

Tech: nixOS, ollama, postgres, FastAPI, huggingface-transformers

<p align="center">
<img src="https://github.com/jonnyjohnson1/topos-cli/blob/main/topos/assets/tui.png" style="zoom:67%;" alt="Terminal User Interface" />
</p>
<p align="center">
<em>Runs the Terminal User Interface provided by [F1bonacc1](https://github.com/F1bonacc1/process-compose)</em>
</p>

---

## (MacOS) Easy Install With .dmg
*(Experimental)*: This is new, and should work on most MacOS machines!
Expand Down Expand Up @@ -46,6 +61,14 @@ run built binary
./result/bin/topos
```

(You might also try this)
```
nix build --extra-experimental-features nix-command --extra-experimental-features flakes --show-trace
```
```
./result/bin/services-flake-topos
```

### Dev Shell
```
nix develop
Expand Down
54 changes: 36 additions & 18 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -135,24 +135,42 @@
CREATE USER ${envVars.POSTGRES_USER} WITH SUPERUSER PASSWORD '${envVars.POSTGRES_PASSWORD}';
'';
after = ''
CREATE TABLE IF NOT EXISTS conversation_cache (
conv_id TEXT PRIMARY KEY,
message_data JSONB NOT NULL
);
CREATE TABLE IF NOT EXISTS entities (
id TEXT PRIMARY KEY,
label TEXT NOT NULL,
properties JSONB
);
CREATE TABLE IF NOT EXISTS relations (
source_id TEXT,
relation_type TEXT,
target_id TEXT,
properties JSONB,
PRIMARY KEY (source_id, relation_type, target_id)
);
CREATE TABLE IF NOT EXISTS conversation (
message_id VARCHAR PRIMARY KEY,
conv_id VARCHAR NOT NULL,
userid VARCHAR NOT NULL,
timestamp TIMESTAMP NOT NULL,
name VARCHAR,
role VARCHAR NOT NULL,
message TEXT NOT NULL
);
-- Create the utterance_token_info table
CREATE TABLE IF NOT EXISTS utterance_token_info (
message_id VARCHAR PRIMARY KEY,
conv_id VARCHAR NOT NULL,
userid VARCHAR NOT NULL,
name VARCHAR,
role VARCHAR NOT NULL,
timestamp TIMESTAMP NOT NULL,
ents JSONB
);
-- Create the utterance_text_info table
CREATE TABLE IF NOT EXISTS utterance_text_info (
message_id VARCHAR PRIMARY KEY,
conv_id VARCHAR NOT NULL,
userid VARCHAR NOT NULL,
name VARCHAR,
role VARCHAR NOT NULL,
timestamp TIMESTAMP NOT NULL,
moderator JSONB,
mod_label VARCHAR,
tern_sent JSONB,
tern_label VARCHAR,
emo_27 JSONB,
emo_27_label VARCHAR
);
GRANT ALL PRIVILEGES ON DATABASE ${envVars.POSTGRES_DB} TO ${envVars.POSTGRES_USER};
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO ${envVars.POSTGRES_USER};
Expand Down
Binary file added topos/assets/tui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e5d04b7

Please sign in to comment.