Compare commits

..

2 Commits

Author SHA1 Message Date
pablodanswer
d1b9f11750 k 2025-02-17 19:17:48 -08:00
pablodanswer
9b067d8179 update error 2025-02-17 19:17:48 -08:00
11 changed files with 4 additions and 48 deletions

View File

@@ -94,6 +94,7 @@ from onyx.db.models import User
from onyx.db.users import get_user_by_email
from onyx.redis.redis_pool import get_async_redis_connection
from onyx.redis.redis_pool import get_redis_client
from onyx.server.utils import BasicAuthenticationError
from onyx.utils.logger import setup_logger
from onyx.utils.telemetry import create_milestone_and_report
from onyx.utils.telemetry import optional_telemetry
@@ -107,11 +108,6 @@ from shared_configs.contextvars import CURRENT_TENANT_ID_CONTEXTVAR
logger = setup_logger()
class BasicAuthenticationError(HTTPException):
def __init__(self, detail: str):
super().__init__(status_code=status.HTTP_403_FORBIDDEN, detail=detail)
def is_user_admin(user: User | None) -> bool:
if AUTH_TYPE == AuthType.DISABLED:
return True

View File

@@ -1742,7 +1742,6 @@ class ChannelConfig(TypedDict):
# If empty list, follow up with no tags
follow_up_tags: NotRequired[list[str]]
show_continue_in_web_ui: NotRequired[bool] # defaults to False
disabled: NotRequired[bool] # defaults to False
class SlackChannelConfig(Base):
@@ -1766,7 +1765,6 @@ class SlackChannelConfig(Base):
is_default: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
persona: Mapped[Persona | None] = relationship("Persona")
slack_bot: Mapped["SlackBot"] = relationship(
"SlackBot",
back_populates="slack_channel_configs",

View File

@@ -151,7 +151,6 @@ def update_slack_channel_config(
channel_config: ChannelConfig,
standard_answer_category_ids: list[int],
enable_auto_filters: bool,
disabled: bool,
) -> SlackChannelConfig:
slack_channel_config = db_session.scalar(
select(SlackChannelConfig).where(

View File

@@ -180,13 +180,6 @@ def handle_message(
)
return False
if slack_channel_config.channel_config.get("disabled") and not bypass_filters:
logger.info(
"Skipping message since the channel is configured such that "
"OnyxBot is disabled"
)
return False
# List of user id to send message to, if None, send to everyone in channel
send_to: list[str] | None = None
missing_users: list[str] | None = None

View File

@@ -806,7 +806,6 @@ def process_message(
and slack_channel_config.channel_config.get("follow_up_tags")
is not None
)
feedback_reminder_id = schedule_feedback_reminder(
details=details, client=client.web_client, include_followup=follow_up
)

View File

@@ -187,7 +187,6 @@ class SlackChannelConfigCreationRequest(BaseModel):
response_type: SlackBotResponseType
# XXX this is going away soon
standard_answer_categories: list[int] = Field(default_factory=list)
disabled: bool = False
@field_validator("answer_filters", mode="before")
@classmethod

View File

@@ -93,8 +93,6 @@ def _form_channel_config(
"respond_to_bots"
] = slack_channel_config_creation_request.respond_to_bots
channel_config["disabled"] = slack_channel_config_creation_request.disabled
return channel_config
@@ -196,7 +194,6 @@ def patch_slack_channel_config(
channel_config=channel_config,
standard_answer_category_ids=slack_channel_config_creation_request.standard_answer_categories,
enable_auto_filters=slack_channel_config_creation_request.enable_auto_filters,
disabled=slack_channel_config_creation_request.disabled,
)
return SlackChannelConfig.from_model(slack_channel_config_model)

View File

@@ -124,8 +124,6 @@ export const SlackChannelConfigCreationForm = ({
: existingSlackChannelConfig?.persona
? "document_sets"
: "all_public",
disabled:
existingSlackChannelConfig?.channel_config?.disabled ?? false,
}}
validationSchema={Yup.object().shape({
slack_bot_id: Yup.number().required(),
@@ -172,7 +170,6 @@ export const SlackChannelConfigCreationForm = ({
"non_search_assistant",
])
.required(),
disabled: Yup.boolean().optional().default(false),
})}
onSubmit={async (values, formikHelpers) => {
formikHelpers.setSubmitting(true);
@@ -198,7 +195,6 @@ export const SlackChannelConfigCreationForm = ({
(category: any) => category.id
),
response_type: values.response_type as SlackBotResponseType,
disabled: values.disabled ?? false,
};
if (!cleanedValues.still_need_help_enabled) {

View File

@@ -197,27 +197,9 @@ export function SlackChannelConfigFormFields({
<>
<div className="w-full">
{isDefault && (
<>
<Badge variant="agent" className="bg-blue-100 text-blue-800">
Default Configuration
</Badge>
<p className="mt-2 text-sm text-gray-600">
This default configuration will apply across all Slack channels
the bot is added to in the Slack workspace, as well as direct
messages (DMs), unless disabled.
</p>
<div className="mt-4 p-4 bg-gray-100 rounded-md border border-gray-300">
<CheckFormField
name="disabled"
label="Disable Default Configuration"
/>
<p className="mt-2 text-sm text-gray-600 italic">
Warning: Disabling the default configuration means the bot
won&apos;t respond in Slack channels or DMs unless explicitly
configured for them.
</p>
</div>
</>
<Badge variant="agent" className="bg-blue-100 text-blue-800">
Default Configuration
</Badge>
)}
{!isDefault && (
<>

View File

@@ -21,7 +21,6 @@ interface SlackChannelConfigCreationRequest {
usePersona: boolean;
response_type: SlackBotResponseType;
standard_answer_categories: number[];
disabled: boolean;
}
const buildFiltersFromCreationRequest = (
@@ -55,7 +54,6 @@ const buildRequestBodyFromCreationRequest = (
: { document_sets: creationRequest.document_sets }),
response_type: creationRequest.response_type,
standard_answer_categories: creationRequest.standard_answer_categories,
disabled: creationRequest.disabled,
});
};

View File

@@ -252,7 +252,6 @@ export interface ChannelConfig {
respond_member_group_list?: string[];
answer_filters?: AnswerFilterOption[];
follow_up_tags?: string[];
disabled?: boolean;
}
export type SlackBotResponseType = "quotes" | "citations";