diff --git a/Gemfile b/Gemfile index 71d511ace..1526bf686 100644 --- a/Gemfile +++ b/Gemfile @@ -37,6 +37,8 @@ gem 'liquid' gem 'commonmarker', '~> 0.23.11' # Validate Data against JSON Schema gem 'json_schemer' +# used in swagger build +gem 'json_refs' # Rack middleware for blocking & throttling abusive requests gem 'rack-attack', '>= 6.7.0' # a utility tool for streaming, flexible and safe downloading of remote files @@ -198,9 +200,6 @@ group :development do gem 'scss_lint', require: false gem 'web-console', '>= 4.2.1' - # used in swagger build - gem 'json_refs' - # When we want to squash migrations gem 'squasher' diff --git a/app/builders/messages/instagram/base_message_builder.rb b/app/builders/messages/instagram/base_message_builder.rb index 767115bc6..8b40ba3c9 100644 --- a/app/builders/messages/instagram/base_message_builder.rb +++ b/app/builders/messages/instagram/base_message_builder.rb @@ -152,11 +152,13 @@ class Messages::Instagram::BaseMessageBuilder < Messages::Messenger::MessageBuil end def message_already_exists? - cw_message = conversation.messages.where( - source_id: @messaging[:message][:mid] - ).first + find_message_by_source_id(@messaging[:message][:mid]).present? + end - cw_message.present? + def find_message_by_source_id(source_id) + return unless source_id + + @message = Message.find_by(source_id: source_id) end def all_unsupported_files? diff --git a/app/controllers/api/v1/accounts/articles_controller.rb b/app/controllers/api/v1/accounts/articles_controller.rb index 9148e4386..da2be2312 100644 --- a/app/controllers/api/v1/accounts/articles_controller.rb +++ b/app/controllers/api/v1/accounts/articles_controller.rb @@ -68,7 +68,7 @@ class Api::V1::Accounts::ArticlesController < Api::V1::Accounts::BaseController def article_params params.require(:article).permit( - :title, :slug, :position, :content, :description, :position, :category_id, :author_id, :associated_article_id, :status, + :title, :slug, :position, :content, :description, :category_id, :author_id, :associated_article_id, :status, :locale, meta: [:title, :description, { tags: [] }] diff --git a/app/controllers/platform/api/v1/users_controller.rb b/app/controllers/platform/api/v1/users_controller.rb index 453e475b0..7b9284cd9 100644 --- a/app/controllers/platform/api/v1/users_controller.rb +++ b/app/controllers/platform/api/v1/users_controller.rb @@ -1,9 +1,9 @@ class Platform::Api::V1::UsersController < PlatformController # ref: https://stackoverflow.com/a/45190318/939299 # set resource is called for other actions already in platform controller - # we want to add login to that chain as well - before_action(only: [:login]) { set_resource } - before_action(only: [:login]) { validate_platform_app_permissible } + # we want to add login and token to that chain as well + before_action(only: [:login, :token]) { set_resource } + before_action(only: [:login, :token]) { validate_platform_app_permissible } def show; end @@ -18,6 +18,8 @@ class Platform::Api::V1::UsersController < PlatformController render json: { url: @resource.generate_sso_link } end + def token; end + def update @resource.assign_attributes(user_update_params) diff --git a/app/controllers/super_admin/app_configs_controller.rb b/app/controllers/super_admin/app_configs_controller.rb index 550b6c893..204bfc95b 100644 --- a/app/controllers/super_admin/app_configs_controller.rb +++ b/app/controllers/super_admin/app_configs_controller.rb @@ -32,22 +32,17 @@ class SuperAdmin::AppConfigsController < SuperAdmin::ApplicationController end def allowed_configs - @allowed_configs = case @config - when 'facebook' - %w[FB_APP_ID FB_VERIFY_TOKEN FB_APP_SECRET IG_VERIFY_TOKEN FACEBOOK_API_VERSION ENABLE_MESSENGER_CHANNEL_HUMAN_AGENT] - when 'shopify' - %w[SHOPIFY_CLIENT_ID SHOPIFY_CLIENT_SECRET] - when 'microsoft' - %w[AZURE_APP_ID AZURE_APP_SECRET] - when 'email' - ['MAILER_INBOUND_EMAIL_DOMAIN'] - when 'linear' - %w[LINEAR_CLIENT_ID LINEAR_CLIENT_SECRET] - when 'instagram' - %w[INSTAGRAM_APP_ID INSTAGRAM_APP_SECRET INSTAGRAM_VERIFY_TOKEN INSTAGRAM_API_VERSION ENABLE_INSTAGRAM_CHANNEL_HUMAN_AGENT] - else - %w[ENABLE_ACCOUNT_SIGNUP FIREBASE_PROJECT_ID FIREBASE_CREDENTIALS] - end + mapping = { + 'facebook' => %w[FB_APP_ID FB_VERIFY_TOKEN FB_APP_SECRET IG_VERIFY_TOKEN FACEBOOK_API_VERSION ENABLE_MESSENGER_CHANNEL_HUMAN_AGENT], + 'shopify' => %w[SHOPIFY_CLIENT_ID SHOPIFY_CLIENT_SECRET], + 'microsoft' => %w[AZURE_APP_ID AZURE_APP_SECRET], + 'email' => ['MAILER_INBOUND_EMAIL_DOMAIN'], + 'linear' => %w[LINEAR_CLIENT_ID LINEAR_CLIENT_SECRET], + 'slack' => %w[SLACK_CLIENT_ID SLACK_CLIENT_SECRET], + 'instagram' => %w[INSTAGRAM_APP_ID INSTAGRAM_APP_SECRET INSTAGRAM_VERIFY_TOKEN INSTAGRAM_API_VERSION ENABLE_INSTAGRAM_CHANNEL_HUMAN_AGENT] + } + + @allowed_configs = mapping.fetch(@config, %w[ENABLE_ACCOUNT_SIGNUP FIREBASE_PROJECT_ID FIREBASE_CREDENTIALS]) end end diff --git a/app/javascript/dashboard/components-next/captain/pageComponents/assistant/EditAssistantForm.vue b/app/javascript/dashboard/components-next/captain/pageComponents/assistant/EditAssistantForm.vue index 362950802..3134d7062 100644 --- a/app/javascript/dashboard/components-next/captain/pageComponents/assistant/EditAssistantForm.vue +++ b/app/javascript/dashboard/components-next/captain/pageComponents/assistant/EditAssistantForm.vue @@ -42,6 +42,7 @@ const initialState = { conversationFaqs: false, memories: false, }, + temperature: 1, }; const state = reactive({ ...initialState }); @@ -87,6 +88,7 @@ const updateStateFromAssistant = assistant => { conversationFaqs: config.feature_faq || false, memories: config.feature_memory || false, }; + state.temperature = config.temperature || 1; }; const handleBasicInfoUpdate = async () => { @@ -136,6 +138,7 @@ const handleInstructionsUpdate = async () => { const payload = { config: { ...props.assistant.config, + temperature: state.temperature || 1, instructions: state.instructions, }, }; @@ -212,7 +215,7 @@ watch( -
+
+
+ +
+ + {{ state.temperature }} +
+

+ {{ t('CAPTAIN.ASSISTANTS.FORM.TEMPERATURE.DESCRIPTION') }} +

+