Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7b13949e1 | ||
|
|
cc87429903 |
@@ -107,6 +107,7 @@ const onClickCancel = () => {
|
||||
|
||||
<TextArea
|
||||
v-model="state.description"
|
||||
:max-length="500"
|
||||
:label="
|
||||
t('CAPTAIN.ASSISTANTS.SCENARIOS.ADD.NEW.FORM.DESCRIPTION.LABEL')
|
||||
"
|
||||
|
||||
@@ -213,6 +213,7 @@ const renderInstruction = instruction => () =>
|
||||
|
||||
<TextArea
|
||||
v-model="state.description"
|
||||
:max-length="500"
|
||||
:label="
|
||||
t('CAPTAIN.ASSISTANTS.SCENARIOS.ADD.NEW.FORM.DESCRIPTION.LABEL')
|
||||
"
|
||||
|
||||
+1
@@ -122,6 +122,7 @@ watch(
|
||||
|
||||
<Editor
|
||||
v-model="state.description"
|
||||
:max-length="500"
|
||||
:label="t('CAPTAIN.ASSISTANTS.FORM.DESCRIPTION.LABEL')"
|
||||
:placeholder="t('CAPTAIN.ASSISTANTS.FORM.DESCRIPTION.PLACEHOLDER')"
|
||||
:message="formErrors.description"
|
||||
|
||||
+1
@@ -117,6 +117,7 @@ watch(
|
||||
|
||||
<Editor
|
||||
v-model="state.description"
|
||||
:max-length="500"
|
||||
:label="t('CAPTAIN.ASSISTANTS.FORM.DESCRIPTION.LABEL')"
|
||||
:placeholder="t('CAPTAIN.ASSISTANTS.FORM.DESCRIPTION.PLACEHOLDER')"
|
||||
:message="formErrors.description"
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
# index_assignment_policies_on_enabled (enabled)
|
||||
#
|
||||
class AssignmentPolicy < ApplicationRecord
|
||||
DEFAULT_EXCLUDE_OLDER_THAN_HOURS = 168
|
||||
|
||||
belongs_to :account
|
||||
has_many :inbox_assignment_policies, dependent: :destroy
|
||||
has_many :inboxes, through: :inbox_assignment_policies
|
||||
|
||||
@@ -35,9 +35,9 @@ class AutoAssignment::AssignmentService
|
||||
def unassigned_conversations(limit)
|
||||
scope = inbox.conversations.unassigned.open
|
||||
|
||||
# Skip stale backlog with no activity beyond the policy's age threshold (defaults to 7 days)
|
||||
# Skip stale backlog with no activity beyond the age threshold
|
||||
policy = inbox.assignment_policy
|
||||
scope = apply_age_exclusions(scope, policy&.exclude_older_than_hours)
|
||||
scope = apply_age_exclusions(scope, age_exclusion_hours(policy))
|
||||
|
||||
# Apply conversation priority using assignment policy if available
|
||||
scope = if policy&.longest_waiting?
|
||||
@@ -49,6 +49,12 @@ class AutoAssignment::AssignmentService
|
||||
scope.limit(limit)
|
||||
end
|
||||
|
||||
def age_exclusion_hours(policy)
|
||||
return policy.exclude_older_than_hours if policy
|
||||
|
||||
AssignmentPolicy::DEFAULT_EXCLUDE_OLDER_THAN_HOURS
|
||||
end
|
||||
|
||||
def apply_age_exclusions(scope, hours_threshold)
|
||||
return scope if hours_threshold.blank?
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
class ChangeCaptainAssistantDescriptionToText < ActiveRecord::Migration[7.0]
|
||||
def up
|
||||
change_column :captain_assistants, :description, :text
|
||||
end
|
||||
|
||||
def down
|
||||
change_column :captain_assistants, :description, :string
|
||||
end
|
||||
end
|
||||
+2
-2
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.1].define(version: 2026_07_06_215758) do
|
||||
ActiveRecord::Schema[7.1].define(version: 2026_07_10_000000) do
|
||||
# These extensions should be enabled to support this database
|
||||
enable_extension "pg_stat_statements"
|
||||
enable_extension "pg_trgm"
|
||||
@@ -343,7 +343,7 @@ ActiveRecord::Schema[7.1].define(version: 2026_07_06_215758) do
|
||||
create_table "captain_assistants", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
t.bigint "account_id", null: false
|
||||
t.string "description"
|
||||
t.text "description"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.jsonb "config", default: {}, null: false
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# config :jsonb not null
|
||||
# description :string
|
||||
# description :text
|
||||
# guardrails :jsonb
|
||||
# name :string not null
|
||||
# response_guidelines :jsonb
|
||||
@@ -17,6 +17,8 @@
|
||||
# index_captain_assistants_on_account_id (account_id)
|
||||
#
|
||||
class Captain::Assistant < ApplicationRecord
|
||||
DESCRIPTION_LENGTH_LIMIT = 500
|
||||
|
||||
include Avatarable
|
||||
include Concerns::CaptainToolsHelpers
|
||||
include Concerns::Agentable
|
||||
@@ -39,7 +41,7 @@ class Captain::Assistant < ApplicationRecord
|
||||
store_accessor :config, :temperature, :feature_faq, :feature_memory, :feature_contact_attributes, :product_name
|
||||
|
||||
validates :name, presence: true
|
||||
validates :description, presence: true
|
||||
validates :description, presence: true, length: { maximum: DESCRIPTION_LENGTH_LIMIT }
|
||||
validates :account_id, presence: true
|
||||
|
||||
scope :ordered, -> { order(created_at: :desc) }
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
# index_captain_scenarios_on_enabled (enabled)
|
||||
#
|
||||
class Captain::Scenario < ApplicationRecord
|
||||
DESCRIPTION_LENGTH_LIMIT = 500
|
||||
|
||||
include Concerns::CaptainToolsHelpers
|
||||
include Concerns::Agentable
|
||||
|
||||
@@ -43,7 +45,7 @@ class Captain::Scenario < ApplicationRecord
|
||||
belongs_to :account
|
||||
|
||||
validates :title, presence: true
|
||||
validates :description, presence: true
|
||||
validates :description, presence: true, length: { maximum: DESCRIPTION_LENGTH_LIMIT }
|
||||
validates :instruction, presence: true
|
||||
validates :assistant_id, presence: true
|
||||
validates :account_id, presence: true
|
||||
|
||||
@@ -97,7 +97,7 @@ class Captain::Onboarding::WebsiteAnalyzerService < Llm::BaseAiService
|
||||
Guidelines:
|
||||
- business_name: Extract the actual company/brand name from the content
|
||||
- suggested_assistant_name: Create a friendly, professional name that customers would want to interact with
|
||||
- description: Provide context about the business and what the assistant can help with. Keep it general and adaptable rather than overly specific. For example: "You specialize in helping customers with their orders and product questions" or "You assist customers with their account needs and general inquiries"
|
||||
- description: Provide context about the business and what the assistant can help with in no more than 500 characters. Keep it general and adaptable rather than overly specific. For example: "You specialize in helping customers with their orders and product questions" or "You assist customers with their account needs and general inquiries"
|
||||
|
||||
Website content:
|
||||
#{@website_content}
|
||||
|
||||
@@ -60,7 +60,7 @@ module Enterprise::AutoAssignment::AssignmentService
|
||||
scope = inbox.conversations.unassigned.open
|
||||
|
||||
# First apply the assignment policy's age exclusion (defaults to 7 days)
|
||||
scope = apply_age_exclusions(scope, policy&.exclude_older_than_hours)
|
||||
scope = apply_age_exclusions(scope, age_exclusion_hours(policy))
|
||||
|
||||
# Then apply the capacity policy's exclusion rules (labels and age)
|
||||
scope = apply_exclusion_rules(scope)
|
||||
|
||||
Reference in New Issue
Block a user