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

Handle splitting of long content #101

Open
tomharrigan opened this issue Nov 2, 2017 · 0 comments
Open

Handle splitting of long content #101

tomharrigan opened this issue Nov 2, 2017 · 0 comments
Labels

Comments

@tomharrigan
Copy link
Owner

Issue: If post content is longer than 8k chars, it will cut off the remainder and abruptly end the response. This affects the News functionality for sufficiently long content.

Ref: https://developer.amazon.com/docs/custom-skills/request-and-response-json-reference.html#response-format

Output speech has a max length of 8000 chars.
Total response cannot be greater than 24kb

Possible solutions:

  1. If post is greater than 8000 chars: split post content into an array where each key contains the first n paragraphs that are less than or equal to 8k chars. Store the remaining post contents as attributes and prompt the user after finishing the first block of content for whether they want to continue or not, and then deliver the next block of content.
    The problem with this approach is that it's still possible for issue to occur if the total size of the article content along with the rest of the response is greater than 24kb.

  2. If post is greater than 8000 chars: split post content into an array where each key contains the first n paragraphs that are less than or equal to 8k chars. Store the remaining post contents in cache using the transients API. Store a user attribute of the current array index, and an attribute for the number of keys in the index. If the index is not the last item of the array, prompt the user for if they want to continue once they reach the end of the block, and grab the next block from cache.

@tomharrigan tomharrigan added the bug label Nov 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant