Canner / WrenAI

🚀 An open-source SQL AI (Text-to-SQL) Agent that empowers data, product teams to chat with their data. 🤘
https://getwren.ai/oss
GNU Affero General Public License v3.0
2.04k stars 211 forks source link

After creating a view, the answer generated does not indicate that it originates from a view #880

Open wwwy3y3 opened 1 week ago

wwwy3y3 commented 1 week ago

Describe the bug In version 0.10.0, after creating a view, the answer generated does not indicate that it originates from a view.

To Reproduce Steps to reproduce the behavior:

  1. Go to home
  2. Create a view
  3. Ask a questions same with the question we saved as a view
  4. Observe that the answer does not indicate it comes from the view.

Expected behavior The response should clearly indicate if it originates from a view to provide transparency about the data source.

Desktop (please complete the following information):

Wren AI Information

AryanK1511 commented 2 days ago

@wwwy3y3 This looks interesting to me. Can I give it a shot? I am not sure whether I would be able to get it to work or not but I want to try this. Are you able to assign this issue for me so that I can start working on it?

wwwy3y3 commented 8 hours ago

@AryanK1511 of course! thanks a lot.

We implemented this feature before, but it seems not working as expected right now.

As you could see from the UI logics here: https://github.com/Canner/WrenAI/blob/8f618418316826df13ad7c78c890da08a8000d8a/wren-ui/src/components/pages/home/promptThread/AnswerResult.tsx#L129-L157

it should show Generated from saved view ${view name} and clicking the view name will redirect users to the view page.

We suspect that since we change the flow of asking questions, we might break sth here.

If the answer comes from a view, the thread response here should have a view property: https://github.com/Canner/WrenAI/blob/8f618418316826df13ad7c78c890da08a8000d8a/wren-ui/src/apollo/server/schema.ts#L601-L606

@cyyeh, Jimmy you could share more about how AI service API works here. Might help @AryanK1511 solving this issue.

wwwy3y3 commented 8 hours ago

@AryanK1511 assigned to you. Let us know if you have any questions

cyyeh commented 6 hours ago

@AryanK1511 Hi, for AskResult type, you could get AskCandidateType inside, there are two types of value: view or llm. if it's view, you could also get viewId in the AskResult.

https://github.com/Canner/WrenAI/blob/8f618418316826df13ad7c78c890da08a8000d8a/wren-ui/src/apollo/server/adaptors/wrenAIAdaptor.ts#L113

AryanK1511 commented 11 minutes ago

Cool! I'll look into this. Thank you so much for assigning this issue to me