import { getCookie } from 'h3'

export function getPiBaseUrl(event: any): string {
  const cookieUrl = getCookie(event, 'quibot-pi-url')
  if (cookieUrl) return decodeURIComponent(cookieUrl)

  const config = useRuntimeConfig()
  return config.quibotBaseUrl
}
