addon.sql 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. -- default admin account
  2. INSERT INTO `sys_accounts` (`name`, `email`, `email_confirmed`, `receive_updates`, `receive_news`, `password`, `salt`, `role`, `added`) VALUES
  3. ({admin_username}, {admin_email}, 1, 1, 1, {admin_pwd_hash}, {admin_pwd_salt}, 3, {current_timestamp});
  4. SET @iAccountId = LAST_INSERT_ID();
  5. INSERT INTO `sys_profiles` (`account_id`, `type`, `content_id`, `status`) VALUES
  6. (@iAccountId, 'system', @iAccountId, 'active');
  7. INSERT INTO `sys_std_roles_members` (`account_id`, `role`) VALUES
  8. (@iAccountId, 1);
  9. -- default bot profile
  10. INSERT INTO `sys_accounts` (`name`, `email`, `email_confirmed`, `receive_updates`, `receive_news`, `password`, `salt`, `role`, `added`) VALUES
  11. ('Robot', '', 1, 0, 0, '', '', 3, {current_timestamp});
  12. SET @iAccountIdBot = LAST_INSERT_ID();
  13. INSERT INTO `sys_profiles` (`account_id`, `type`, `content_id`, `status`) VALUES
  14. (@iAccountIdBot, 'system', @iAccountIdBot, 'active');
  15. SET @iProfileIdBot = LAST_INSERT_ID();
  16. -- install time
  17. UPDATE `sys_modules` SET `date` = {time} WHERE `name` = 'system' AND `date` = 0;
  18. -- site settings
  19. UPDATE `sys_options` SET `VALUE` = {admin_email} WHERE `Name` = 'site_email';
  20. UPDATE `sys_options` SET `VALUE` = {site_title} WHERE `Name` = 'site_title';
  21. UPDATE `sys_options` SET `VALUE` = {site_email} WHERE `Name` = 'site_email_notify';
  22. UPDATE `sys_options` SET `VALUE` = {language} WHERE `Name` = 'lang_default';
  23. UPDATE `sys_options` SET `VALUE` = {oauth_key} WHERE `Name` = 'sys_oauth_key';
  24. UPDATE `sys_options` SET `VALUE` = {oauth_secret} WHERE `Name` = 'sys_oauth_secret';
  25. UPDATE `sys_options` SET `VALUE` = @iProfileIdBot WHERE `Name` = 'sys_profile_bot';
  26. -- UNA operator proxy: the master holds the provider key.
  27. INSERT INTO `sys_agents_models` SET
  28. `type` = 'una-proxy',
  29. `model` = 'una-proxy',
  30. `title` = 'UNA proxy',
  31. `duplicate` = 0;
  32. SET @iUnaProxyModel = LAST_INSERT_ID();
  33. INSERT INTO `sys_agents_vector_store` SET
  34. `embedding_provider_id` = 0,
  35. `type` = 'una-proxy',
  36. `title` = 'UNA knowledge',
  37. `docs` = 'Remote knowledge on the UNA master. The master embeds and searches.',
  38. `topk` = 4,
  39. `duplicate` = 0,
  40. `active` = 1;
  41. SET @iUnaProxyStore = LAST_INSERT_ID();
  42. INSERT INTO `sys_agents_agents` SET
  43. `name` = 'una_operator',
  44. `title` = 'UNA operator',
  45. `model_id` = @iUnaProxyModel,
  46. `profile_id` = @iProfileIdBot,
  47. `vector_store_id` = @iUnaProxyStore,
  48. `prompt_system` = 'You are the site operator assistant. Answer questions about this site content. Use content_structure, content_search, content_get, and comments_get. Use the extra context for how UNA works. Do not change data.',
  49. `tools` = CONCAT_WS(',',
  50. (SELECT `id` FROM `sys_agents_tools` WHERE `type` = 'content_structure' ORDER BY `id` LIMIT 1),
  51. (SELECT `id` FROM `sys_agents_tools` WHERE `type` = 'content_search' ORDER BY `id` LIMIT 1),
  52. (SELECT `id` FROM `sys_agents_tools` WHERE `type` = 'content_get' ORDER BY `id` LIMIT 1),
  53. (SELECT `id` FROM `sys_agents_tools` WHERE `type` = 'comments_get' ORDER BY `id` LIMIT 1)
  54. ),
  55. `trigger` = 'manual',
  56. `added` = {current_timestamp},
  57. `active` = 1;
  58. UPDATE `sys_options` SET `VALUE` = LAST_INSERT_ID() WHERE `Name` = 'sys_agents_operator_agent';
  59. UPDATE `sys_modules` SET `version` = {version} WHERE `name` = 'system';