Merged
Conversation
YyumeiZhang
reviewed
Jan 4, 2026
| ### ClientAI | ||
|
|
||
| | 属性 | 说明 | 类型 | 默认值 | | ||
| |------|------|------|--------| |
| const contentCls = cls(`${prefixCls}-content`); | ||
| const dialogueWrapperCls = cls(`${prefixCls}-dialogue-wrapper`); | ||
| const inputWrapperCls = cls(`${prefixCls}-input-wrapper`); | ||
| const inputEditCls = cls(`${prefixCls}-input-edit`); |
| showInfo={true} | ||
| size="large" | ||
| stroke="var(--semi-color-primary)" | ||
| aria-label={locale.loadingProgress} |
Collaborator
There was a problem hiding this comment.
需要支持主题定制吗?如果要的话,通过 stroke 参数,而是 scss 中写?
| // 调用我们的进度回调 | ||
| progressCallback(report); | ||
| // 调用用户自定义的回调(如果存在) | ||
| if (originalCallback) { |
Collaborator
There was a problem hiding this comment.
629~631行和(614~617行)的逻辑重复了?progressCallback 中已经做了用户自定义回调的调用?
| // 创建进度回调函数 | ||
| const progressCallback: InitProgressCallback = (report: InitProgressReport) => { | ||
| // 更新进度状态 | ||
| this._adapter.setInitProgress?.(report); |
Collaborator
There was a problem hiding this comment.
不需要用 ?., 因为adapter中的这个函数是一定存在的?
| // 添加用户消息到 WebLLM 格式(历史记录中保存原始消息,不带 /no_think) | ||
| const userMessage: WebLLMMessage = { role: 'user', content: inputText }; | ||
| const updatedMessages = [...messages, userMessage]; | ||
| const updatedChats = [...chats, userChatMessage]; |
Collaborator
There was a problem hiding this comment.
updatedChats 用的是 userChatMessage, 而不是 toolResponseChat?
| /** | ||
| * 将 Message[] 转换为 WebLLMMessage[] | ||
| */ | ||
| private convertMessagesToWebLLM = (messages: Message[]): WebLLMMessage[] => { |
| /** | ||
| * 从 Message 中提取文本内容 | ||
| */ | ||
| private extractTextFromMessage = (message: Message): string => { |
Collaborator
There was a problem hiding this comment.
这个函数也只在没有用过的convertMessagesToWebLLM 中被用到过?
|
|
||
| let engine: WebWorkerMLCEngine; | ||
|
|
||
| if (useWorker && worker?.url) { |
Collaborator
There was a problem hiding this comment.
useWorker 中已经做了worker?.url的判断,这里没必要再加?
| /** | ||
| * 处理编辑消息发送 | ||
| */ | ||
| handleEditMessageSend = (messageContent: MessageContent) => { |
Collaborator
There was a problem hiding this comment.
此函数逻辑是,编辑完成之后将修改被编辑的内容。就结束了?
通常来说,编辑完成,需要处理编辑的消息的回复(比如删掉原来的回复,重新发送给 AI,继续拿到回复)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

中文模板 / Chinese Template
What kind of change does this PR introduce? (check at least one)
PR description
Fixes #
Changelog
🇨🇳 Chinese
🇺🇸 English
Checklist
Other
Additional information