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

chore(weave): Add call chat to playground page #2993

Merged
merged 13 commits into from
Nov 18, 2024
Merged

Conversation

jwlee64
Copy link
Contributor

@jwlee64 jwlee64 commented Nov 14, 2024

Description

i know its ugly but this

  • adds the chatview to the playground
  • wires up the add message to the chat input
  • project/weave/playground now has the default chat

more wiring up is needed, and a lot of usability is in the chat view styling revamp, eg auto scroll to last message when the message is added

Screen.Recording.2024-11-15.at.7.19.02.AM.mov

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

circle-job-mirror bot commented Nov 14, 2024

@jwlee64 jwlee64 changed the base branch from josiah/playground-context to master November 15, 2024 14:59
editMessage: (messageIndex: number, newMessage: any) => void;
deleteChoice: (choiceIndex: number) => void;
editChoice: (choiceIndex: number, newChoice: any) => void;
addMessage: (newMessage: any) => void;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel like add -> edit -> delete is a more natural order to list these. Can these any be made more restrictive?

editChoice: (choiceIndex, newChoice) =>
editChoice(idx, choiceIndex, newChoice),
retry: (messageIndex: number, isChoice?: boolean) =>
console.log('retry', messageIndex, isChoice),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm assuming console.log are left in intentionally while under construction

};

export const useChatFunctions = (
setPlaygroundStateField: (
Copy link
Collaborator

Choose a reason for hiding this comment

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

I found this a little hard to read, maybe pull out the type of the setPlaygroundStateField as an explicit type definition above?

) => {
setPlaygroundStateField(callIndex, 'traceCall', prevTraceCall => {
const newTraceCall = clearTraceCall(
JSON.parse(JSON.stringify(prevTraceCall))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you use _.deepClone? That would be more readable and is probably safer for various types of values

const output = newTraceCall?.output as TraceCallOutput;
if (output && Array.isArray(output.choices)) {
// Remove the choice
output.choices = output.choices.filter(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could this be e.g.
output.choices.splice(choiceIndex, 1)

@jwlee64 jwlee64 merged commit f664268 into master Nov 18, 2024
114 of 116 checks passed
@jwlee64 jwlee64 deleted the josiah/add-call-chat branch November 18, 2024 19:13
@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.

2 participants