Skip to content

Commit

Permalink
0.13.07 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
palladius committed Sep 14, 2023
1 parent f1f9ab8 commit cd2bfd9
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
2023-09-14 0.13.07 Fix TODO Not primogenito copy instead adding force: true. Also fixing TranslatedTitle to TS.
2023-09-13 0.13.06 Images on Stories are now destroyable..
2023-09-13 0.13.05 patching finally the INTERESTS and making the Txt AI call smarter. Various fixes.
2023-09-13 0.13.04 bugfix, moved story score from 0..100 to -100..100 (so now default=0 has becom from shit to average joe)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.13.06
0.13.07
7 changes: 4 additions & 3 deletions app/models/story_paragraph.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,16 @@ def generate_audio_transcript(opts={})
end

def generate_ai_images!(gcp_opts = {})
opts_force = gcp_opts.fetch :force, false
# puts 'TODO if multiple images then write MANY images :)'
# genai_input_for_image
if translated_story.primogenito?
if opts_force or translated_story.primogenito? #
puts("generate_ai_images(force=#{opts_force}, pg=?): Im primogenito (or you called me with force=true) -> generating images")
# first born: create them
multiple_images = genai_compute_multiple_images_by_decription(p_images, genai_input_for_image, gcp_opts)
else
# I'm not the first born, I should copy images from it.
puts 'TODO Not primogenito copy instead'
puts("generate_ai_images(): Im NOT primogenito -> copying from PrimoGenito")
copy_images_from_primogenito_sp
# return 1040 # TODO: in carlessian numeric
# copy_images_from(translated_story.primogenito)
Expand Down Expand Up @@ -164,7 +166,6 @@ def copy_images_from_primogenito_sp
def fix
copy_images_from_primogenito_sp unless translated_story.primogenito?
after_creation_magic
# not generate_ai_images!
end

def fix!
Expand Down
9 changes: 5 additions & 4 deletions app/models/translated_story.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,17 @@ def excerpt(max_size = 35)
flag + ' ' + translated_title.to_s.gsub('Translation of:', '').first(max_size) + '..'
end

def fix!
# if you call with force: true it forces generation of images..
def fix!(opts={})
puts 'Fixing the children paragraphs even if not needed...'
story_paragraphs.each do |story_paragraph|
id = story_paragraph.id
puts "Forcing redo image for #{id}"
story_paragraph.generate_ai_images!
story_paragraph.generate_ai_images!(opts)
end
end

def fix
def fix(opts={})
fix_missing_attributes
# Check children translated_stories for missing images
fix_missing_audios
Expand All @@ -142,7 +143,7 @@ def fix
puts "TS(#{self.id}).fix(): PRIMOGENITO: I'm generating missing images"
paragraphs_with_no_images.each do |id|
puts "Missing image for #{id}"
StoryParagraph.find(id).generate_ai_images!
StoryParagraph.find(id).generate_ai_images!(opts)
end
else
puts "TS(#{self.id}).fix(): SECONDOGENITO: I'm copying existing images from priomogenito.. and maybe fix him later"
Expand Down
7 changes: 7 additions & 0 deletions app/views/translated_stories/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
<%= form.text_area :name, class: 'form-control form-control-sm' %>
</div>

<div>
<%= form.label :translated_title, style: "display: block", class: 'form-control-sm' %>
<%= form.text_field :translated_title, class: 'form-control form-control-sm' %>
</div>



<div>
<%= form.label :user_id, style: "display: block", class: 'form-control' %>
<%#= form.text_field :user_id %>
Expand Down
16 changes: 12 additions & 4 deletions app/views/translated_stories/_translated_story-bootstrap.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@
<%= image_tag translated_story.user.avatar.variant(resize_to_limit: [50, 50]) if translated_story.user.avatar.attached? %>
</p>
-->

<p>
<strong>Translated Title:</strong>
<%= translated_story.translated_title %>
</p>

<p>
<strong>Summary:</strong>
<%= translated_story.story.genai_summary rescue $! %>
</p>


<p>
<strong>Story #<%= translated_story.story_id %>:</strong>
<%= link_to(translated_story.story.title, translated_story.story) %>
Expand Down Expand Up @@ -43,10 +55,6 @@
</p>


<p>
<strong>Summary:</strong>
<%= translated_story.story.genai_summary rescue $! %>
</p>

<p>
<strong>Paragraphs:</strong>
Expand Down
Binary file modified db/development.sqlite3
Binary file not shown.

0 comments on commit cd2bfd9

Please sign in to comment.