Add the ask command

This commit is contained in:
Stanko K.R.
2025-07-31 13:25:49 +02:00
parent 445ae632cc
commit 13eeb8574d
33 changed files with 969 additions and 3 deletions
@@ -0,0 +1,10 @@
class CreateConversations < ActiveRecord::Migration[8.1]
def change
create_table :conversations do |t|
t.belongs_to :user, null: false, foreign_key: true, index: { unique: true }
t.string :state, :string
t.timestamps
end
end
end
@@ -0,0 +1,16 @@
class CreateConversationMessages < ActiveRecord::Migration[8.1]
def change
create_table :conversation_messages do |t|
t.belongs_to :conversation, null: false, foreign_key: true
t.string :role
t.string :model_id
t.bigint :input_tokens
t.bigint :output_tokens
t.bigint :input_cost_microcents
t.bigint :output_cost_microcents
t.bigint :cost_microcents
t.timestamps
end
end
end
Generated
+26
View File
@@ -208,6 +208,30 @@ ActiveRecord::Schema[8.1].define(version: 2025_08_12_195130) do
t.index ["card_id"], name: "index_comments_on_card_id"
end
create_table "conversation_messages", force: :cascade do |t|
t.string "client_message_id", null: false
t.integer "conversation_id", null: false
t.bigint "cost_microcents"
t.datetime "created_at", null: false
t.bigint "input_cost_microcents"
t.bigint "input_tokens"
t.string "model_id"
t.bigint "output_cost_microcents"
t.bigint "output_tokens"
t.string "role", null: false
t.datetime "updated_at", null: false
t.index ["conversation_id"], name: "index_conversation_messages_on_conversation_id"
end
create_table "conversations", force: :cascade do |t|
t.datetime "created_at", null: false
t.string "state"
t.string "string"
t.datetime "updated_at", null: false
t.integer "user_id", null: false
t.index ["user_id"], name: "index_conversations_on_user_id", unique: true
end
create_table "creators_filters", id: false, force: :cascade do |t|
t.integer "creator_id", null: false
t.integer "filter_id", null: false
@@ -438,6 +462,8 @@ ActiveRecord::Schema[8.1].define(version: 2025_08_12_195130) do
add_foreign_key "commands", "commands", column: "parent_id"
add_foreign_key "commands", "users"
add_foreign_key "comments", "cards"
add_foreign_key "conversation_messages", "conversations"
add_foreign_key "conversations", "users"
add_foreign_key "events", "collections"
add_foreign_key "mentions", "users", column: "mentionee_id"
add_foreign_key "mentions", "users", column: "mentioner_id"
+157
View File
@@ -634,6 +634,125 @@ columns:
- *24
- *6
- *9
conversation_messages:
- !ruby/object:ActiveRecord::ConnectionAdapters::SQLite3::Column
auto_increment:
name: client_message_id
cast_type: *7
sql_type_metadata: *8
'null': false
default:
default_function:
collation:
comment:
- !ruby/object:ActiveRecord::ConnectionAdapters::SQLite3::Column
auto_increment:
name: conversation_id
cast_type: *3
sql_type_metadata: *4
'null': false
default:
default_function:
collation:
comment:
- !ruby/object:ActiveRecord::ConnectionAdapters::SQLite3::Column
auto_increment:
name: cost_microcents
cast_type: *11
sql_type_metadata: *12
'null': true
default:
default_function:
collation:
comment:
- *5
- *6
- !ruby/object:ActiveRecord::ConnectionAdapters::SQLite3::Column
auto_increment:
name: input_cost_microcents
cast_type: *11
sql_type_metadata: *12
'null': true
default:
default_function:
collation:
comment:
- !ruby/object:ActiveRecord::ConnectionAdapters::SQLite3::Column
auto_increment:
name: input_tokens
cast_type: *11
sql_type_metadata: *12
'null': true
default:
default_function:
collation:
comment:
- !ruby/object:ActiveRecord::ConnectionAdapters::SQLite3::Column
auto_increment:
name: model_id
cast_type: *7
sql_type_metadata: *8
'null': true
default:
default_function:
collation:
comment:
- !ruby/object:ActiveRecord::ConnectionAdapters::SQLite3::Column
auto_increment:
name: output_cost_microcents
cast_type: *11
sql_type_metadata: *12
'null': true
default:
default_function:
collation:
comment:
- !ruby/object:ActiveRecord::ConnectionAdapters::SQLite3::Column
auto_increment:
name: output_tokens
cast_type: *11
sql_type_metadata: *12
'null': true
default:
default_function:
collation:
comment:
- !ruby/object:ActiveRecord::ConnectionAdapters::SQLite3::Column
auto_increment:
name: role
cast_type: *7
sql_type_metadata: *8
'null': false
default:
default_function:
collation:
comment:
- *9
conversations:
- *5
- *6
- !ruby/object:ActiveRecord::ConnectionAdapters::SQLite3::Column
auto_increment:
name: state
cast_type: *7
sql_type_metadata: *8
'null': true
default:
default_function:
collation:
comment:
- !ruby/object:ActiveRecord::ConnectionAdapters::SQLite3::Column
auto_increment:
name: string
cast_type: *7
sql_type_metadata: *8
'null': true
default:
default_function:
collation:
comment:
- *9
- *25
creators_filters:
- *24
- *19
@@ -1201,6 +1320,8 @@ primary_keys:
collections_filters:
commands: id
comments: id
conversation_messages: id
conversations: id
creators_filters:
entropy_configurations: id
event_activity_summaries: id
@@ -1248,6 +1369,8 @@ data_sources:
collections_filters: true
commands: true
comments: true
conversation_messages: true
conversations: true
creators_filters: true
entropy_configurations: true
event_activity_summaries: true
@@ -1948,6 +2071,40 @@ indexes:
nulls_not_distinct:
comment:
valid: true
conversation_messages:
- !ruby/object:ActiveRecord::ConnectionAdapters::IndexDefinition
table: conversation_messages
name: index_conversation_messages_on_conversation_id
unique: false
columns:
- conversation_id
lengths: {}
orders: {}
opclasses: {}
where:
type:
using:
include:
nulls_not_distinct:
comment:
valid: true
conversations:
- !ruby/object:ActiveRecord::ConnectionAdapters::IndexDefinition
table: conversations
name: index_conversations_on_user_id
unique: true
columns:
- user_id
lengths: {}
orders: {}
opclasses: {}
where:
type:
using:
include:
nulls_not_distinct:
comment:
valid: true
creators_filters:
- !ruby/object:ActiveRecord::ConnectionAdapters::IndexDefinition
table: creators_filters