Skip to content

ready to share your asset link with an ai message description - #149

Open
Oswaldinho24k wants to merge 2 commits into
mainfrom
feature/ai-share-message
Open

ready to share your asset link with an ai message description#149
Oswaldinho24k wants to merge 2 commits into
mainfrom
feature/ai-share-message

Conversation

@Oswaldinho24k

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces AI-powered social media descriptions and enhances the sharing UI with loading states and cancellation.

  • Replaces the slug prop with the full asset object in ShareLink to access title/type.
  • Implements handleSharelinkWithAIDescription in Sharing, including streaming from /api/v1/ai/sugestions, spinner, and abort logic.
  • Extends the AI suggestions endpoint to handle a new "generate_social_description" intent.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
app/routes/assets/AssetPreview.tsx Updated ShareLink and Sharing to accept asset, added Spinner, async AI description logic, and improved SocialMedia buttons.
app/routes/api/v1/ai/sugestions.tsx Added handling for generate_social_description intent and streaming response.
Comments suppressed due to low confidence (1)

app/routes/assets/AssetPreview.tsx:117

  • The new AI-driven sharing logic (streaming, abort, spinner states) lacks tests. Adding unit/integration tests will help ensure correct behavior and catch future regressions.
export const Sharing = ({ link, asset }: { link: string; asset: Asset }) => {

}
}
setIsLoading(false);
return text; // Devuelve el texto generado

Copilot AI Jun 30, 2025

Copy link

Choose a reason for hiding this comment

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

Returning the state variable text here will yield the initial or stale value due to the async state update. Instead, accumulate the description in a local variable and return that.

Suggested change
return text; // Devuelve el texto generado
return accumulatedText; // Return the accumulated description

Copilot uses AI. Check for mistakes.
Comment on lines +228 to +229
onClick={() => {
const description = handleSharelinkWithAIDescription({

Copilot AI Jun 30, 2025

Copy link

Choose a reason for hiding this comment

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

This call to handleSharelinkWithAIDescription isn’t awaited, so description will be a Promise rather than the generated string. Mark the onClick callback async and use await here.

Suggested change
onClick={() => {
const description = handleSharelinkWithAIDescription({
onClick={async () => {
const description = await handleSharelinkWithAIDescription({

Copilot uses AI. Check for mistakes.
Comment thread app/routes/api/v1/ai/sugestions.tsx Outdated
});
}
}
// i want a new action where I return a description to share in social media based on the name, type and info from the asset i want to share/sell that is well structured based on the platfor it will be shareD

Copilot AI Jun 30, 2025

Copy link

Choose a reason for hiding this comment

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

The file and endpoint path use sugestions instead of the correct spelling suggestions. Renaming will improve clarity and prevent future confusion.

Suggested change
// i want a new action where I return a description to share in social media based on the name, type and info from the asset i want to share/sell that is well structured based on the platfor it will be shareD
// I want a new action where I return a description to share on social media based on the name, type, and info from the asset I want to share/sell that is well-structured based on the platform it will be shared on.

Copilot uses AI. Check for mistakes.
Comment on lines 348 to 353
<a rel="noreferrer" target="_blank" href={link}>
<button
disabled={isLoading}
onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeave}
onClick={onClick}

Copilot AI Jun 30, 2025

Copy link

Choose a reason for hiding this comment

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

Wrapping an action-only button in an anchor with href={link} (often undefined) can confuse screen readers and keyboard users. Consider removing the href when using a pure onClick or add an appropriate aria-label.

Suggested change
<a rel="noreferrer" target="_blank" href={link}>
<button
disabled={isLoading}
onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeave}
onClick={onClick}
{link ? (
<a rel="noreferrer" target="_blank" href={link}>
<button
disabled={isLoading}
onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeave}
onClick={onClick}
aria-label={name || "Social media button"}
className={twMerge(
"group bg-black rounded-full transition-all text-lg text-black flex items-center justify-center relative cursor-pointer "
)}
>
<div
className={cn(
"w-12 h-12 border-2 -translate-x-[2px] -translate-y-[2px] grid place-content-center text-2xl border-black bg-purple-600 rounded-full",
className
)}
>
{isLoading ? <Spinner /> : children}
</div>
<motion.div
ref={scope}
className={twMerge(
"absolute bg-dark dark:bg-[#1B1D22] -bottom-7 text-xs text-white px-2 py-1 rounded hidden group-hover:block"
)}
>
{name}
</motion.div>
</button>
</a>
) : (
<button
disabled={isLoading}
onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeave}
onClick={onClick}
aria-label={name || "Social media button"}

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Ese copilo es un loquillo 😝

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.

3 participants