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

SimpleChat: a simple and dumb web front end for testing /chat/completions and /completions end points and try chat #7350

Merged
merged 64 commits into from
May 22, 2024

Commits on May 17, 2024

  1. SimpleChat: Add a skeletal html page

    Contains a div placeholder for showing chat messages till now
    
    a text-input for allowing user to enter next chat message/query
    to the model.
    
    a submit button to allow sending of the user entered message and
    chat till now to the model.
    hanishkvc committed May 17, 2024
    Configuration menu
    Copy the full SHA
    69ecad2 View commit details
    Browse the repository at this point in the history
  2. SimpleChat: A js skeleton with SimpleChat class

    Allows maintaining an array of chat message.
    
    Allows adding chat message (from any of the roles be it system,
    user, assistant, ...)
    
    Allows showing chat messages till now, in a given div element.
    hanishkvc committed May 17, 2024
    Configuration menu
    Copy the full SHA
    0402a4b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    1d3cc93 View commit details
    Browse the repository at this point in the history
  4. SimpleChatJS: Roles Class, submitClick

    Define Role class with static members corresponding to the roles.
    
    Update startme to
    
    * Get hold of the ui elements.
    
    * Attach a click handler to submit button, which adds the user input
      to xchats array and shows the chat messages till now in chat div
      element.
    
    Trap DOMContentLoaded to trigger startme
    hanishkvc committed May 17, 2024
    Configuration menu
    Copy the full SHA
    70e5860 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    24d348a View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    256e02c View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    639d647 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    ce4aaeb View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    27268a6 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    33bc67b View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    c665347 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    564469e View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    7d772f6 View commit details
    Browse the repository at this point in the history
  14. SimpleChat: Diff user/assistant msgs, Make input wider

    Also show a default message to user
    
    Also add some metas
    hanishkvc committed May 17, 2024
    Configuration menu
    Copy the full SHA
    9942851 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    ebe330d View commit details
    Browse the repository at this point in the history
  16. SimpleChat:sh: Add simple shell script to run python3 http.server

    So one needs to run the llm server locally
    then run this script and access it using a local browser
    hanishkvc committed May 17, 2024
    Configuration menu
    Copy the full SHA
    29d2d22 View commit details
    Browse the repository at this point in the history
  17. SimpleChat:JS: Try trap enter key press wrt input text field

    So user can either press submit button or press enter key
    hanishkvc committed May 17, 2024
    Configuration menu
    Copy the full SHA
    e62087b View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    9feb58e View commit details
    Browse the repository at this point in the history
  19. SimpleChat: Dont submit if already submitted and waiting

    Also make chat the default selection wrt mode
    hanishkvc committed May 17, 2024
    Configuration menu
    Copy the full SHA
    3e5edba View commit details
    Browse the repository at this point in the history
  20. SimpleChat:JS: Handle difference in response

    Try read the assistance response from appropriate field in the
    response got.
    
    Also examples/server seems to return the response in a slightly
    different field, so try account for that also.
    hanishkvc committed May 17, 2024
    Configuration menu
    Copy the full SHA
    aef32d9 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    b364417 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    668b987 View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    69817fe View commit details
    Browse the repository at this point in the history
  24. Configuration menu
    Copy the full SHA
    ae52ad1 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    884adfd View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    72151aa View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    601fedf View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    0d0a28b View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    65a56e6 View commit details
    Browse the repository at this point in the history

