Skip to content

Commit

Permalink
made description optional for document sets (#3407)
Browse files Browse the repository at this point in the history
* made description optional for document sets

* update document set optional

* update alembic migration head

---------

Co-authored-by: pablodanswer <[email protected]>
  • Loading branch information
hagen-danswer and pablonyx authored Dec 13, 2024
1 parent c69b7fc commit 54dcbfa
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""make document set description optional
Revision ID: 94dc3d0236f8
Revises: bf7a81109301
Create Date: 2024-12-11 11:26:10.616722
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "94dc3d0236f8"
down_revision = "bf7a81109301"
branch_labels = None
depends_on = None


def upgrade() -> None:
# Make document_set.description column nullable
op.alter_column(
"document_set", "description", existing_type=sa.String(), nullable=True
)


def downgrade() -> None:
# Revert document_set.description column to non-nullable
op.alter_column(
"document_set", "description", existing_type=sa.String(), nullable=False
)
2 changes: 1 addition & 1 deletion backend/danswer/db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,7 @@ class DocumentSet(Base):

id: Mapped[int] = mapped_column(Integer, primary_key=True)
name: Mapped[str] = mapped_column(String, unique=True)
description: Mapped[str] = mapped_column(String)
description: Mapped[str | None] = mapped_column(String)
user_id: Mapped[UUID | None] = mapped_column(
ForeignKey("user.id", ondelete="CASCADE"), nullable=True
)
Expand Down
2 changes: 1 addition & 1 deletion backend/danswer/server/features/document_set/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class CheckDocSetPublicResponse(BaseModel):
class DocumentSet(BaseModel):
id: int
name: str
description: str
description: str | None
cc_pair_descriptors: list[ConnectorCredentialPairDescriptor]
is_up_to_date: bool
is_public: bool
Expand Down
5 changes: 2 additions & 3 deletions web/src/app/admin/documents/sets/DocumentSetCreationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ export const DocumentSetCreationForm = ({
}}
validationSchema={Yup.object().shape({
name: Yup.string().required("Please enter a name for the set"),
description: Yup.string().required(
"Please enter a description for the set"
),
description: Yup.string().optional(),
cc_pair_ids: Yup.array()
.of(Yup.number().required())
.required("Please select at least one connector"),
Expand Down Expand Up @@ -125,6 +123,7 @@ export const DocumentSetCreationForm = ({
label="Description:"
placeholder="Describe what the document set represents"
autoCompleteDisabled={true}
optional={true}
/>

{isPaidEnterpriseFeaturesEnabled && (
Expand Down

0 comments on commit 54dcbfa

Please sign in to comment.