forked from danswer-ai/danswer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
578 additions
and
252 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
backend/alembic/versions/0a2b51deb0b8_add_starter_prompts.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"""Add starter prompts | ||
Revision ID: 0a2b51deb0b8 | ||
Revises: 5f4b8568a221 | ||
Create Date: 2024-03-02 23:23:49.960309 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "0a2b51deb0b8" | ||
down_revision = "5f4b8568a221" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.add_column( | ||
"persona", | ||
sa.Column( | ||
"starter_messages", | ||
postgresql.JSONB(astext_type=sa.Text()), | ||
nullable=True, | ||
), | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_column("persona", "starter_messages") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { useState } from "react"; | ||
import { FiChevronDown, FiChevronRight } from "react-icons/fi"; | ||
|
||
export function SectionHeader({ | ||
children, | ||
includeMargin = true, | ||
}: { | ||
children: string | JSX.Element; | ||
includeMargin?: boolean; | ||
}) { | ||
return ( | ||
<div | ||
className={"font-bold text-xl my-auto" + (includeMargin ? " mb-4" : "")} | ||
> | ||
{children} | ||
</div> | ||
); | ||
} | ||
|
||
export function HidableSection({ | ||
children, | ||
sectionTitle, | ||
defaultHidden = false, | ||
}: { | ||
children: string | JSX.Element; | ||
sectionTitle: string | JSX.Element; | ||
defaultHidden?: boolean; | ||
}) { | ||
const [isHidden, setIsHidden] = useState(defaultHidden); | ||
|
||
return ( | ||
<div> | ||
<div | ||
className="flex hover:bg-hover-light rounded cursor-pointer p-2" | ||
onClick={() => setIsHidden(!isHidden)} | ||
> | ||
<SectionHeader includeMargin={false}>{sectionTitle}</SectionHeader> | ||
<div className="my-auto ml-auto p-1"> | ||
{isHidden ? ( | ||
<FiChevronRight size={24} /> | ||
) : ( | ||
<FiChevronDown size={24} /> | ||
)} | ||
</div> | ||
</div> | ||
|
||
{!isHidden && <div className="mx-2 mt-2">{children}</div>} | ||
</div> | ||
); | ||
} |
Oops, something went wrong.