Commits on May 18, 2024

  1. SimpleChat:CSS: Move style info into its own css file

    To keep it simple, clean and seperate so that things are not
    unnecessarily cluttered.
    hanishkvc committed May 18, 2024
    Configuration menu
    Copy the full SHA
    ebd5e71 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a1a2f36 View commit details
    Browse the repository at this point in the history
  3. SimpleChat:JS: Try ensure the last entry in chat is visible

    Needed because now only the chat div is scrollable and not the full
    page.
    
    In last commit the chat div size was fixed to 75% vertical height,
    so the full page no longer scrolls, so the old bring user-input
    element to view wont work, instead now the last element in the
    chat div should be brought into view.
    hanishkvc committed May 18, 2024
    Configuration menu
    Copy the full SHA
    a944ce7 View commit details
    Browse the repository at this point in the history
  4. SimpleChat:JS: bottom of element visible, Set focus to user input

    As the generated text could be multiple lines and occupy more space
    that the full scrollable div's vertical space, make the bottom of
    the last element (which can be such a generated text) in the div
    visible by scrolling.
    
    Ensure that the user input box has focus
    hanishkvc committed May 18, 2024
    Configuration menu
    Copy the full SHA
    6eb1e0f View commit details
    Browse the repository at this point in the history
  5. SimpleChat: Update notes a bit. Try keep browser happy

    Avoid browser quirk mode with DOCTYPE.
    
    Help with accessibility a bit by specifying the language explicitly.
    
    Specify the char encoding explicitly, inturn utf-8 is a safe bet,
    even with intermixing of languages if reqd in future.
    
    Add a cache-control http-equiv meta tag, which in all probability
    will be ignored.
    
    Defer js loading and execution, just for fun and future, not that
    critical here as it stands now.
    hanishkvc committed May 18, 2024
    Configuration menu
    Copy the full SHA
    5a5f6ab View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    676053f View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    7905f2f View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    5976126 View commit details
    Browse the repository at this point in the history

Commits on May 19, 2024

  1. SimpleChat:HTML: Add viewport meta for better mobile friendliness

    Without this the page content may look too small.
    hanishkvc committed May 19, 2024
    Configuration menu
    Copy the full SHA
    c191e47 View commit details
    Browse the repository at this point in the history

Commits on May 20, 2024

  1. SimpleChat:HtmlCss: Cleanup UI flow

    set margin wrt vmin rather than vw or vh so portrait/landscape ok.
    
    Use flex and flex-grow to put things on the same line as well as
    distribute available space as needed. Given two main elements/line
    so it remains simple.
    
    In each line have one element with grows and one sits with a basic
    comfortably fixed size.
    hanishkvc committed May 20, 2024
    Configuration menu
    Copy the full SHA
    c88088c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    dfadac7 View commit details
    Browse the repository at this point in the history
  3. SimpleChat: Make vertical layout better responsive (flex based)

    Also needed to make things cleaner and properly usable whether
    landscape or portrait, after changing to multiline textarea rather
    than single line user input.
    
    Avoid hardcoding the chat-till-now display area height, instead
    make it a flex-growable within a flex column of ui elements within
    a fixed vertical area.
    hanishkvc committed May 20, 2024
    Configuration menu
    Copy the full SHA
    6597faf View commit details
    Browse the repository at this point in the history
  4. SimpleChat: Rename simplechat.html to index.html, update readme

    Instead of providing a seperate shell script, update the readme wrt
    how to run/use this web front end.
    hanishkvc committed May 20, 2024
    Configuration menu
    Copy the full SHA
    e5000cd View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    3fc607f View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    af62197 View commit details
    Browse the repository at this point in the history
  7. SimpleChat:JS: MultiChat initial skeleton

    Will help maintain multiple independent chats in future
    hanishkvc committed May 20, 2024
    Configuration menu
    Copy the full SHA
    9b97fea View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    5c1a9f4 View commit details
    Browse the repository at this point in the history
  9. SimpleChat:JS:Keep MultiChatUI simple for now

    Worry about different chats with different servers for later.
    hanishkvc committed May 20, 2024
    Configuration menu
    Copy the full SHA
    fcf2af9 View commit details
    Browse the repository at this point in the history
  10. SimpleChat:JS: Move handle submit into MultiChat, build on same

    Create an instance of MultiChatUI and inturn a instance of chat
    session, which is what the UI will inturn work on.
    hanishkvc committed May 20, 2024
    Configuration menu
    Copy the full SHA
    8ef1aa9 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    7be6aeb View commit details
    Browse the repository at this point in the history

