We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
当前ProChat不支持展示在HumanMessage和AIMessage中间的一些函数调用过程,希望有类似ChatGPT那种展示效果
目前对于LangChain的agent框架来说,流式模式下会返回一些函数调用的中间步骤,可以将这些中间步骤关联到当前正在输出的AIMessage,然后根据参数里传入的函数渲染方法来渲染
贴一版我自己做的丐版的
The text was updated successfully, but these errors were encountered:
现在可以用 messageItemExtraRender 在 AI AIMessage 渲染一些自定义的 reactnode(这块是脱离编辑流的),可以先用这个支持一下,我们也在调研 Function Call 的最佳实践,你有什么好的建议么?
Sorry, something went wrong.
messageItemExtraRender只能渲染在下面,所以展示上不太行;个人觉得可以在ChatMessage加个中间消息字段,然后在ChatItem提供一块区域来渲染这些消息,也提供一下自定义渲染方法就好。函数调用的过程我不觉得需要支持编辑,只要能够展示就可以了,但是得考虑同时调用多个(并行)和多次调用(顺序)的情况;
chatItemRenderConfig={{ render: ( props: ChatItemProps, domsMap: { avatar: ReactNode; title: ReactNode; messageContent: ReactNode; actions: ReactNode; itemDom: ReactNode; }, defaultDom: ReactNode, ) => { const message = props.originData as ChatMessage; if (message.role === 'assistant' && message.extra?.toolHistory) { //展示函数调用过程 return ( <> <ChatItem showTitle={props.showTitle} actions={domsMap.actions} avatar={assistantMeta} renderMessage={(content) => { return ( <> {renderToolHistory(message?.extra?.toolHistory)} {content} </> ); }} messageExtra={props.messageExtra} message={props.message} /> </> ); } return defaultDom; }, }}
我目前就这样处理,反正能满足我这边的需求。。
No branches or pull requests
🥰 需求描述
当前ProChat不支持展示在HumanMessage和AIMessage中间的一些函数调用过程,希望有类似ChatGPT那种展示效果
🧐 解决方案
目前对于LangChain的agent框架来说,流式模式下会返回一些函数调用的中间步骤,可以将这些中间步骤关联到当前正在输出的AIMessage,然后根据参数里传入的函数渲染方法来渲染
🚑 其他信息
贴一版我自己做的丐版的
![image](https://private-user-images.githubusercontent.com/27731043/310448324-60177509-7715-4184-9d1d-451db89d28aa.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5MDQ3ODksIm5iZiI6MTczOTkwNDQ4OSwicGF0aCI6Ii8yNzczMTA0My8zMTA0NDgzMjQtNjAxNzc1MDktNzcxNS00MTg0LTlkMWQtNDUxZGI4OWQyOGFhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE4VDE4NDgwOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY1MjIzN2NiMGJiMGJiNmFkZjQxNmQxMDA3ZTEwMWYxNTIxYWZkMjRiYzNlZWI2ZmY4ZjgxYzA1N2QyZjljODYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.v3tlWCIWKAQiJ8kiIXNxySSz1_w_s5EnRsx9_JUgw50)
The text was updated successfully, but these errors were encountered: