@@ -36,8 +36,12 @@ def postgresql?
3636
3737 def acts_as_chat_declaration
3838 acts_as_chat_params = [ ]
39- acts_as_chat_params << "message_class: \" #{ options [ :message_model_name ] } \" " if options [ :message_model_name ]
40- acts_as_chat_params << "tool_call_class: \" #{ options [ :tool_call_model_name ] } \" " if options [ :tool_call_model_name ]
39+ if options [ :message_model_name ] != 'Message'
40+ acts_as_chat_params << "message_class: \" #{ options [ :message_model_name ] } \" "
41+ end
42+ if options [ :tool_call_model_name ] != 'ToolCall'
43+ acts_as_chat_params << "tool_call_class: \" #{ options [ :tool_call_model_name ] } \" "
44+ end
4145 if acts_as_chat_params . any?
4246 "acts_as_chat #{ acts_as_chat_params . join ( ', ' ) } "
4347 else
@@ -47,8 +51,8 @@ def acts_as_chat_declaration
4751
4852 def acts_as_message_declaration
4953 acts_as_message_params = [ ]
50- acts_as_message_params << "chat_class: \" #{ options [ :chat_model_name ] } \" " if options [ :chat_model_name ]
51- if options [ :tool_call_model_name ]
54+ acts_as_message_params << "chat_class: \" #{ options [ :chat_model_name ] } \" " if options [ :chat_model_name ] != 'Chat'
55+ if options [ :tool_call_model_name ] != 'ToolCall'
5256 acts_as_message_params << "tool_call_class: \" #{ options [ :tool_call_model_name ] } \" "
5357 end
5458 if acts_as_message_params . any?
@@ -60,7 +64,9 @@ def acts_as_message_declaration
6064
6165 def acts_as_tool_call_declaration
6266 acts_as_tool_call_params = [ ]
63- acts_as_tool_call_params << "message_class: \" #{ options [ :message_model_name ] } \" " if options [ :message_model_name ]
67+ if options [ :message_model_name ] != 'Message'
68+ acts_as_tool_call_params << "message_class: \" #{ options [ :message_model_name ] } \" "
69+ end
6470 if acts_as_tool_call_params . any?
6571 "acts_as_tool_call #{ acts_as_tool_call_params . join ( ', ' ) } "
6672 else
@@ -71,19 +77,18 @@ def acts_as_tool_call_declaration
7177 def create_migration_files
7278 # Create migrations with timestamps to ensure proper order
7379 # First create chats table
74- timestamp = Time . now . utc
7580 migration_template 'create_chats_migration.rb.tt' ,
76- "db/migrate/#{ timestamp . strftime ( '%Y%m%d%H%M%S' ) } _create_ #{ options [ :chat_model_name ] . tableize } .rb" # rubocop:disable Layout/LineLength
81+ "db/migrate/create_ #{ options [ :chat_model_name ] . tableize } .rb"
7782
78- # Then create tool_calls table with timestamp + 1 second
79- timestamp += 1
83+ # Then create tool_calls table
84+ sleep 1 # Ensure different timestamp
8085 migration_template 'create_tool_calls_migration.rb.tt' ,
81- "db/migrate/#{ timestamp . strftime ( '%Y%m%d%H%M%S' ) } _create_ #{ options [ :tool_call_model_name ] . tableize } .rb" # rubocop:disable Layout/LineLength
86+ "db/migrate/create_ #{ options [ :tool_call_model_name ] . tableize } .rb"
8287
83- # Finally create messages table with timestamp + 2 seconds
84- timestamp += 1
88+ # Finally create messages table
89+ sleep 1 # Ensure different timestamp
8590 migration_template 'create_messages_migration.rb.tt' ,
86- "db/migrate/#{ timestamp . strftime ( '%Y%m%d%H%M%S' ) } _create_ #{ options [ :message_model_name ] . tableize } .rb" # rubocop:disable Layout/LineLength
91+ "db/migrate/create_ #{ options [ :message_model_name ] . tableize } .rb"
8792 end
8893
8994 def create_model_files
@@ -97,8 +102,19 @@ def create_initializer
97102 end
98103
99104 def show_install_info
100- content = ERB . new ( File . read ( "#{ source_paths . first } /INSTALL_INFO.md.tt" ) ) . result ( binding )
101- say content
105+ say "\n ✅ RubyLLM installed!" , :green
106+
107+ say "\n Next steps:" , :yellow
108+ say ' 1. Run: rails db:migrate'
109+ say ' 2. Set your API keys in config/initializers/ruby_llm.rb'
110+ say " 3. Start chatting: #{ options [ :chat_model_name ] } .create!(model_id: 'gpt-4.1-nano').ask('Hello!')"
111+
112+ say "\n 📚 Full docs: https://rubyllm.com" , :cyan
113+
114+ say "\n ❤️ Love RubyLLM?" , :magenta
115+ say ' • Sponsor: https://github.com/sponsors/crmne'
116+ say ' • Try Chat with Work: https://chatwithwork.com'
117+ say "\n "
102118 end
103119 end
104120end
0 commit comments