Commits on May 21, 2024

  1. SimpleChat: Move ui elements into MultiChatUI, Update el IDs

    Move ui elements into MultiChatUI, so that current handleUserSubmit
    doesnt need to take the element arguments. Also in future, when
    user is allowed to switch between different chat sessions, the
    UI can be updated as needed by using the elements in UI already
    known to MultiChatUI instance.
    
    Rename the element ids' so that they follow a common convention,
    as well as one can identify what the element represents in a more
    consistant manner.
    hanishkvc committed May 21, 2024
    Configuration menu
    Copy the full SHA
    1cd10ae View commit details
    Browse the repository at this point in the history
  2. SimpleChat:MCUI:Show available chat sessions, try switch btw them

    Previous commits brought in / consolidated existing logic into
    MultiChatUI class.
    
    Now start adding logic towards multichat support
    
    * show buttons indicating available chat sessions
    
    * on sessin button click, try switch to that session
    hanishkvc committed May 21, 2024
    Configuration menu
    Copy the full SHA
    1b82f22 View commit details
    Browse the repository at this point in the history
  3. SimpleChat:MCUI: Store and use current chat session id

    Also
    
    allow to switch chat session optionally, wrt some of the related
    helpers.
    
    setup for two chat sessions by default.
    hanishkvc committed May 21, 2024
    Configuration menu
    Copy the full SHA
    928cc36 View commit details
    Browse the repository at this point in the history
  4. SimpleChat:MCUI: Delay enabling user-input to avoid race

    Re-enable user-input, only after response to a user query has been
    updated to the chat-div. This ensures that if user tries to switch
    chat session, it wont be allowed till chat-request-response flow is
    done.
    hanishkvc committed May 21, 2024
    Configuration menu
    Copy the full SHA
    d57274b View commit details
    Browse the repository at this point in the history
  5. SimpleChat: Take care of system prompt

    Helper to get the latest system prompt and inturn use same to
    set the system prompt ui, when switching.
    
    Ensure that system prompt is set if and when enter key is pressed.
    hanishkvc committed May 21, 2024
    Configuration menu
    Copy the full SHA
    7297dda View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    3458d2f View commit details
    Browse the repository at this point in the history
  7. SimpleChat:MCUI: Allow selected chat-session btn to be highlighted

    Also have a general helper for setting class of children.
    hanishkvc committed May 21, 2024
    Configuration menu
    Copy the full SHA
    b9f9c0e View commit details
    Browse the repository at this point in the history
  8. SimpleChat:Cleanup corners

    Show system prompt in chat space, when it is set by pressing enter,
    as a feedback to user.
    
    Alert user, if they try to switch chat session in the middle of
    waiting for a response from the ai model.
    hanishkvc committed May 21, 2024
    Configuration menu
    Copy the full SHA
    68ef740 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    2a40719 View commit details
    Browse the repository at this point in the history
  10. SimpleChat:MCUI: Support for new chat sessions

    Also a general create button helper.
    hanishkvc committed May 21, 2024
    Configuration menu
    Copy the full SHA
    14083d1 View commit details
    Browse the repository at this point in the history
  11. SimpleChat:MCUI: CreateSessionBtn helper, use wrt NewChat

    Also fix a oversight wrt using stale data wrt the list of chat
    sessions.
    hanishkvc committed May 21, 2024
    Configuration menu
    Copy the full SHA
    6c71277 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    d3405ea View commit details
    Browse the repository at this point in the history
  13. SimpleChat:MCUI:CornerCases:Skip new chat, show only if current

    Skip NewChat if user cancels or if one waiting for response from
    the ai model.
    
    Dont show a chat with newly got ai model response, if current chat
    session has changed, some how. Chat session shouldnt be allowed to
    change, if there is a pending response, but still as a additional
    sanity check.
    hanishkvc committed May 21, 2024
    Configuration menu
    Copy the full SHA
    c2e8d62 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    fb848b2 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    1d87c50 View commit details
    Browse the repository at this point in the history