mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-29 13:25:50 +02:00
cleaned up new slack bot creation
This commit is contained in:
41
backend/alembic/versions/6d562f86c78b_remove_default_bot.py
Normal file
41
backend/alembic/versions/6d562f86c78b_remove_default_bot.py
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
"""remove default bot
|
||||||
|
|
||||||
|
Revision ID: 6d562f86c78b
|
||||||
|
Revises: 177de57c21c9
|
||||||
|
Create Date: 2024-11-22 11:51:29.331336
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = "6d562f86c78b"
|
||||||
|
down_revision = "177de57c21c9"
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
op.execute(
|
||||||
|
sa.text(
|
||||||
|
"""
|
||||||
|
DELETE FROM slack_bot
|
||||||
|
WHERE name = 'Default Bot'
|
||||||
|
AND bot_token = ''
|
||||||
|
AND app_token = ''
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
op.execute(
|
||||||
|
sa.text(
|
||||||
|
"""
|
||||||
|
INSERT INTO slack_bot (name, enabled, bot_token, app_token)
|
||||||
|
SELECT 'Default Bot', true, '', ''
|
||||||
|
WHERE NOT EXISTS (SELECT 1 FROM slack_bot)
|
||||||
|
RETURNING id;
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
)
|
@@ -75,7 +75,7 @@ export const ExistingSlackBotForm = ({
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{popup}
|
{popup}
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between h-14">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<div className="my-auto">
|
<div className="my-auto">
|
||||||
<SourceIcon iconSize={36} sourceType={"slack"} />
|
<SourceIcon iconSize={36} sourceType={"slack"} />
|
||||||
@@ -108,6 +108,7 @@ export const ExistingSlackBotForm = ({
|
|||||||
onClick={() => setShowDeleteModal(true)}
|
onClick={() => setShowDeleteModal(true)}
|
||||||
icon={FiTrash}
|
icon={FiTrash}
|
||||||
tooltip="Click to delete"
|
tooltip="Click to delete"
|
||||||
|
className="border h-[42px]"
|
||||||
>
|
>
|
||||||
Delete
|
Delete
|
||||||
</Button>
|
</Button>
|
||||||
@@ -129,8 +130,8 @@ export const ExistingSlackBotForm = ({
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-4">
|
<div className="mt-2">
|
||||||
<div className="inline-block border rounded-lg border-gray-200 px-2 py-2">
|
<div className="inline-block border rounded-lg border-gray-200 p-2">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
label="Enabled"
|
label="Enabled"
|
||||||
checked={formValues.enabled}
|
checked={formValues.enabled}
|
||||||
|
@@ -95,7 +95,12 @@ export const SlackTokensForm = ({
|
|||||||
<div className="flex justify-end w-full mt-4">
|
<div className="flex justify-end w-full mt-4">
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={isSubmitting}
|
disabled={
|
||||||
|
isSubmitting ||
|
||||||
|
!values.bot_token ||
|
||||||
|
!values.app_token ||
|
||||||
|
!values.name
|
||||||
|
}
|
||||||
variant="submit"
|
variant="submit"
|
||||||
size="default"
|
size="default"
|
||||||
>
|
>
|
||||||
|
@@ -369,7 +369,7 @@ export const SlackChannelConfigCreationForm = ({
|
|||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
variant="submit"
|
variant="submit"
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting || !values.channel_name}
|
||||||
className="mx-auto w-64"
|
className="mx-auto w-64"
|
||||||
>
|
>
|
||||||
{isUpdate ? "Update!" : "Create!"}
|
{isUpdate ? "Update!" : "Create!"}
|
||||||
|
@@ -95,7 +95,7 @@ function SlackBotEditPage({
|
|||||||
text-sm
|
text-sm
|
||||||
w-80
|
w-80
|
||||||
"
|
"
|
||||||
href={`/admin/bots/new?slack_bot_id=${unwrappedParams["bot-id"]}`}
|
href={`/admin/bots/${unwrappedParams["bot-id"]}/channels/new`}
|
||||||
>
|
>
|
||||||
<div className="mx-auto flex">
|
<div className="mx-auto flex">
|
||||||
<FiPlusSquare className="my-auto mr-2" />
|
<FiPlusSquare className="my-auto mr-2" />
|
||||||
|
@@ -23,12 +23,12 @@ export function Checkbox({
|
|||||||
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<label className="flex text-sm">
|
<label className="flex text-sm cursor-pointer">
|
||||||
<input
|
<input
|
||||||
checked={checked}
|
checked={checked}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
className="mx-3 px-5 w-3.5 h-3.5 my-auto"
|
className="mr-2 w-3.5 h-3.5 my-auto"
|
||||||
/>
|
/>
|
||||||
<div>
|
<div>
|
||||||
<Label>{label}</Label>
|
<Label>{label}</Label>
|
||||||
|
@@ -81,13 +81,17 @@ export function EditableStringFieldDisplay({
|
|||||||
value={editableValue}
|
value={editableValue}
|
||||||
onChange={handleValueChange}
|
onChange={handleValueChange}
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
className={cn(textClassName, isEditing ? "block" : "hidden")}
|
className={cn(
|
||||||
|
textClassName,
|
||||||
|
"user-text",
|
||||||
|
isEditing ? "block" : "hidden"
|
||||||
|
)}
|
||||||
style={{ fontSize: `${scale}rem` }}
|
style={{ fontSize: `${scale}rem` }}
|
||||||
/>
|
/>
|
||||||
{!isEditing && (
|
{!isEditing && (
|
||||||
<span
|
<span
|
||||||
onClick={() => isEditable && setIsEditing(true)}
|
onClick={() => isEditable && setIsEditing(true)}
|
||||||
className={cn(textClassName, "cursor-pointer")}
|
className={cn(textClassName, "cursor-pointer user-text")}
|
||||||
style={{ fontSize: `${scale}rem` }}
|
style={{ fontSize: `${scale}rem` }}
|
||||||
>
|
>
|
||||||
{value}
|
{value}
|
||||||
|
Reference in New Issue
Block a user