-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Allow users to edit chat thread title #6
base: main
Are you sure you want to change the base?
Conversation
giuliohome
commented
Sep 22, 2023
•
edited
Loading
edited
useEffect(() => { | ||
const fetchData = async () => { | ||
console.log("fetching items") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
useEffect(() => { | ||
const fetchData = async () => { | ||
console.log("fetching items") | ||
const data = await FindAllChatThreadForCurrentUser(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this function handle fetching errors?
|
||
const doRefresh = () => { | ||
console.log("should refresh") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
|
||
const doRefresh = () => { | ||
console.log("should refresh") | ||
setRefresh(!refresh); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setRefresh(!refresh); | |
setRefresh(prev => !prev) |
|
||
# secrets | ||
start.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
@@ -21,6 +22,11 @@ export const MenuItems: FC<Prop> = (props) => { | |||
router.replace("/chat"); | |||
}; | |||
|
|||
const renameTitle = async (threadID: string, title: string) => { | |||
await userUpdateThreadTitle(threadID, title); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if this fails?
@@ -45,6 +51,20 @@ export const MenuItems: FC<Prop> = (props) => { | |||
<span className="flex gap-2 items-center overflow-hidden flex-1"> | |||
<span className="overflow-ellipsis truncate"> {thread.name}</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're truncating thread names. If thread names are longer than 30 characters you will want to render ellipses here perhaps (...)
const chatThread = threads[0] | ||
await UpsertChatThread({ | ||
...chatThread, | ||
name: userTitle.substring(0, 30), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of truncating here, prevent user from putting down more than 30 characters. That way we don't store truncated names in database. i.e. Review legal documents around tax fil
@Ali-Parandeh
|