你說:
Write a browser-side app that uses google's gemini pro api to chat in a standalone HTML. Requirements are listed as follows:
(1) Save my Gemini key in a local storage.
(2) Support the conversation history and save it a local storage. Add a button to clear the conversation history so that gemini is aware of the context of previous messages. Allow the user to set the token usage threshold, compare it with tokens used in the metadata of gemini pro api response and alert the user if beyond the thrshold.
(3) Use marked.js to display Gemini messages.
(4) Use the textarea element for user to paste multi-line text.
(5) Use highlight.js to check the code language automatically and highlight its code block if any.
(6) Add one feature that uses free Google Translate API (https://translate.googleapis.com/translate_a/single) to translate the Gemini message to any language and append the translated message to the "normal" Gemini message. Provide an HTML element for the user to enable/disable the translation feature. Use select and option elements for the user to select output language which defaults to Simplified Chinese. Languages also support Traditional Chinese, Japanese, English and Spanish. Note that the translated text may not have the same format as the input text and marked.js may not handle it well.
(7) Maximize the display window. Maximize the message window and minimize control/config buttons except the send message button.