Git Product home page Git Product logo

Comments (3)

MatufA avatar MatufA commented on September 27, 2024 1

@lpdg-pgadkari you can create a map score to differentiate between a thumbs up press and a thumbs down press.
example:

def _submit_feedback(feedback, scores, user_input, answer, cache_db):
    score = scores.get(feedback["score"])
    if score is not None:
        if score == 0:
            # insert to negative db
        elif score == 1:
            # insert to positive db

score_mappings = {"๐Ÿ‘": 1, "๐Ÿ‘Ž": 0}
feedback = streamlit_feedback(feedback_type="thumbs", 
                              on_submit=_submit_feedback, 
                              key=f"feedback_{i}", 
                              optional_text_label="Please type the answer here if the given answer in not correct", 
                              kwargs={
                                  'scores': score_mappings,
                                  'user_input': user_input,
                                  'answer': answer,
                                  'cache_db': conn
                              })

from streamlit-feedback.

jeffkayne avatar jeffkayne commented on September 27, 2024

A couple of solutions,

  • The most likely one is to revise your data model. These values probably should be in the same table
  • If you want two tables, parameterise your query to either write to good_responses or bad_responses depending on the input

from streamlit-feedback.

lpdg-pgadkari avatar lpdg-pgadkari commented on September 27, 2024

Irrespective of whether I write to one table or two I should be able to differentiate between a thumbs up press and a thumbs down press. How do I do that?
For e.g. in the below code using streamlit, I can perform two different based on which button was pressed

st.button("๐Ÿ‘", on_click=good_response, type='primary', key=f"thumbs_up_{i}", args=(conn, user_input, answer))
st.button("๐Ÿ‘Ž", on_click=bad_response, type='primary', key=f"thumbs_down_{i}", args=(conn, user_input, answer)) 

I want to save the good responses from the chatbot as it is and give a text field to let the user enter correct response in case the response form OpenAI was not good enough and save it in a table.

from streamlit-feedback.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.