-
Notifications
You must be signed in to change notification settings - Fork 2
2. Hackbot User Widget #444
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
2826a71
Add HackBot server core: API route, actions, utils, types, data, and …
ReehalS 03e0cd5
Add HackBot chat widget with event cards, markdown, and layout integr…
ReehalS 8d265e1
Lint fixes
ReehalS 85cd92e
Merge branch 'main' of https://github.com/HackDavis/hackdavis-hub int…
michelleyeoh 1ab88b9
Merge branch 'main' into hackbot-user-widget
michelleyeoh 46b3434
Hackbot user widget fixes+ Intent management
ReehalS 04cc4bb
Resolve copilot comments
ReehalS 58a0855
Link sanitization
ReehalS 350740e
Intent: Enforce workshop and event queries
ReehalS 2a3c43a
Merge branch 'main' into hackbot-user-widget
michelleyeoh 1c7a6d4
Delete settings.json
ReehalS 74b62c0
Integrate widgetwrapper into existing (hub)/layout.tsx
ReehalS a74d697
Merge branch 'main' into hackbot-user-widget
ReehalS 97a1aab
split widget into hook
michelleyeoh 33e5dba
updated a tag to Link
michelleyeoh a8349a0
address comments
michelleyeoh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| export function shouldDisableEventsToolForQuery(query: string): boolean { | ||
| const q = query.trim().toLowerCase(); | ||
| if (!q) return false; | ||
|
|
||
| const factualIntent = | ||
| /\b(judging|judged|rubric|criteria|score|scoring|weights?|points?)\b/.test( | ||
| q | ||
| ) || | ||
| /\b(deadline|deadlines|due date|cutoff|submission deadline)\b/.test(q) || | ||
| /\b(rule|rules|policy|policies|code of conduct|eligib(?:le|ility)|requirements?)\b/.test( | ||
| q | ||
| ) || | ||
| /\b(submit|submission|submissions|devpost|submission process|judging process)\b/.test( | ||
| q | ||
| ) || | ||
| /\b(team number|table number|team size|max team|minimum team|min team)\b/.test( | ||
| q | ||
| ) || | ||
| /\b(prize track|prize tracks|prizes?)\b/.test(q) || | ||
| /\b(check[- ]?in|checkin code|invite|registration)\b/.test(q); | ||
|
|
||
| const eventIntent = | ||
| /\b(schedule|event|events|workshop|workshops|activit(?:y|ies)|meal|meals|breakfast|brunch|lunch|dinner|happening)\b/.test( | ||
| q | ||
| ); | ||
|
|
||
| return factualIntent && !eventIntent; | ||
| } | ||
|
|
||
| export function isResourcesQuery(query: string): boolean { | ||
| const q = query.trim().toLowerCase(); | ||
| if (!q) return false; | ||
|
|
||
| const asksForResources = | ||
| /\b(resource|resources|tools?|apis?|libraries|frameworks?|starter kit)\b/.test( | ||
| q | ||
| ) || /\b(figma|ui\s*kit|design\s*kit|palette|templates?)\b/.test(q); | ||
|
|
||
| const asksForRoleScopedResources = | ||
| /\b(developer|developers|dev)\b/.test(q) || | ||
| /\b(designer|designers|design|ui\/?ux)\b/.test(q); | ||
|
|
||
| return asksForResources || asksForRoleScopedResources; | ||
| } | ||
|
|
||
| export function isExplicitEventQuery(query: string): boolean { | ||
| const q = query.trim().toLowerCase(); | ||
| if (!q) return false; | ||
|
|
||
| return /\b(schedule|event|events|workshop|workshops|activit(?:y|ies)|meal|meals|breakfast|brunch|lunch|dinner|happening|attend|go to)\b/.test( | ||
| q | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,32 @@ | ||
| import { auth } from '@/auth'; | ||
| import ProtectedDisplay from '@components/ProtectedDisplay/ProtectedDisplay'; | ||
| import Navbar from '@components/Navbar/Navbar'; | ||
| import HackbotWidgetWrapper from '../_components/Hackbot/HackbotWidgetWrapper'; | ||
| import type { HackerProfile } from '@typeDefs/hackbot'; | ||
|
|
||
| export default async function Layout({ | ||
| children, | ||
| }: { | ||
| children: React.ReactNode; | ||
| }) { | ||
| const session = await auth(); | ||
| const u = session?.user as any; | ||
| const profile: HackerProfile | null = u | ||
| ? { | ||
| name: u.name ?? undefined, | ||
| position: u.position ?? undefined, | ||
| is_beginner: u.is_beginner ?? undefined, | ||
| } | ||
| : null; | ||
|
|
||
| export default function Layout({ children }: { children: React.ReactNode }) { | ||
| return ( | ||
| <ProtectedDisplay | ||
| allowedRoles={['hacker', 'admin']} | ||
| failRedirectRoute="/login" | ||
| > | ||
| <Navbar /> | ||
| {children} | ||
| <HackbotWidgetWrapper initialProfile={profile} /> | ||
| </ProtectedDisplay> | ||
| ); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.