AiAssistant.constants.ts 972 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { SupportedAssistantEntities } from './AIAssistant.types'
  2. export const ASSISTANT_ERRORS = {
  3. 'context-exceeded': {
  4. message:
  5. 'This conversation has become too long for the Assistant to process. Please start a new chat to continue.',
  6. },
  7. default: {
  8. message: 'If the error persists while retrying, you may try creating a new chat and try again.',
  9. },
  10. }
  11. export const ASSISTANT_SUPPORT_ENTITIES: {
  12. id: SupportedAssistantEntities
  13. label: string
  14. name: string
  15. }[] = [
  16. { id: 'rls-policies', label: 'RLS Policies', name: 'RLS policy' },
  17. { id: 'functions', label: 'Functions', name: 'database function' },
  18. ]
  19. export const SAFE_FUNCTIONS = [
  20. 'count(',
  21. 'sum(',
  22. 'avg(',
  23. 'min(',
  24. 'max(',
  25. 'coalesce(',
  26. 'nullif(',
  27. 'current_timestamp',
  28. 'current_date',
  29. 'length(',
  30. 'lower(',
  31. 'upper(',
  32. 'trim(',
  33. 'substring(',
  34. 'to_char(',
  35. 'to_date(',
  36. 'extract(',
  37. 'date(',
  38. 'date_trunc(',
  39. 'string_agg(',
  40. 'in (',
  41. 'now(',
  42. 'left(',
  43. ]