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

Improve Streamlit labels #103

Merged
merged 1 commit into from
Mar 26, 2024
Merged

Improve Streamlit labels #103

merged 1 commit into from
Mar 26, 2024

Conversation

zachwe
Copy link
Contributor

@zachwe zachwe commented Mar 26, 2024

Description

  • Enhanced the session management in the observability module by using DBChatHistory for better session tracking and display.
  • Updated the SQL query to fetch sessions from DBChatHistory instead of DBChatRecord.
  • Improved the user interface by formatting the session information in the sidebar selection box.
  • Fixed the chat records retrieval to correctly use the session_id from the DBChatHistory object.

Changes walkthrough

Relevant files
Enhancement
observability.py
Enhance Session Management in Observability                                       

openduck-py/observability.py

  • Replaced direct use of DBChatRecord with DBChatHistory for session
    management.
  • Modified the SQL statement to select from DBChatHistory instead of
    distinct DBChatRecord.session_id.
  • Updated the session selection in the sidebar to display formatted
    session information.
  • Changed the retrieval of chat records to use session_id from
    DBChatHistory object.
  • +8/-8     

    🔍 Anti-patterns Detected:
    openduck-py/observability.py
    IssueLines
    Remove unnecessary comprehensions60-60
    💡 Usage Guide

    Checking Your Pull Request

    Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

    Talking to CodeAnt AI

    Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

    @codeant-ai ask: Your question here
    

    This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

    Check Your Repository Health

    To analyze the health of your code repository, visit our dashboard at app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

    Copy link

    vercel bot commented Mar 26, 2024

    The latest updates on your projects. Learn more about Vercel for Git ↗︎

    Name Status Preview Updated (UTC)
    openduck ✅ Ready (Inspect) Visit Preview Mar 26, 2024 4:35pm

    @zachwe zachwe merged commit e049886 into main Mar 26, 2024
    9 checks passed
    @zachwe zachwe deleted the zach-various-improvements branch March 26, 2024 16:35
    session_id_options = [session_id[0] for session_id in unique_session_ids]
    stmt = select(DBChatHistory).order_by(DBChatHistory.created_at.desc())
    sessions = db.execute(stmt).scalars().all()
    session_id_options = [session for session in sessions]
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    Highlights unnecessary comprehensions that could be replaced with simpler constructs or direct operations. Removing these can make the code more concise and readable, as well as improve performance by avoiding the overhead of the comprehension syntax for straightforward operations.

    Suggested change
    session_id_options = [session for session in sessions]
    session_id_options = list(sessions)

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    enhancement New feature or request
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    None yet

    1 participant