Skip to content
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

Attach images to conversations as URLs #424

Merged
merged 12 commits into from
Nov 5, 2024
Merged

Conversation

krschacht
Copy link
Contributor

No description provided.

@jlvallelonga
Copy link
Contributor

@jlvallelonga jlvallelonga marked this pull request as ready for review October 29, 2024 02:55
config/application.rb Outdated Show resolved Hide resolved
protocol: Rails.application.config.app_url_protocol,
host: Rails.application.config.app_url_host,
port: Rails.application.config.app_url_port,
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes this: #398 (comment)

the problem is that the ActiveStorage::Current.url_options are set only during a request lifecycle (with ActiveStorage::SetCurrent) and workers don't run within the context of a request. This fix also allows you to get the url from within the rails console.

see: https://github.com/rails/rails/blob/main/activestorage/app/controllers/concerns/active_storage/set_current.rb
and: rails/rails#40855 (comment)
and: rails/rails#42520

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on dang, nice debugging on this. i couldn’t figure out what the difference was within the worker

@krschacht
Copy link
Contributor Author

Oh dang, I didn’t realize that Claude actually requires base64 encoding. I thought when I saw in the OpenAI docs that they suggest passing in the URLs that this meant it was the preferred method and I just assumed that would be the same for the other models.

That decreases the priority of this then. If it’s not too much more work, I think it’s still worth getting this for openai since that’s the most used model. But if you run into any blockers then we can always elect to merge in the improvements you have and defer the rest. I’m just sharing this aloud since I’m not sure where you’re at with this or if you’ve hit a blocker.

@jlvallelonga
Copy link
Contributor

Oh dang, I didn’t realize that Claude actually requires base64 encoding. I thought when I saw in the OpenAI docs that they suggest passing in the URLs that this meant it was the preferred method and I just assumed that would be the same for the other models.

That decreases the priority of this then. If it’s not too much more work, I think it’s still worth getting this for openai since that’s the most used model. But if you run into any blockers then we can always elect to merge in the improvements you have and defer the rest. I’m just sharing this aloud since I’m not sure where you’re at with this or if you’ve hit a blocker.

I think it's working with openai. just need to get these new env vars into github and the prod server (with appropriate values):

      APP_URL_PROTOCOL: "http"
      APP_URL_HOST: "localhost"
      APP_URL_PORT: "3000"

@krschacht
Copy link
Contributor Author

@jlvallelonga our production setup is using the credentials file. I did a recent commit on the other repo to add that. You can edit it with bin/rails credentials:edit --environment production and it lives in the repo. Only the encryption key is in the production env.

For github actions we should just add env to the rubyonrails.yml file

@jlvallelonga jlvallelonga merged commit 5e99b81 into main Nov 5, 2024
6 checks passed
@jlvallelonga jlvallelonga deleted the better-image-attaching branch November 5, 2024 01:26
@jlvallelonga
Copy link
Contributor

ah I just merged this thinking it was approved. Let me know if you want any changes and I can make those in another branch @krschacht

@krschacht
Copy link
Contributor Author

@jlvallelonga no problem, I'll give it a close look right now

krschacht added a commit that referenced this pull request Nov 5, 2024
@krschacht
Copy link
Contributor Author

New PR: #532

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants