Skip to content

Commit

Permalink
Rework header a bit + remove assumption of all personas having a prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
Weves committed Dec 15, 2023
1 parent 16c8969 commit a099f8e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
1 change: 0 additions & 1 deletion backend/alembic/versions/b156fa702355_chat_reworked.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def upgrade() -> None:
# This is irrecoverable, whatever
op.execute("DELETE FROM chat_feedback")
op.execute("DELETE FROM document_retrieval_feedback")
op.execute("DELETE FROM persona")

op.create_table(
"search_doc",
Expand Down
6 changes: 3 additions & 3 deletions web/src/app/admin/personas/PersonaEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ export function PersonaEditor({
const existingPrompt = existingPersona?.prompts[0] ?? null;

useEffect(() => {
if (isUpdate) {
if (isUpdate && existingPrompt) {
triggerFinalPromptUpdate(
existingPrompt!.system_prompt,
existingPrompt!.task_prompt,
existingPrompt.system_prompt,
existingPrompt.task_prompt,
existingPersona.num_chunks === 0
);
}
Expand Down
1 change: 0 additions & 1 deletion web/src/app/chat/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import { buildFilters } from "@/lib/search/utils";
import { QA, SearchTypeSelector } from "./modifiers/SearchTypeSelector";
import { SelectedDocuments } from "./modifiers/SelectedDocuments";
import { usePopup } from "@/components/admin/connectors/Popup";
import { useSWRConfig } from "swr";

const MAX_INPUT_HEIGHT = 200;

Expand Down
15 changes: 8 additions & 7 deletions web/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@

import { User } from "@/lib/types";
import { logout } from "@/lib/user";
import { UserCircle } from "@phosphor-icons/react";
import Image from "next/image";
import Link from "next/link";
import { useRouter } from "next/navigation";
import React, { useEffect, useRef, useState } from "react";
import { CustomDropdown, DefaultDropdownElement } from "./Dropdown";
import { FiMessageSquare, FiSearch } from "react-icons/fi";
import { usePathname } from "next/navigation";

interface HeaderProps {
user: User | null;
}

export const Header: React.FC<HeaderProps> = ({ user }) => {
const router = useRouter();
const pathname = usePathname();
const [dropdownOpen, setDropdownOpen] = useState(false);
const dropdownRef = useRef<HTMLDivElement>(null);

Expand Down Expand Up @@ -68,21 +69,21 @@ export const Header: React.FC<HeaderProps> = ({ user }) => {

<Link
href="/search"
className="ml-8 h-full flex flex-col hover:bg-hover"
className={"ml-6 h-full flex flex-col hover:bg-hover"}
>
<div className="w-28 flex my-auto">
<div className="mx-auto flex text-strong px-2">
<div className="w-24 flex my-auto">
<div className={"mx-auto flex text-strong px-2"}>
<FiSearch className="my-auto mr-1" />
<h1 className="flex text-base font-medium my-auto">Search</h1>
<h1 className="flex text-sm font-bold my-auto">Search</h1>
</div>
</div>
</Link>

<Link href="/chat" className="h-full flex flex-col hover:bg-hover">
<div className="w-28 flex my-auto">
<div className="w-24 flex my-auto">
<div className="mx-auto flex text-strong px-2">
<FiMessageSquare className="my-auto mr-1" />
<h1 className="flex text-base font-medium my-auto">Chat</h1>
<h1 className="flex text-sm font-bold my-auto">Chat</h1>
</div>
</div>
</Link>
Expand Down

1 comment on commit a099f8e

@vercel
Copy link

@vercel vercel bot commented on a099f8e Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.