-
Notifications
You must be signed in to change notification settings - Fork 572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add conversation API, introduce Exchange
history
#450
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works great, we should merge this in.
couple of questions (just want to discuss these, no changes required here):
- we introduce a new
data_dir
, is there a reason we need a separation between theindex_dir
and thedata_dir
? - a conversation id is unique by means of
(user_id, thread_id)
, can we make that the primary key instead?
dfd06a3
to
9cd545a
Compare
@nerdypepper
The
Storing an integer ID allows us to reference these rows in the future in a much easier way using a single |
In this PR, we add an sqlite database for storing conversation history. We also add a few endpoints for managing this history, namely listing, deleting, and retrieving conversations. The `ResponseState` struct has been simplified and refactored into the idea of an `Exchange`. Exchanges are stored directly in the corresponding `Conversation` for retrieval at a later date. To create new queries or modify existing ones, we can use `sqlx`. You'll need to `cargo install sqlx-cli` first, then these commands can be run from within `server/bleep`: - `sqlx database reset --database-url=sqlite://bleep.db`: This will set up the database from scratch, deleting an old database if it exists - `cargo sqlx prepare --database-url=sqlite://bleep.db`: This will update the `sqlx-data.json` file, which is nominally used to build the app without requiring a database instance. * Store conversation history in persistent db * Add conversation delete endpoint * Rework response to use Exchange list, add more routes * Address comments
In this PR, we add an sqlite database for storing conversation history. We also add a few endpoints for managing this history, namely listing, deleting, and retrieving conversations. The `ResponseState` struct has been simplified and refactored into the idea of an `Exchange`. Exchanges are stored directly in the corresponding `Conversation` for retrieval at a later date. To create new queries or modify existing ones, we can use `sqlx`. You'll need to `cargo install sqlx-cli` first, then these commands can be run from within `server/bleep`: - `sqlx database reset --database-url=sqlite://bleep.db`: This will set up the database from scratch, deleting an old database if it exists - `cargo sqlx prepare --database-url=sqlite://bleep.db`: This will update the `sqlx-data.json` file, which is nominally used to build the app without requiring a database instance. * Store conversation history in persistent db * Add conversation delete endpoint * Rework response to use Exchange list, add more routes * Address comments
In this PR, we add an sqlite database for storing conversation history. We also add a few endpoints for managing this history, namely listing, deleting, and retrieving conversations.
The
ResponseState
struct has been simplified and refactored into the idea of anExchange
. Exchanges are stored directly in the correspondingConversation
for retrieval at a later date.Using
sqlx
with the databaseTo create new queries or modify existing ones, we can use
sqlx
. You'll need tocargo install sqlx-cli
first, then these commands can be run from withinserver/bleep
:sqlx database reset --database-url=sqlite://bleep.db
: This will set up the database from scratch, deleting an old database if it existscargo sqlx prepare --database-url=sqlite://bleep.db
: This will update thesqlx-data.json
file, which is nominally used to build the app without requiring a database instance.