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

AI-based command bar #8593

Open
linear bot opened this issue May 16, 2024 · 2 comments
Open

AI-based command bar #8593

linear bot opened this issue May 16, 2024 · 2 comments

Comments

@linear
Copy link

linear bot commented May 16, 2024

Allow users to ask a command bar to search for something and convert the ask to a query and link

"Show me all the sessions for first time users"

Copy link
Author

linear bot commented May 16, 2024

Copy link

greptile-apps bot commented May 16, 2024

To implement the AI-based command bar:

  1. Add Natural Language Parsing: Create a new function in /frontend/src/components/CommandBar/utils.ts to parse natural language queries.
// utils.ts
export function parseNaturalLanguageQuery(query: string): string {
  if (query.includes('first time users')) {
    return JSON.stringify({ isAnd: true, rules: [['user_first_time', 'is', true]] });
  }
  // Add more parsing rules as needed
  return '';
}
  1. Integrate Parsing in CommandBar: Modify the CommandBar component in /frontend/src/components/CommandBar/CommandBar.tsx to use this new function.
// CommandBar.tsx
import { parseNaturalLanguageQuery } from './utils';

const handleSearch = (query: string) => {
  const parsedQuery = parseNaturalLanguageQuery(query);
  if (parsedQuery) {
    setQuery(parsedQuery);
  }
};

// Use handleSearch function where the search is triggered
  1. Update Search Execution: Ensure the search execution logic in /frontend/src/pages/FrontPlugin/components/HighlightSessions.tsx can handle the new query format.
// HighlightSessions.tsx
useEffect(() => {
  if (called) {
    setLoadingState(AppLoadingState.LOADED);
  }
}, [called, setLoadingState]);

const query = parseNaturalLanguageQuery('Show me all the sessions for first time users');
setQuery(query);

This will enable the command bar to interpret and execute natural language queries.

References

/frontend/src/components/CommandBar/CommandBar.tsx
/frontend/src/components/CommandBar/utils.ts
/frontend/src/pages/FrontPlugin/components/HighlightSessions.tsx

Ask Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants