Welcome to your shiny new Codespace running Flask! We've got everything fired up and running for you to explore Flask.
You've got a blank canvas to work on from a git perspective as well. There's a single initial commit with the what you're seeing right now - where you go from here is up to you!
Everything you do here is contained within this one codespace. There is no repository on GitHub yet. If and when you’re ready you can click "Publish Branch" and we’ll create your repository and push up your project. If you were just exploring then and have no further need for this code then you can simply delete your codespace and it's gone forever.
To run this application:
flask --debug run
To run this project, you need to obtain a Gemini API Key from Google AI Studio. Follow these steps:
- Go to the Google AI Studio website.
- Sign in with your Google account.
- Navigate to the "API Keys" section.
- Click on "Create API Key" and follow the instructions.
- Copy the generated API Key.
After obtaining the Gemini API Key, you need to set it as an environment variable. Follow these steps:
- Open Command Prompt.
- Run the following command:
setx GEMINI_API "YOUR_API_KEY"
- Restart your Command Prompt or IDE to apply the changes.
- Open Terminal.
- Run the following command:
export GEMINI_API="YOUR_API_KEY"
- Add the above line to your shell configuration file (e.g.,
.bashrc
,.zshrc
) to make it persistent.
To run the Flask application, follow these steps:
- Ensure you have Python and Flask installed on your system.
- Set the
GEMINI_API
environment variable as described above. - Navigate to the project directory in your terminal.
- Run the following command to start the Flask application:
flask --debug run
- Open your web browser and go to
http://localhost:5000
to access the application.
We have made several visual improvements to the chat application to enhance its appearance and user experience.
- Updated the background color to a gradient for a more modern look.
- Added padding and margin to the chat messages for better spacing.
- Updated the button styles to be more visually appealing.
- Added hover effects to the buttons for better interactivity.
- Updated the font styles for a more modern look.
- Updated the structure of the chat container for better layout.
- Added a header section with a logo or title for better branding.
- Updated the form structure for better alignment and spacing.
- Added a footer section with additional information or links.
Here are some screenshots of the improved chat application:
We have added a new feature to the chat application that allows users to generate a summary of their chat history.
- Engage in a conversation with the chat model.
- Once the model has responded, a "Generate Summary" button will appear below the chat form.
- Click the "Generate Summary" button to request a summary of the chat history.
- The summary will be generated using the Gemini API and displayed in the chat container.
- The summary generation feature is implemented in
app.py
,templates/index.html
,static/main.css
, andREADME.md
. - A new route
/generate-summary
is added to handle summary generation requests. - The Gemini API is used to generate a summary of the chat history.
- The summary is returned as a JSON response and displayed in the chat container.
We have added subtle animations to the chat application to enhance the user experience without being too distracting.
- Chat Messages: Added a fade-in effect to the chat messages for a smoother appearance.
- Stats Page Elements: Added a slide-in effect to the stats page elements for a more dynamic look.
- Header and Footer: Added a fade-in effect to the header and footer sections for a more cohesive design.
- The animations are implemented in
static/main.css
. - The HTML structure in
templates/index.html
andtemplates/stats.html
has been updated to include the new animations. - The animations are designed to be subtle and enhance the overall user experience without being too distracting.
Here are some screenshots of the new animations:
We have added a new feature to the stats page that displays the latest user messages and bot responses.
- Engage in a conversation with the chat model.
- Navigate to the stats page to view the latest user messages and bot responses.
- The latest messages will be displayed in a list format, showing the most recent interactions.
- The latest messages feature is implemented in
app.py
,templates/stats.html
,static/main.css
, andREADME.md
. - The
/stats
endpoint inapp.py
is updated to include the latest user messages and bot responses. - A new section is added to
templates/stats.html
to display the latest messages. - JavaScript is added to
templates/stats.html
to fetch and display the latest messages. - Styles are added to
static/main.css
to style the new section displaying the latest messages.
Here are some screenshots of the latest messages feature:
We have added a new feature to the chat application that allows users to download their chat history.
- Engage in a conversation with the chat model.
- Once the model has responded, a "Download Chat History" button will appear below the chat form.
- Click the "Download Chat History" button to download the chat history as a text file.
- The download chat history feature is implemented in
app.py
,templates/index.html
,static/main.css
, andREADME.md
. - A new route
/download-chat-history
is added to handle chat history download requests. - The chat history is converted to a text file and sent as a response.
- The text file is downloaded to the user's device.
Here are some screenshots of the download chat history feature:
We have added a dark mode toggle feature to the chat application.
- Click the circle in the top right corner of the screen to toggle dark mode.
- The chat application will switch between light mode and dark mode.
- The dark mode toggle feature is implemented in
templates/index.html
,templates/stats.html
,static/main.css
, andREADME.md
. - A circle is added to the top right corner of the screen to toggle dark mode.
- The dark mode styles are applied to the chat application.
Here are some screenshots of the dark mode toggle feature:
We have added a typing indicator to the chat application to show when the model is generating a response.
- Engage in a conversation with the chat model.
- When the model is generating a response, a typing indicator will appear below the chat container.
- The typing indicator will disappear once the model has responded.
- The typing indicator is implemented in
templates/index.html
,static/main.css
, andREADME.md
. - A typing indicator is added below the chat container to show when the model is generating a response.
- The typing indicator is displayed and hidden using JavaScript.
Here are some screenshots of the typing indicator:
We have added markdown conversion for user messages and bot responses to enhance the formatting of the chat messages.
- Engage in a conversation with the chat model.
- Enter your message using markdown syntax.
- The message and response will be displayed with the appropriate formatting.
- The markdown conversion feature is implemented in
app.py
andREADME.md
. - User messages and bot responses are converted to markdown using the
markdown
library. - The converted messages are displayed in the chat container.
Please visit http://40.76.46.99 to use the demo version of this application. Please be responsible with your usage of this application