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

HIGH PRIORITY - Attach images to prompts #332

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

atrokhym
Copy link

image
image

@atrokhym atrokhym changed the title image-upload HIGH PRIORITY - Attach images to prompts Nov 19, 2024
@chrismahoney
Copy link
Collaborator

Could you please post a video of how the interface works? This is a major feature involving vision, so it may have to be prioritized against the roadmap in the coming days. Thanks for the submission!

@chrismahoney chrismahoney added enhancement New feature or request question Further information is requested labels Nov 19, 2024
@wonderwhy-er
Copy link
Collaborator

We also have many models and providers, probably we need to disable such features when untested provider/model are used

messages,
children, // Add this
}, ref) => {
console.log(provider);

Choose a reason for hiding this comment

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

this should be removed

Comment on lines 24 to 26
// function sanitizeUserMessage(content: string) {
// return content.replace(modificationsRegex, '').replace(MODEL_REGEX, 'Using: $1').replace(PROVIDER_REGEX, ' ($1)\n\n').trim();
// }

Choose a reason for hiding this comment

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

this commented block should be removed

// Extract model
const modelMatch = message.content.match(MODEL_REGEX);
// const modelMatch = message.content.match(MODEL_REGEX);

Choose a reason for hiding this comment

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

this comment should be removed

const model = modelMatch ? modelMatch[1] : DEFAULT_MODEL;

// Extract provider
const providerMatch = message.content.match(PROVIDER_REGEX);
// const providerMatch = message.content.match(PROVIDER_REGEX);

Choose a reason for hiding this comment

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

this comment should be removed

if (item.type === 'text') {
return {
type: 'text',
text: item.text?.replace(/\[Model:.*?\]\n\n/, '').replace(/\[Provider:.*?\]\n\n/, '')

Choose a reason for hiding this comment

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

these regexes are being repeated multiple times, can you use MODEL_REGEX and PROVIDER_REGEX or add them to constants.ts?

Comment on lines 74 to 80
// console.log('=== API CHAT LOGGING START ===');
// console.log('StreamText:', JSON.stringify({
// messages,
// result,
// }, null, 2));
// console.log('=== API CHAT LOGGING END ===');

Choose a reason for hiding this comment

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

these comments should be removed

package.json Outdated
@@ -73,6 +73,7 @@
"jose": "^5.6.3",
"js-cookie": "^3.0.5",
"jszip": "^3.10.1",
"lucide-react": "^0.460.0",

Choose a reason for hiding this comment

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

this package is not needed and should be removed

pnpm-lock.yaml Outdated
Comment on lines 9350 to 9353
[email protected]([email protected]):
dependencies:
react: 18.3.1

Choose a reason for hiding this comment

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

it should be removed

@@ -204,7 +203,7 @@ export const EditorPanel = memo(
const isActive = activeTerminal === index;

return (
<React.Fragment key={index}>

Choose a reason for hiding this comment

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

what is the reason of removing the index key?

Copy link
Collaborator

@chrismahoney chrismahoney Nov 19, 2024

Choose a reason for hiding this comment

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

Removing that key will throw an error, which is why it's a React.Fragment instead of <></> - please revert

Comment on lines 13 to 15
const textContent = Array.isArray(sanitizedContent)
? sanitizedContent.find(item => item.type === 'text')?.text || ''
: sanitizedContent;

Choose a reason for hiding this comment

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

can this be merged/inserted inside sanitizeUserMessage function? otherwise you are unnecessarily looping twice over the contents

@pjmartorell
Copy link

We also have many models and providers, probably we need to disable such features when untested provider/model are used

The upload button could be only available for those models with vision capabilities and frozen/disabled for the others. The dynamic LLMs can be fetched from the OpenRouter API and filter those which have "modality": "text+image->text". The ones that are hardcoded can be flagged in the constants.ts

@coleam00
Copy link
Owner

@atrokhym Thank you so much for this, I hope we can get it merged in soon! I appreciate your reviews a ton too @pjmartorell, fantastic!

@atrokhym
Copy link
Author

@pjmartorell
thank you for doing my PR review.
i think i incorporated changes you requested. pls take a look
thanks a lot!

@coleam00
Copy link
Owner

@atrokhym Thank you! Let me know if you can get around to reviewing again @pjmartorell!

@atrokhym
Copy link
Author

@atrokhym Thank you! Let me know if you can get around to reviewing again @pjmartorell!
@coleam00 -i did run though those issues @pjmartorell noted.
i implemented all of them and ping him to review again. there are few commits after that.
also - should mention - i might missing something about process like who do what, notifications, etc...
so pls correct or point me in right direction.
this is my first git hub public PR :-)

@rxyshww
Copy link

rxyshww commented Nov 25, 2024

This function is really great! May I ask when the merger will take place?

@coleam00
Copy link
Owner

@atrokhym Would you say this is all ready to go? I can review this within the next couple of days too!

@atrokhym
Copy link
Author

@atrokhym Would you say this is all ready to go? I can review this within the next couple of days too!

it was ready for merge couple of days back...but now more conflicts from main branch are coming...so i need to resolve them first...will do ASAP

@coleam00
Copy link
Owner

Sounds good, thank you so much @atrokhym! I would love to showcase this for my update video on Sunday!

@coleam00
Copy link
Owner

@atrokhym This is looking phenomenal!

There are a lot of merge conflicts with main right now - could you resolve those/rebase your branch on main?

Also I have a couple of suggestions to really make this PR shine:

  1. The "X" after you upload an image has a half circle that makes it look like the image is still uploading.
  2. Could you include a preview of the image in the chat messages so when you look at the chat history you can see the images that were uploaded?

Thank you for all your work on this!

@atrokhym
Copy link
Author

@coleam00 - could you do review, please?

@coleam00
Copy link
Owner

Looks good @atrokhym, thank you for fixing the conflicts! Did you get a chance to see my couple of suggestions as well?

@atrokhym
Copy link
Author

Looks good @atrokhym, thank you for fixing the conflicts! Did you get a chance to see my couple of suggestions as well?

yes and i think item-1 looks much better now

image

for item-2 - as of now i don't know to do it....i would need to do some research...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants