kaddidlehopper 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTEXT.md +139 -0
- package/README.md +47 -0
- package/add-ons/ai/README.md +34 -0
- package/add-ons/ai/assets/_dot_env.local.append +13 -0
- package/add-ons/ai/assets/src/components/AIAssistant.tsx +149 -0
- package/add-ons/ai/assets/src/lib/ai-hook.ts +21 -0
- package/add-ons/ai/assets/src/lib/weather-tools.ts +30 -0
- package/add-ons/ai/assets/src/routes/api.chat.ts +94 -0
- package/add-ons/ai/assets/src/routes/chat.css +175 -0
- package/add-ons/ai/assets/src/routes/chat.tsx +141 -0
- package/add-ons/ai/info.json +27 -0
- package/add-ons/ai/package.json +17 -0
- package/add-ons/ai/small-logo.svg +8 -0
- package/dist/cli.js +251 -0
- package/dist/index.js +33 -0
- package/dist/types/cli.d.ts +8 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/types.d.ts +14 -0
- package/dist/types.js +1 -0
- package/examples/blog/README.md +60 -0
- package/examples/blog/assets/content/posts/beach.md +12 -0
- package/examples/blog/assets/content/posts/jungle.md.ejs +12 -0
- package/examples/blog/assets/content/posts/mountains.md.ejs +12 -0
- package/examples/blog/assets/content/posts/snorkeling.md.ejs +12 -0
- package/examples/blog/assets/content/posts/waterfall.md.ejs +12 -0
- package/examples/blog/assets/content-collections.ts +30 -0
- package/examples/blog/assets/public/beach.jpg +0 -0
- package/examples/blog/assets/public/jungle.jpg +0 -0
- package/examples/blog/assets/public/mountains.jpg +0 -0
- package/examples/blog/assets/public/snorkeling.jpg +0 -0
- package/examples/blog/assets/public/waterfall.jpg +0 -0
- package/examples/blog/assets/src/components/Header.tsx +52 -0
- package/examples/blog/assets/src/components/VacayAssistant.tsx +205 -0
- package/examples/blog/assets/src/components/blog-posts.tsx +78 -0
- package/examples/blog/assets/src/components/ui/card.tsx +92 -0
- package/examples/blog/assets/src/lib/blog-ai-hook.ts +25 -0
- package/examples/blog/assets/src/lib/blog-tools.ts +111 -0
- package/examples/blog/assets/src/lib/utils.ts +6 -0
- package/examples/blog/assets/src/routes/__root.tsx +57 -0
- package/examples/blog/assets/src/routes/api.blog-chat.ts +117 -0
- package/examples/blog/assets/src/routes/category.$category.tsx +19 -0
- package/examples/blog/assets/src/routes/index.tsx +19 -0
- package/examples/blog/assets/src/routes/posts.$slug.tsx +63 -0
- package/examples/blog/assets/src/styles.css +138 -0
- package/examples/blog/info.json +43 -0
- package/examples/blog/package.json +23 -0
- package/examples/events/README.md +110 -0
- package/examples/events/assets/content/speakers/andre-costa.md +22 -0
- package/examples/events/assets/content/speakers/hans-mueller.md.ejs +22 -0
- package/examples/events/assets/content/speakers/isabella-martinez.md.ejs +22 -0
- package/examples/events/assets/content/speakers/kenji-nakamura.md.ejs +22 -0
- package/examples/events/assets/content/speakers/marie-dubois.md.ejs +20 -0
- package/examples/events/assets/content/speakers/priya-sharma.md.ejs +22 -0
- package/examples/events/assets/content/talks/croissant-lamination-secrets.md +39 -0
- package/examples/events/assets/content/talks/french-macaron-mastery.md.ejs +39 -0
- package/examples/events/assets/content/talks/neapolitan-pizza-tradition-meets-innovation.md.ejs +39 -0
- package/examples/events/assets/content/talks/savory-breads-of-the-mediterranean.md.ejs +39 -0
- package/examples/events/assets/content/talks/sourdough-from-starter-to-masterpiece.md.ejs +36 -0
- package/examples/events/assets/content/talks/the-art-of-the-perfect-tart.md.ejs +32 -0
- package/examples/events/assets/content/talks/the-science-of-sugar.md.ejs +39 -0
- package/examples/events/assets/content/talks/umami-in-pastry-east-meets-west.md.ejs +39 -0
- package/examples/events/assets/content-collections.ts +56 -0
- package/examples/events/assets/public/background-1.jpg +0 -0
- package/examples/events/assets/public/background-2.jpg +0 -0
- package/examples/events/assets/public/background-3.jpg +0 -0
- package/examples/events/assets/public/background-4.jpg +0 -0
- package/examples/events/assets/public/conference-logo.png +0 -0
- package/examples/events/assets/public/favicon.ico +0 -0
- package/examples/events/assets/public/speakers/andre-costa.jpg +0 -0
- package/examples/events/assets/public/speakers/hans-mueller.jpg +0 -0
- package/examples/events/assets/public/speakers/isabella-martinez.jpg +0 -0
- package/examples/events/assets/public/speakers/kenji-nakamura.jpg +0 -0
- package/examples/events/assets/public/speakers/marie-dubois.jpg +0 -0
- package/examples/events/assets/public/speakers/priya-sharma.jpg +0 -0
- package/examples/events/assets/public/talks/croissant-lamination-secrets.jpg +0 -0
- package/examples/events/assets/public/talks/french-macaron-mastery.jpg +0 -0
- package/examples/events/assets/public/talks/neapolitan-pizza-tradition-meets-innovation.jpg +0 -0
- package/examples/events/assets/public/talks/savory-breads-of-the-mediterranean.jpg +0 -0
- package/examples/events/assets/public/talks/sourdough-from-starter-to-masterpiece.jpg +0 -0
- package/examples/events/assets/public/talks/the-art-of-the-perfect-tart.jpg +0 -0
- package/examples/events/assets/public/talks/the-science-of-sugar.jpg +0 -0
- package/examples/events/assets/public/talks/umami-in-pastry-east-meets-west.jpg +0 -0
- package/examples/events/assets/public/tanstack-circle-logo.png +0 -0
- package/examples/events/assets/public/tanstack-word-logo-white.svg +1 -0
- package/examples/events/assets/src/components/Header.tsx +59 -0
- package/examples/events/assets/src/components/HeaderNav.tsx +67 -0
- package/examples/events/assets/src/components/HeroCarousel.tsx +61 -0
- package/examples/events/assets/src/components/RemyAssistant.tsx +207 -0
- package/examples/events/assets/src/components/SpeakerCard.tsx +67 -0
- package/examples/events/assets/src/components/TalkCard.tsx +77 -0
- package/examples/events/assets/src/components/ui/card.tsx +92 -0
- package/examples/events/assets/src/lib/conference-ai-hook.ts +26 -0
- package/examples/events/assets/src/lib/conference-tools.ts +210 -0
- package/examples/events/assets/src/lib/model-selection.ts +1 -0
- package/examples/events/assets/src/lib/utils.ts +6 -0
- package/examples/events/assets/src/routes/__root.tsx +70 -0
- package/examples/events/assets/src/routes/api.remy-chat.ts +119 -0
- package/examples/events/assets/src/routes/index.tsx +192 -0
- package/examples/events/assets/src/routes/schedule.index.tsx +274 -0
- package/examples/events/assets/src/routes/speakers.$slug.tsx +122 -0
- package/examples/events/assets/src/routes/speakers.index.tsx +40 -0
- package/examples/events/assets/src/routes/talks.$slug.tsx +116 -0
- package/examples/events/assets/src/routes/talks.index.tsx +40 -0
- package/examples/events/assets/src/styles.css +182 -0
- package/examples/events/info.json +74 -0
- package/examples/events/package.json +23 -0
- package/examples/marketing/README.md +60 -0
- package/examples/marketing/assets/public/logo.png +0 -0
- package/examples/marketing/assets/public/motorcycle-adventure.jpg +0 -0
- package/examples/marketing/assets/public/motorcycle-cruiser.jpg +0 -0
- package/examples/marketing/assets/public/motorcycle-scooter.jpg +0 -0
- package/examples/marketing/assets/public/motorcycle-sport.jpg +0 -0
- package/examples/marketing/assets/public/motorcycle-supersport.jpg +0 -0
- package/examples/marketing/assets/src/components/Header.tsx +36 -0
- package/examples/marketing/assets/src/components/MotorcycleAIAssistant.tsx +162 -0
- package/examples/marketing/assets/src/components/MotorcycleRecommendation.tsx +53 -0
- package/examples/marketing/assets/src/data/motorcycles.ts.ejs +77 -0
- package/examples/marketing/assets/src/lib/motorcycle-ai-hook.ts +24 -0
- package/examples/marketing/assets/src/lib/motorcycle-tools.ts +42 -0
- package/examples/marketing/assets/src/routes/__root.tsx +57 -0
- package/examples/marketing/assets/src/routes/api.motorcycle-chat.ts +78 -0
- package/examples/marketing/assets/src/routes/index.tsx +72 -0
- package/examples/marketing/assets/src/routes/motorcycles/$motorcycleId.tsx +56 -0
- package/examples/marketing/assets/src/store/motorcycle-assistant.ts +3 -0
- package/examples/marketing/assets/src/styles.css +212 -0
- package/examples/marketing/info.json +38 -0
- package/examples/marketing/package.json +14 -0
- package/examples/resume/README.md +82 -0
- package/examples/resume/assets/content/education/code-school.md +17 -0
- package/examples/resume/assets/content/jobs/freelance.md.ejs +13 -0
- package/examples/resume/assets/content/jobs/initech-junior.md +20 -0
- package/examples/resume/assets/content/jobs/initech-lead.md.ejs +29 -0
- package/examples/resume/assets/content/jobs/initrode-senior.md.ejs +28 -0
- package/examples/resume/assets/content-collections.ts +36 -0
- package/examples/resume/assets/public/headshot-on-white.jpg +0 -0
- package/examples/resume/assets/src/components/Header.tsx +33 -0
- package/examples/resume/assets/src/components/ResumeAssistant.tsx +193 -0
- package/examples/resume/assets/src/components/ui/badge.tsx +46 -0
- package/examples/resume/assets/src/components/ui/card.tsx +92 -0
- package/examples/resume/assets/src/components/ui/checkbox.tsx +30 -0
- package/examples/resume/assets/src/components/ui/hover-card.tsx +44 -0
- package/examples/resume/assets/src/components/ui/separator.tsx +26 -0
- package/examples/resume/assets/src/lib/resume-ai-hook.ts +21 -0
- package/examples/resume/assets/src/lib/resume-tools.ts +165 -0
- package/examples/resume/assets/src/lib/utils.ts +6 -0
- package/examples/resume/assets/src/routes/api.resume-chat.ts +110 -0
- package/examples/resume/assets/src/routes/index.tsx +220 -0
- package/examples/resume/assets/src/styles.css +138 -0
- package/examples/resume/info.json +25 -0
- package/examples/resume/package.json +26 -0
- package/package.json +39 -0
- package/project/base/_dot_claude/skills/content-collections/SKILL.md +505 -0
- package/project/base/_dot_claude/skills/netlify-blobs/SKILL.md +410 -0
- package/project/base/_dot_claude/skills/netlify-db/SKILL.md +424 -0
- package/project/base/_dot_claude/skills/netlify-debugging/SKILL.md +419 -0
- package/project/base/_dot_claude/skills/netlify-forms/SKILL.md +243 -0
- package/project/base/_dot_claude/skills/netlify-functions/SKILL.md +372 -0
- package/project/base/_dot_claude/skills/tanstack-start-api-routes/SKILL.md +421 -0
- package/project/base/_dot_claude/skills/tanstack-start-loaders/SKILL.md +426 -0
- package/project/base/_dot_claude/skills/tanstack-start-project-setup/SKILL.md +493 -0
- package/project/base/_dot_claude/skills/tanstack-start-routes/SKILL.md +430 -0
- package/project/base/_dot_claude/skills/tanstack-start-server-functions/SKILL.md +445 -0
- package/project/base/_dot_claude/skills/tanstack-start-typesafe-routing/SKILL.md +494 -0
- package/project/base/_dot_gitignore +8 -0
- package/project/base/netlify.toml +7 -0
- package/project/base/package.json +33 -0
- package/project/base/public/favicon.ico +0 -0
- package/project/base/public/tanstack-circle-logo.png +0 -0
- package/project/base/public/tanstack-word-logo-white.svg +1 -0
- package/project/base/src/components/Header.tsx +17 -0
- package/project/base/src/components/HeaderNav.tsx.ejs +179 -0
- package/project/base/src/router.tsx +15 -0
- package/project/base/src/routes/__root.tsx +57 -0
- package/project/base/src/routes/index.tsx +48 -0
- package/project/base/src/styles.css +15 -0
- package/project/base/tsconfig.json +28 -0
- package/project/base/vite.config.ts.ejs +25 -0
- package/project/packages.json +22 -0
- package/scripts/check-outdated-packages.js +421 -0
- package/src/cli.ts +343 -0
- package/src/index.ts +49 -0
- package/src/types.ts +15 -0
- package/tsconfig.json +17 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
|
|
3
|
+
import { cn } from '@/lib/utils'
|
|
4
|
+
|
|
5
|
+
function Card({ className, ...props }: React.ComponentProps<'div'>) {
|
|
6
|
+
return (
|
|
7
|
+
<div
|
|
8
|
+
data-slot="card"
|
|
9
|
+
className={cn(
|
|
10
|
+
'bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm',
|
|
11
|
+
className,
|
|
12
|
+
)}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function CardHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
19
|
+
return (
|
|
20
|
+
<div
|
|
21
|
+
data-slot="card-header"
|
|
22
|
+
className={cn(
|
|
23
|
+
'@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6',
|
|
24
|
+
className,
|
|
25
|
+
)}
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function CardTitle({ className, ...props }: React.ComponentProps<'div'>) {
|
|
32
|
+
return (
|
|
33
|
+
<div
|
|
34
|
+
data-slot="card-title"
|
|
35
|
+
className={cn('leading-none font-semibold', className)}
|
|
36
|
+
{...props}
|
|
37
|
+
/>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function CardDescription({ className, ...props }: React.ComponentProps<'div'>) {
|
|
42
|
+
return (
|
|
43
|
+
<div
|
|
44
|
+
data-slot="card-description"
|
|
45
|
+
className={cn('text-muted-foreground text-sm', className)}
|
|
46
|
+
{...props}
|
|
47
|
+
/>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function CardAction({ className, ...props }: React.ComponentProps<'div'>) {
|
|
52
|
+
return (
|
|
53
|
+
<div
|
|
54
|
+
data-slot="card-action"
|
|
55
|
+
className={cn(
|
|
56
|
+
'col-start-2 row-span-2 row-start-1 self-start justify-self-end',
|
|
57
|
+
className,
|
|
58
|
+
)}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function CardContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
65
|
+
return (
|
|
66
|
+
<div
|
|
67
|
+
data-slot="card-content"
|
|
68
|
+
className={cn('px-6', className)}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function CardFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
75
|
+
return (
|
|
76
|
+
<div
|
|
77
|
+
data-slot="card-footer"
|
|
78
|
+
className={cn('flex items-center px-6 [.border-t]:pt-6', className)}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export {
|
|
85
|
+
Card,
|
|
86
|
+
CardHeader,
|
|
87
|
+
CardFooter,
|
|
88
|
+
CardTitle,
|
|
89
|
+
CardAction,
|
|
90
|
+
CardDescription,
|
|
91
|
+
CardContent,
|
|
92
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fetchServerSentEvents,
|
|
3
|
+
useChat,
|
|
4
|
+
createChatClientOptions,
|
|
5
|
+
} from '@tanstack/ai-react'
|
|
6
|
+
import type { InferChatMessages } from '@tanstack/ai-react'
|
|
7
|
+
|
|
8
|
+
// Default chat options for type inference
|
|
9
|
+
const defaultChatOptions = createChatClientOptions({
|
|
10
|
+
connection: fetchServerSentEvents('/api/remy-chat'),
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
export type ConferenceChatMessages = InferChatMessages<typeof defaultChatOptions>
|
|
14
|
+
|
|
15
|
+
export const useConferenceChat = (speakerSlug?: string, talkSlug?: string) => {
|
|
16
|
+
const chatOptions = createChatClientOptions({
|
|
17
|
+
connection: fetchServerSentEvents('/api/remy-chat', {
|
|
18
|
+
body: {
|
|
19
|
+
speakerSlug,
|
|
20
|
+
talkSlug,
|
|
21
|
+
},
|
|
22
|
+
}),
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
return useChat(chatOptions)
|
|
26
|
+
}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { toolDefinition } from '@tanstack/ai'
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
|
|
4
|
+
import { allSpeakers, allTalks } from 'content-collections'
|
|
5
|
+
|
|
6
|
+
// Tool definition for getting a speaker by slug
|
|
7
|
+
export const getSpeakerBySlugToolDef = toolDefinition({
|
|
8
|
+
name: 'getSpeakerBySlug',
|
|
9
|
+
description:
|
|
10
|
+
'Get the full profile and bio of a specific speaker. Use this when asked about a particular speaker.',
|
|
11
|
+
inputSchema: z.object({
|
|
12
|
+
slug: z.string().describe('The slug of the speaker'),
|
|
13
|
+
}),
|
|
14
|
+
outputSchema: z.object({
|
|
15
|
+
name: z.string(),
|
|
16
|
+
title: z.string(),
|
|
17
|
+
specialty: z.string(),
|
|
18
|
+
restaurant: z.string(),
|
|
19
|
+
location: z.string(),
|
|
20
|
+
bio: z.string(),
|
|
21
|
+
awards: z.array(z.string()),
|
|
22
|
+
}),
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
// Server implementation
|
|
26
|
+
export const getSpeakerBySlug = getSpeakerBySlugToolDef.server(({ slug }) => {
|
|
27
|
+
const speaker = allSpeakers.find((s) => s.slug === slug)
|
|
28
|
+
if (!speaker) {
|
|
29
|
+
return {
|
|
30
|
+
name: 'Speaker not found',
|
|
31
|
+
title: '',
|
|
32
|
+
specialty: '',
|
|
33
|
+
restaurant: '',
|
|
34
|
+
location: '',
|
|
35
|
+
bio: 'The requested speaker was not found.',
|
|
36
|
+
awards: [],
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
name: speaker.name,
|
|
41
|
+
title: speaker.title,
|
|
42
|
+
specialty: speaker.specialty,
|
|
43
|
+
restaurant: speaker.restaurant,
|
|
44
|
+
location: speaker.location,
|
|
45
|
+
bio: speaker.content,
|
|
46
|
+
awards: speaker.awards || [],
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
// Tool definition for getting a talk by slug
|
|
51
|
+
export const getTalkBySlugToolDef = toolDefinition({
|
|
52
|
+
name: 'getTalkBySlug',
|
|
53
|
+
description:
|
|
54
|
+
'Get the full details of a specific session/talk. Use this when asked about a particular session.',
|
|
55
|
+
inputSchema: z.object({
|
|
56
|
+
slug: z.string().describe('The slug of the talk'),
|
|
57
|
+
}),
|
|
58
|
+
outputSchema: z.object({
|
|
59
|
+
title: z.string(),
|
|
60
|
+
speaker: z.string(),
|
|
61
|
+
duration: z.string(),
|
|
62
|
+
topics: z.array(z.string()),
|
|
63
|
+
description: z.string(),
|
|
64
|
+
}),
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
// Server implementation
|
|
68
|
+
export const getTalkBySlug = getTalkBySlugToolDef.server(({ slug }) => {
|
|
69
|
+
const talk = allTalks.find((t) => t.slug === slug)
|
|
70
|
+
if (!talk) {
|
|
71
|
+
return {
|
|
72
|
+
title: 'Session not found',
|
|
73
|
+
speaker: '',
|
|
74
|
+
duration: '',
|
|
75
|
+
topics: [],
|
|
76
|
+
description: 'The requested session was not found.',
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
title: talk.title,
|
|
81
|
+
speaker: talk.speaker,
|
|
82
|
+
duration: talk.duration,
|
|
83
|
+
topics: talk.topics,
|
|
84
|
+
description: talk.content,
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
// Tool definition for listing all speakers
|
|
89
|
+
export const getAllSpeakersToolDef = toolDefinition({
|
|
90
|
+
name: 'getAllSpeakers',
|
|
91
|
+
description:
|
|
92
|
+
'Get a list of all speakers at the conference with their names, specialties, and restaurants.',
|
|
93
|
+
inputSchema: z.object({}),
|
|
94
|
+
outputSchema: z.array(
|
|
95
|
+
z.object({
|
|
96
|
+
slug: z.string(),
|
|
97
|
+
name: z.string(),
|
|
98
|
+
specialty: z.string(),
|
|
99
|
+
restaurant: z.string(),
|
|
100
|
+
location: z.string(),
|
|
101
|
+
}),
|
|
102
|
+
),
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
// Server implementation
|
|
106
|
+
export const getAllSpeakers = getAllSpeakersToolDef.server(() => {
|
|
107
|
+
return allSpeakers.map((speaker) => ({
|
|
108
|
+
slug: speaker.slug,
|
|
109
|
+
name: speaker.name,
|
|
110
|
+
specialty: speaker.specialty,
|
|
111
|
+
restaurant: speaker.restaurant,
|
|
112
|
+
location: speaker.location,
|
|
113
|
+
}))
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
// Tool definition for listing all talks
|
|
117
|
+
export const getAllTalksToolDef = toolDefinition({
|
|
118
|
+
name: 'getAllTalks',
|
|
119
|
+
description:
|
|
120
|
+
'Get a list of all sessions/talks at the conference with their titles, speakers, and topics.',
|
|
121
|
+
inputSchema: z.object({}),
|
|
122
|
+
outputSchema: z.array(
|
|
123
|
+
z.object({
|
|
124
|
+
slug: z.string(),
|
|
125
|
+
title: z.string(),
|
|
126
|
+
speaker: z.string(),
|
|
127
|
+
duration: z.string(),
|
|
128
|
+
topics: z.array(z.string()),
|
|
129
|
+
}),
|
|
130
|
+
),
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
// Server implementation
|
|
134
|
+
export const getAllTalks = getAllTalksToolDef.server(() => {
|
|
135
|
+
return allTalks.map((talk) => ({
|
|
136
|
+
slug: talk.slug,
|
|
137
|
+
title: talk.title,
|
|
138
|
+
speaker: talk.speaker,
|
|
139
|
+
duration: talk.duration,
|
|
140
|
+
topics: talk.topics,
|
|
141
|
+
}))
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
// Tool definition for searching conference content
|
|
145
|
+
export const searchConferenceToolDef = toolDefinition({
|
|
146
|
+
name: 'searchConference',
|
|
147
|
+
description:
|
|
148
|
+
'Search for speakers or sessions by keyword. Use this to find content matching user queries about topics, techniques, or names.',
|
|
149
|
+
inputSchema: z.object({
|
|
150
|
+
query: z.string().describe('The search query'),
|
|
151
|
+
}),
|
|
152
|
+
outputSchema: z.object({
|
|
153
|
+
speakers: z.array(
|
|
154
|
+
z.object({
|
|
155
|
+
slug: z.string(),
|
|
156
|
+
name: z.string(),
|
|
157
|
+
specialty: z.string(),
|
|
158
|
+
restaurant: z.string(),
|
|
159
|
+
}),
|
|
160
|
+
),
|
|
161
|
+
talks: z.array(
|
|
162
|
+
z.object({
|
|
163
|
+
slug: z.string(),
|
|
164
|
+
title: z.string(),
|
|
165
|
+
speaker: z.string(),
|
|
166
|
+
topics: z.array(z.string()),
|
|
167
|
+
}),
|
|
168
|
+
),
|
|
169
|
+
}),
|
|
170
|
+
})
|
|
171
|
+
|
|
172
|
+
// Server implementation
|
|
173
|
+
export const searchConference = searchConferenceToolDef.server(({ query }) => {
|
|
174
|
+
const queryLower = query.toLowerCase()
|
|
175
|
+
|
|
176
|
+
const matchingSpeakers = allSpeakers
|
|
177
|
+
.filter(
|
|
178
|
+
(speaker) =>
|
|
179
|
+
speaker.name.toLowerCase().includes(queryLower) ||
|
|
180
|
+
speaker.specialty.toLowerCase().includes(queryLower) ||
|
|
181
|
+
speaker.restaurant.toLowerCase().includes(queryLower) ||
|
|
182
|
+
speaker.content.toLowerCase().includes(queryLower),
|
|
183
|
+
)
|
|
184
|
+
.map((speaker) => ({
|
|
185
|
+
slug: speaker.slug,
|
|
186
|
+
name: speaker.name,
|
|
187
|
+
specialty: speaker.specialty,
|
|
188
|
+
restaurant: speaker.restaurant,
|
|
189
|
+
}))
|
|
190
|
+
|
|
191
|
+
const matchingTalks = allTalks
|
|
192
|
+
.filter(
|
|
193
|
+
(talk) =>
|
|
194
|
+
talk.title.toLowerCase().includes(queryLower) ||
|
|
195
|
+
talk.speaker.toLowerCase().includes(queryLower) ||
|
|
196
|
+
talk.topics.some((topic) => topic.toLowerCase().includes(queryLower)) ||
|
|
197
|
+
talk.content.toLowerCase().includes(queryLower),
|
|
198
|
+
)
|
|
199
|
+
.map((talk) => ({
|
|
200
|
+
slug: talk.slug,
|
|
201
|
+
title: talk.title,
|
|
202
|
+
speaker: talk.speaker,
|
|
203
|
+
topics: talk.topics,
|
|
204
|
+
}))
|
|
205
|
+
|
|
206
|
+
return {
|
|
207
|
+
speakers: matchingSpeakers,
|
|
208
|
+
talks: matchingTalks,
|
|
209
|
+
}
|
|
210
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Provider = 'anthropic' | 'openai' | 'gemini' | 'ollama'
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { HeadContent, Scripts, createRootRoute } from '@tanstack/react-router'
|
|
2
|
+
import { TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools'
|
|
3
|
+
import { TanStackDevtools } from '@tanstack/react-devtools'
|
|
4
|
+
|
|
5
|
+
import Header from '../components/Header'
|
|
6
|
+
|
|
7
|
+
import appCss from '../styles.css?url'
|
|
8
|
+
|
|
9
|
+
export const Route = createRootRoute({
|
|
10
|
+
head: () => ({
|
|
11
|
+
meta: [
|
|
12
|
+
{
|
|
13
|
+
charSet: 'utf-8',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: 'viewport',
|
|
17
|
+
content: 'width=device-width, initial-scale=1',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
title: 'Haute Pâtisserie 2026 | Elite Baking Conference',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'description',
|
|
24
|
+
content: 'Join the world\'s most celebrated pastry chefs for three days of masterclasses, demonstrations, and culinary inspiration.',
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
links: [
|
|
28
|
+
{
|
|
29
|
+
rel: 'stylesheet',
|
|
30
|
+
href: appCss,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
rel: 'preconnect',
|
|
34
|
+
href: 'https://fonts.googleapis.com',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
rel: 'preconnect',
|
|
38
|
+
href: 'https://fonts.gstatic.com',
|
|
39
|
+
crossOrigin: 'anonymous',
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
}),
|
|
43
|
+
shellComponent: RootDocument,
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
function RootDocument({ children }: { children: React.ReactNode }) {
|
|
47
|
+
return (
|
|
48
|
+
<html lang="en" className="dark">
|
|
49
|
+
<head>
|
|
50
|
+
<HeadContent />
|
|
51
|
+
</head>
|
|
52
|
+
<body className="bg-background min-h-screen text-foreground">
|
|
53
|
+
<Header />
|
|
54
|
+
<main className="mt-32">{children}</main>
|
|
55
|
+
<TanStackDevtools
|
|
56
|
+
config={{
|
|
57
|
+
position: 'bottom-right',
|
|
58
|
+
}}
|
|
59
|
+
plugins={[
|
|
60
|
+
{
|
|
61
|
+
name: 'Tanstack Router',
|
|
62
|
+
render: <TanStackRouterDevtoolsPanel />,
|
|
63
|
+
},
|
|
64
|
+
]}
|
|
65
|
+
/>
|
|
66
|
+
<Scripts />
|
|
67
|
+
</body>
|
|
68
|
+
</html>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { createFileRoute } from '@tanstack/react-router'
|
|
2
|
+
import { chat, maxIterations, toServerSentEventsResponse } from '@tanstack/ai'
|
|
3
|
+
import { anthropicText } from '@tanstack/ai-anthropic'
|
|
4
|
+
import { openaiText } from '@tanstack/ai-openai'
|
|
5
|
+
import { geminiText } from '@tanstack/ai-gemini'
|
|
6
|
+
import { ollamaText } from '@tanstack/ai-ollama'
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
getSpeakerBySlug,
|
|
10
|
+
getTalkBySlug,
|
|
11
|
+
getAllSpeakers,
|
|
12
|
+
getAllTalks,
|
|
13
|
+
searchConference,
|
|
14
|
+
} from '@/lib/conference-tools'
|
|
15
|
+
import type { Provider } from '@/lib/model-selection'
|
|
16
|
+
|
|
17
|
+
export const Route = createFileRoute('/api/remy-chat')({
|
|
18
|
+
server: {
|
|
19
|
+
handlers: {
|
|
20
|
+
POST: async ({ request }) => {
|
|
21
|
+
const requestSignal = request.signal
|
|
22
|
+
|
|
23
|
+
if (requestSignal.aborted) {
|
|
24
|
+
return new Response(null, { status: 499 })
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const abortController = new AbortController()
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
const body = await request.json()
|
|
31
|
+
const { messages, speakerSlug, talkSlug } = body
|
|
32
|
+
const data = body.data || {}
|
|
33
|
+
|
|
34
|
+
const SYSTEM_PROMPT = `You are Remy, a charming and knowledgeable culinary assistant for the Haute Pâtisserie 2026 conference in Paris. You have a warm, enthusiastic personality and deep appreciation for the art of pastry and baking.
|
|
35
|
+
|
|
36
|
+
PERSONALITY:
|
|
37
|
+
- Speak with warmth and a touch of French flair (occasional "magnifique!", "c'est parfait!", etc.)
|
|
38
|
+
- Be genuinely passionate about pastry, bread, and culinary arts
|
|
39
|
+
- Knowledgeable about techniques, ingredients, and the history of baking
|
|
40
|
+
- Helpful and encouraging to both novices and professionals
|
|
41
|
+
|
|
42
|
+
CAPABILITIES:
|
|
43
|
+
1. Use getSpeakerBySlug to get detailed information about a specific speaker
|
|
44
|
+
2. Use getTalkBySlug to get detailed information about a specific session
|
|
45
|
+
3. Use getAllSpeakers to see the complete speaker lineup
|
|
46
|
+
4. Use getAllTalks to see all available sessions
|
|
47
|
+
5. Use searchConference to find speakers or sessions matching a topic or keyword
|
|
48
|
+
|
|
49
|
+
INSTRUCTIONS:
|
|
50
|
+
- When asked about the conference, speakers, or sessions, use your tools to provide accurate information
|
|
51
|
+
- Help attendees find sessions that match their interests
|
|
52
|
+
- Share enthusiasm about the speakers and their expertise
|
|
53
|
+
- If asked about pastry techniques, you can provide general knowledge while recommending relevant sessions
|
|
54
|
+
- Keep responses conversational but informative
|
|
55
|
+
- When recommending sessions, explain why they might be interesting based on the user's query
|
|
56
|
+
|
|
57
|
+
${speakerSlug ? `CONTEXT: The user is viewing the profile of the speaker with slug "${speakerSlug}".` : ''}
|
|
58
|
+
${talkSlug ? `CONTEXT: The user is viewing the session with slug "${talkSlug}".` : ''}
|
|
59
|
+
|
|
60
|
+
Remember: You are the friendly face of Haute Pâtisserie 2026. Make every attendee feel welcome and excited about the culinary journey ahead!`
|
|
61
|
+
|
|
62
|
+
// Determine the best available provider
|
|
63
|
+
let provider: Provider = data.provider || 'ollama'
|
|
64
|
+
let model: string = data.model || 'mistral:7b'
|
|
65
|
+
|
|
66
|
+
// Use the first available provider with an API key, fallback to ollama
|
|
67
|
+
if (process.env.ANTHROPIC_API_KEY) {
|
|
68
|
+
provider = 'anthropic'
|
|
69
|
+
model = 'claude-haiku-4-5'
|
|
70
|
+
} else if (process.env.OPENAI_API_KEY) {
|
|
71
|
+
provider = 'openai'
|
|
72
|
+
model = 'gpt-4o'
|
|
73
|
+
} else if (process.env.GEMINI_API_KEY) {
|
|
74
|
+
provider = 'gemini'
|
|
75
|
+
model = 'gemini-2.0-flash-exp'
|
|
76
|
+
}
|
|
77
|
+
// else keep ollama as default
|
|
78
|
+
|
|
79
|
+
// Adapter factory pattern for multi-vendor support
|
|
80
|
+
const adapterConfig = {
|
|
81
|
+
anthropic: () =>
|
|
82
|
+
anthropicText((model || 'claude-haiku-4-5') as any),
|
|
83
|
+
openai: () => openaiText((model || 'gpt-4o') as any),
|
|
84
|
+
gemini: () => geminiText((model || 'gemini-2.0-flash-exp') as any),
|
|
85
|
+
ollama: () => ollamaText((model || 'mistral:7b') as any),
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const adapter = adapterConfig[provider]()
|
|
89
|
+
|
|
90
|
+
const stream = chat({
|
|
91
|
+
adapter,
|
|
92
|
+
tools: [getSpeakerBySlug, getTalkBySlug, getAllSpeakers, getAllTalks, searchConference],
|
|
93
|
+
systemPrompts: [SYSTEM_PROMPT],
|
|
94
|
+
agentLoopStrategy: maxIterations(5),
|
|
95
|
+
messages,
|
|
96
|
+
abortController,
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
return toServerSentEventsResponse(stream, { abortController })
|
|
100
|
+
} catch (error: any) {
|
|
101
|
+
console.error('Remy chat error:', error)
|
|
102
|
+
if (error.name === 'AbortError' || abortController.signal.aborted) {
|
|
103
|
+
return new Response(null, { status: 499 })
|
|
104
|
+
}
|
|
105
|
+
return new Response(
|
|
106
|
+
JSON.stringify({
|
|
107
|
+
error: 'Failed to process chat request',
|
|
108
|
+
message: error.message,
|
|
109
|
+
}),
|
|
110
|
+
{
|
|
111
|
+
status: 500,
|
|
112
|
+
headers: { 'Content-Type': 'application/json' },
|
|
113
|
+
},
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
})
|