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

add ai qa bot #4908

Merged
merged 1 commit into from
Jul 2, 2023
Merged

add ai qa bot #4908

merged 1 commit into from
Jul 2, 2023

Conversation

nobodyiam
Copy link
Member

@nobodyiam nobodyiam commented Jun 21, 2023

What's the purpose of this PR

Integrate an intelligent QA bot capable of providing natural language responses to users' inquiries.
The source code for the backend Apollo QA bot can be accessed at here and is currently deployed in conjunction with the Apollo demo server, which is why the ip is 81.68.181.139.

Screenshots

image

image

image

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Read the Contributing Guide before making this pull request.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit tests to verify the code.
  • Run mvn clean test to make sure this pull request doesn't break anything.
  • Update the CHANGES log.

@nobodyiam nobodyiam requested a review from a team June 21, 2023 00:26
@codecov
Copy link

codecov bot commented Jun 21, 2023

Codecov Report

Merging #4908 (0eaaf69) into master (8f0331f) will decrease coverage by 0.07%.
The diff coverage is n/a.

❗ Current head 0eaaf69 differs from pull request most recent head fc541ba. Consider uploading reports for the commit fc541ba to get more accurate results

@@             Coverage Diff              @@
##             master    #4908      +/-   ##
============================================
- Coverage     48.51%   48.44%   -0.07%     
+ Complexity     1728     1727       -1     
============================================
  Files           346      346              
  Lines         10836    10836              
  Branches       1080     1080              
============================================
- Hits           5257     5250       -7     
- Misses         5256     5263       +7     
  Partials        323      323              

see 4 files with indirect coverage changes

@Anilople
Copy link
Contributor

work well.

image

docs/index.html Outdated
@@ -151,6 +156,10 @@
generateMultipleLanguagesNavbarPluginByListItemName("Translations"),
],
};
QABot.initialize({
"serverUrl": "http://81.68.181.139/ai/qa",
Copy link
Contributor

Choose a reason for hiding this comment

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

For simulating the ai backend shutdown,

I change

http://81.68.181.139 to http://81.68.181.100

The document can be open, but would delay 10s .

Is there any way to setup the timeout from 10s to 5s, 3s or 2s?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a good point! I changed the logic as follows and it should work well when 81.68.181.139 is down.

<!-- add qa bot -->
<script>
  (function() {
    var link = document.createElement('link');
    link.rel = 'stylesheet';
    link.href = 'http://81.68.181.139/ai/qa-bot.css';
    document.head.appendChild(link);

    var script = document.createElement('script');
    script.src = 'http://81.68.181.139/ai/qa-bot.js';
    script.onload = function () {
      QABot.initialize({
        "serverUrl": "http://81.68.181.139/ai/qa",
        "documentSiteUrlPrefix": "https://www.apolloconfig.com/#"
      });
    };
    document.body.appendChild(script);
  })();
</script>

Copy link
Contributor

Choose a reason for hiding this comment

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

Good Idea.

But it is still block on my machine...

Found that

  <link rel="stylesheet" href="http://81.68.181.139/ai/qa-bot.css">
  <script src="http://81.68.181.139/ai/qa-bot.js"></script>

i.e those 2 lines cause.

When change them to

  <link rel="stylesheet" href="http://81.68.181.100/ai/qa-bot.css">
  <script src="http://81.68.181.100/ai/qa-bot.js"></script>

We can reproduce it.


After query how to async load css and javascript through ChatGPT, There is a solution

use

  <link rel="preload" href="http://81.68.181.139/ai/qa-bot.css" as="style">
  <noscript><link rel="stylesheet" href="http://81.68.181.139/ai/qa-bot.css"></noscript>

to async load css, and use

  <script src="http://81.68.181.139/ai/qa-bot.js" async></script>

to async load javascript.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm sorry, looks like the last push failed, these 2 lines should be removed.

<script src="http://81.68.181.139/ai/qa-bot.js"></script>

Anilople
Anilople previously approved these changes Jun 27, 2023
@Anilople
Copy link
Contributor

Maybe we can change the logo

image

in the feature to attract user to click it more frequently.

  • Add some text to it
  • Zoom out it to get larger logo

@nobodyiam
Copy link
Member Author

I added the Chat with AI text below the icon.
image

Copy link
Contributor

@Anilople Anilople left a comment

Choose a reason for hiding this comment

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

LGTM

@Anilople Anilople merged commit d3d17ee into apolloconfig:master Jul 2, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jul 2, 2023
@nobodyiam nobodyiam deleted the add-qa-bot branch July 2, 2023 14:08
@nobodyiam nobodyiam added this to the 2.2.0 milestone Aug 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants