Skip to content
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

Include context in user message #1006

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zeroliu
Copy link
Collaborator

@zeroliu zeroliu commented Jan 5, 2025

Render context with the user message.

Screenshot 2025-01-05 at 12 50 54 AM Screenshot 2025-01-05 at 12 51 45 AM

@@ -86,52 +90,19 @@ const ChatInput = forwardRef<{ focus: () => void }, ChatInputProps>(
},
}));

const debounce = <T extends (...args: any[]) => any>(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the debounce function and the effect that listens to input message change do the same thing. It caused duplicated context values. Tested that everything still works after removing all the debounce calls

@zeroliu zeroliu force-pushed the zero/include-text-context branch from 3532a65 to adbdfb8 Compare January 5, 2025 08:42
@zeroliu zeroliu force-pushed the zero/include-text-context branch from adbdfb8 to 77209ba Compare January 5, 2025 08:52
@zeroliu
Copy link
Collaborator Author

zeroliu commented Jan 5, 2025

Note that editing doesn't work as intended yet. It will make people think the edited message is sent with context but in reality it doesn't. Not sure if we want to push this change before we fix the issue.

@zeroliu zeroliu marked this pull request as ready for review January 5, 2025 08:54
@zeroliu zeroliu requested a review from logancyang January 5, 2025 08:54
@logancyang
Copy link
Owner

Note that editing doesn't work as intended yet. It will make people think the edited message is sent with context but in reality it doesn't. Not sure if we want to push this change before we fix the issue.

Right, let me look into fixing the edit and this one can rebase on that.

@zeroliu
Copy link
Collaborator Author

zeroliu commented Jan 6, 2025

Note that editing doesn't work as intended yet. It will make people think the edited message is sent with context but in reality it doesn't. Not sure if we want to push this change before we fix the issue.

Right, let me look into fixing the edit and this one can rebase on that.

I can look into this, too. It will be related to the edit UI work that will follow up on this one.

@logancyang
Copy link
Owner

Note that editing doesn't work as intended yet. It will make people think the edited message is sent with context but in reality it doesn't. Not sure if we want to push this change before we fix the issue.

Right, let me look into fixing the edit and this one can rebase on that.

I can look into this, too. It will be related to the edit UI work that will follow up on this one.

Sounds good. Right now we have "hidden user message" that has added context in "handleSendMessage" in Chat.tsx. We also have some ad-hoc processing and appending to the user message using contextProcessor. We also have tool calls results appending. So it's a bit of a mess 😅 sorry about that.

I think we need a clear design of a new ChatMessage object with context in it (currently in sharedState.ts), and a new consolidated way for making changes to its context, be it from an edit, or a send time processing. It may touch a bunch of places like Chat.tsx, ChainRunners, and wherever that has logic "enhancing" the chat message.

@logancyang
Copy link
Owner

One thing to be careful about is that any context should be fresh in case the context notes have changed. It is working correctly at the moment for chat input, but we should avoid saving a previous context in an old ChatMessage object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants