Skip to content

Add share and direct links for image responses#408

Open
rong3000 wants to merge 1 commit intochenyme:mainfrom
rong3000:feature/share-image-direct-links
Open

Add share and direct links for image responses#408
rong3000 wants to merge 1 commit intochenyme:mainfrom
rong3000:feature/share-image-direct-links

Conversation

@rong3000
Copy link
Copy Markdown

Summary

  • add return_share_url support for image and chat image flows
  • resolve Grok share pages to real assets.grok.com image URLs through the public rest/app-chat/share_links/<publicId> JSON, without requiring Chrome/CDP at runtime
  • prefer final generated images over preview chunks when collecting image outputs
  • update the built-in /chat page to show image results plus share/direct links for image-generation prompts
  • keep normal /chat streaming behavior unchanged for non-image prompts

Testing

  • python3 -m py_compile app/api/v1/chat.py app/api/v1/image.py app/services/grok/services/chat.py app/services/grok/services/image.py app/services/grok/utils/process.py app/services/grok/utils/share_resolver.py app/services/reverse/app_chat_share.py tests/test_openai_usage.py tests/test_image_share.py tests/test_process_images.py
  • node --check _public/static/function/js/chat.js
  • manual API verification:
    • POST /v1/images/share/resolve returns share_image_url as https://assets.grok.com/...
    • POST /v1/images/generations returns share_url and share_image_url
    • POST /v1/chat/completions with grok-4.20-beta returns image content plus share_url and share_image_url

Notes

  • runtime share-link resolution no longer depends on a local browser session
  • the /chat page only switches to non-stream responses for image-generation scenarios, so ordinary chat keeps the existing streaming UX

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.

1 participant