Hi, i want to display tables generated by ChatGPT OpenAI API response as dash.DataTable for the user, but also displaying its text message. Is there any solution or example of someone who actually build cloned chatGPT with Dash?
This is my code
@app.callback(
Output('response-chatbot', 'children'),
Input('send-chat-zara', 'n_clicks'),
State('chat-text-input-data-zara', 'value'),
Input('memory-output','data')
)
def update_convo(n, human_prompt, data_chosen):
button_click = ctx.triggered_id
global conv_hist
if button_click == 'send-chat-zara':
time.sleep(1)
call_API = SmartDataframe(data_chosen, config={'llm':llm, 'conversation':True})
chatbot_resp = call_API.chat(human_prompt)
whole_div = html.Div(children=[
dmc.Grid(gutter='xs', children=[dmc.Col(html.Div(dmc.Avatar(DashIconify(icon="mdi:user-outline", width=20), color='gray', radius='xl', size='sm', style={'border': '2px solid #868E96', 'border-radius':'50%'})), span='content',className='grid-profile'),
dmc.Col(html.Div(html.H4(human_prompt,style={'text-align':'left'})), className='grid-chat')], style={'padding':'5px 0px 5px 0px'}),
dmc.Grid(gutter='xs', children=[dmc.Col(html.Div(dmc.Avatar(DashIconify(icon="lucide:bot", width=15), color='blue', radius='xl', size='sm', style={'border': '2px solid #53A5EC', 'border-radius':'50%'})), span='content', className='grid-profile'),
dmc.Col(html.Div(html.H4(chatbot_resp,style={'text-align':'left'})), className='grid-chat')], style={'padding':'5px 0px 5px 0px'})
])
conv_hist.append(whole_div)
return conv_hist
else:
return None
How can I get the response as table, but also can get a response as text?