Skip to content

Conversation

@moonmeister
Copy link
Member

@moonmeister moonmeister commented Jul 9, 2025

Description

Adds a chat feature that integrates with Google Vertex AI to provide answers to questions on Faust and how to solve problems.

Todo

  • Basic UI implementation
  • Connect to Google Vertex
  • Decide on AI model to use (flash vs pro)?
  • Refined UI
  • Code cleanup and organization
  • Experiment with bot and have a variety of folks do some testing
  • Refine SmartSearch settings if helpful
  • Refine system prompt if needed
  • Fill gaps in docs to help the bot understand things better
  • MAke more noticeable and encourage engagement
  • Connect GA for engagement tracking

Notes

Closes #338

Includes code from #339 will resolve one that's merged

@moonmeister moonmeister self-assigned this Jul 9, 2025
@moonmeister moonmeister added documentation Improvements or additions to documentation enhancement New feature or request javascript Pull requests that update javascript code labels Jul 9, 2025
@github-project-automation github-project-automation bot moved this to 🆕 Backlog in Headless OSS Jul 9, 2025
@headless-platform-by-wp-engine

Check out the recent updates to your Headless Platform preview environment:

App Environment URL Build
faustjs.org preview-env-feat-rag-chat N/A ❌ (logs)

Learn more about preview environments in our documentation.

@github-project-automation github-project-automation bot moved this from 🆕 Backlog to ✅ Closed in Headless OSS Jul 10, 2025
@moonmeister moonmeister reopened this Jul 10, 2025
@headless-platform-by-wp-engine

Check out the recent updates to your Headless Platform preview environment:

App Environment URL Build
faustjs.org preview-env-feat-rag-chat N/A ❌ (logs)

Learn more about preview environments in our documentation.

@headless-platform-by-wp-engine

Check out the recent updates to your Headless Platform preview environment:

App Environment URL Build
faustjs.org preview-env-feat-rag-chat N/A ❌ (logs)

Learn more about preview environments in our documentation.

@headless-platform-by-wp-engine

Check out the recent updates to your Headless Platform preview environment:

App Environment URL Build
faustjs.org preview-env-feat-rag-chat N/A ❌ (logs)

Learn more about preview environments in our documentation.

@headless-platform-by-wp-engine

Check out the recent updates to your Headless Platform preview environment:

App Environment URL Build
faustjs.org preview-env-feat-rag-chat N/A ❌ (logs)

Learn more about preview environments in our documentation.

@headless-platform-by-wp-engine

Check out the recent updates to your Headless Platform preview environment:

App Environment URL Build
faustjs.org preview-env-feat-rag-chat N/A ❌ (logs)

Learn more about preview environments in our documentation.

@headless-platform-by-wp-engine

Check out the recent updates to your Headless Platform preview environment:

App Environment URL Build
faustjs.org preview-env-feat-rag-chat N/A ❌ (logs)

Learn more about preview environments in our documentation.

@headless-platform-by-wp-engine

Check out the recent updates to your Headless Platform preview environment:

App Environment URL Build
faustjs.org preview-env-feat-rag-chat N/A ❌ (logs)

Learn more about preview environments in our documentation.

@headless-platform-by-wp-engine

Check out the recent updates to your Headless Platform preview environment:

App Environment URL Build
faustjs.org preview-env-feat-rag-chat https://hj…wered.com ✅ (logs)

Learn more about preview environments in our documentation.

@headless-platform-by-wp-engine

Check out the recent updates to your Headless Platform preview environment:

App Environment URL Build
faustjs.org preview-env-feat-rag-chat https://hj…wered.com ✅ (logs)

Learn more about preview environments in our documentation.

@headless-platform-by-wp-engine

Check out the recent updates to your Headless Platform preview environment:

App Environment URL Build
faustjs.org preview-env-feat-rag-chat https://hj…wered.com ✅ (logs)

Learn more about preview environments in our documentation.

@moonmeister moonmeister marked this pull request as ready for review July 16, 2025 22:07
@moonmeister moonmeister requested a review from kellenmace July 16, 2025 22:07
@headless-platform-by-wp-engine

Check out the recent updates to your Headless Platform preview environment:

App Environment URL Build
faustjs.org preview-env-feat-rag-chat https://hj…wered.com ✅ (logs)

Learn more about preview environments in our documentation.

