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

style(weave): chatview styling #2977

Merged
merged 7 commits into from
Nov 18, 2024
Merged

style(weave): chatview styling #2977

merged 7 commits into from
Nov 18, 2024

Conversation

jwlee64
Copy link
Contributor

@jwlee64 jwlee64 commented Nov 13, 2024

Description

groups tool responses with messages
changes background colors
adds robot icon
removes horizontal rules

Testing

How was this PR tested?

@jwlee64 jwlee64 requested review from a team as code owners November 13, 2024 23:04
@jwlee64 jwlee64 changed the base branch from master to josiah/playground-context November 13, 2024 23:04
@circle-job-mirror
Copy link

circle-job-mirror bot commented Nov 13, 2024

@adamwdraper
Copy link
Member

adamwdraper commented Nov 14, 2024

Copy link
Collaborator

@tssweeney tssweeney left a comment

Choose a reason for hiding this comment

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

Probably good for Jamie to review

@@ -34,10 +34,17 @@ export type ToolCall = {
};
};

// Used to store the response of a tool call in the message history.
export type ToolCallWithResponse = ToolCall & {
response?: Message;
Copy link
Collaborator

Choose a reason for hiding this comment

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

If response is optional anyway, would it make sense to just add this into the ToolCall definition?


import {useDeepMemo} from '../../../../../../hookUtils';
import {ChoicesView} from './ChoicesView';
import {HorizontalRuleWithLabel} from './HorizontalRuleWithLabel';
Copy link
Collaborator

Choose a reason for hiding this comment

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

This class was the only place using HorizontalRuleWithLabel; I'd delete it rather than leaving it unused in the codebase.

const lastMessageRef = useRef<HTMLDivElement>(null);
const processedMessages = processToolCallMessages(messages);

useEffect(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wondering why we are doing a scrollIntoView in both ChatView and MessageList

Copy link
Contributor Author

@jwlee64 jwlee64 Nov 15, 2024

Choose a reason for hiding this comment

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

messagelist scrolls to the last message when theres no choice, or when we add a message in the playground chat view, chat view scrolls the last choice

))}
</div>
);
};

// Associates tool calls with their responses
const processToolCallMessages = (messages: Messages) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add return type annotation

message: Message;
isStructuredOutput?: boolean;
isChoice?: boolean;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This does not appear to be used

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i use this later for the message panel buttons

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

message: Message;
isStructuredOutput?: boolean;
isChoice?: boolean;
isNested?: boolean;
pendingToolResponseId?: string;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This also appears to be unused

Copy link
Contributor Author

Choose a reason for hiding this comment

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

isNested is use for margins on the toolCallResponses below

isChoice
pnedingToolResponseId
are used for the messagePanel buttons i can remove for this pr

if (!message.tool_calls) {
processedMessages.push({
...message,
original_index: message.original_index ?? i,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Under what condition would original_index be set?

Copy link
Contributor Author

@jwlee64 jwlee64 Nov 15, 2024

Choose a reason for hiding this comment

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

sometime the llm returns it on tool calls but we can just manually set, we wouldnt want the wrong one anyways

<div
className={classNames('relative overflow-visible rounded-lg', {
'border-t border-moon-250': isTool,
'bg-moon-50': isSystemPrompt,
Copy link
Collaborator

Choose a reason for hiding this comment

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

};

const OneToolCall = ({toolCall}: OneToolCallProps) => {
const [isCopying, setIsCopying] = useState<boolean>(false);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can omit <boolean>

@jwlee64 jwlee64 changed the base branch from josiah/playground-context to master November 15, 2024 21:56
@jwlee64 jwlee64 merged commit b2f0876 into master Nov 18, 2024
115 of 116 checks passed
@jwlee64 jwlee64 deleted the josiah/chatview-styling branch November 18, 2024 18:28
@github-actions github-actions bot locked and limited conversation to collaborators Nov 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants