Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/runtime/server/utils/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ export interface LLMSHooks {
export const llmsHooks = createHooks<LLMSHooks>()

llmsHooks.beforeEach(() => {
console.warn('[nuxt-llms] `llmsHooks` are deprecated and will be removed in future versions. Use `useNitroApp().hooks.hook(\'llms:generate\', (event, options) => {})` instead')
// @ts-expect-error - `_hooks` is private
const hooks = Object.values(llmsHooks._hooks || {})
const hasRegisteredHook = hooks.some(hooksList => Array.isArray(hooksList) && hooksList.length > 0)

if (!hasRegisteredHook) {
console.warn('[nuxt-llms] `llmsHooks` are deprecated and will be removed in future versions. Use `useNitroApp().hooks.hook(\'llms:generate\', (event, options) => {})` instead')
}
})

/**
Expand Down