@headless-platform-by-wp-engine

Check out the recent updates to your Headless Platform preview environment:

App Environment URL Build
faustjs.org preview-env-feat-rag-chat https://hj…wered.com ✅ (logs)

Learn more about preview environments in our documentation.

@headless-platform-by-wp-engine

Check out the recent updates to your Headless Platform preview environment:

App Environment URL Build
faustjs.org preview-env-feat-rag-chat https://hj…wered.com ✅ (logs)

Learn more about preview environments in our documentation.

@headless-platform-by-wp-engine

Check out the recent updates to your Headless Platform preview environment:

App Environment URL Build
faustjs.org preview-env-feat-rag-chat https://hj…wered.com ✅ (logs)

Learn more about preview environments in our documentation.

@Fran-A-Dev Fran-A-Dev self-requested a review July 17, 2025 20:58
Copy link
Contributor

@Fran-A-Dev Fran-A-Dev left a comment

Choose a reason for hiding this comment

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

LGTM

@Fran-A-Dev Fran-A-Dev merged commit 2fe3b0e into main Jul 17, 2025
4 checks passed
@Fran-A-Dev Fran-A-Dev deleted the feat-rag-chat branch July 17, 2025 20:59
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Closed in Headless OSS Jul 17, 2025
Copy link
Contributor

@kellenmace kellenmace left a comment

Choose a reason for hiding this comment

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

Looks great, overall! Nice job, Alex! Left just a few comments

- You can use the 'smartSearchTool' to find information relating to Faust.
- WP Engine Smart Search is a powerful tool for finding information about Faust.
- After the 'smartSearchTool' provides results (even if it's an error or no information found)
- You MUST then formulate a conversational response to the user based on those results but also use the tool if the users query is deemed plausible.
Copy link
Contributor

Choose a reason for hiding this comment

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

This line seems like it should be combined with the one before it. And "users query" should be "user's query". Not that that matters too much- I'm sure the LLM would understand it just fine either way :)

`;

const systemPromptContent = `
- You are a friendly and helpful AI assistant that provides Developers help with their coding tasks and learning, as relevant to Faust.js, WPGraphQL, and headless WordPress.
Copy link
Contributor

Choose a reason for hiding this comment

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

"Developers" -> "developers"


const systemPromptContent = `
- You are a friendly and helpful AI assistant that provides Developers help with their coding tasks and learning, as relevant to Faust.js, WPGraphQL, and headless WordPress.
- Format your responses using Github Flavored Markdown.
Copy link
Contributor

Choose a reason for hiding this comment

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

"Github Flavored Markdown" -> "GitHub-flavored Markdown"
(notice the capital "H" in GitHub)

- Make sure to format links as [link text](path).
- Make sure to link out to the source of the information you provide.
- Prefer new information over old information.
- Do not invent information. Stick to the data provided by the tool.
Copy link
Contributor

Choose a reason for hiding this comment

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

Instructions: don't hallucinate ever. k thanks, bye! :D

},
onStepFinish: async (result) => {
if (result.usage) {
console.log(
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be removed before going to prod? Otherwise, if you want it to be a "permanent" console.log statement- what I like to do in my apps is use console.info(). So then you can search the codebase for "console.info" to find the "permanent" log statements and "console.log" to find the temporary ones left over from debugging. So you could use that convention, if you like.

status,
} = useChat();

useEffect(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Using useEffect to initialize data like this after the component has already rendered once isn't ideal. I think useChat provides an initialMessages prop we can use instead, like this:

const {
		messages,
		input,
		handleInputChange,
		handleSubmit,
		setMessages,
		status } = useChat({
  initialMessages: [
    {
      role: "assistant",
      content: "Hey there! I'm an AI driven chat assistant here to help you with Faust.js! I'm trained on the documentation and can help you with coding tasks, learning, and more. What can I assist you with today?",
      id: "welcome-intro",
    },
  ],
});

Google Sans,
Helvetica Neue,
sans-serif;
/* Choose a font that matches, Arial is a common sans-serif */
Copy link
Contributor

Choose a reason for hiding this comment

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

These code comments could be removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request javascript Pull requests that update javascript code

Projects

Status: ✅ Closed

Development

Successfully merging this pull request may close these issues.

feat: use Smart Search to drive AI chat bot to answer questions about Faust

4 participants