Skip to content

Feat: Client AI#3101

Merged
SudoUserReal merged 24 commits intoreleasefrom
mcp
Dec 29, 2025
Merged

Feat: Client AI#3101
SudoUserReal merged 24 commits intoreleasefrom
mcp

Conversation

@SudoUserReal
Copy link
Collaborator

中文模板 / Chinese Template

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Test Case
  • TypeScript definition update
  • Document improve
  • CI/CD improve
  • Branch sync
  • Other, please describe:

PR description

Fixes #

Changelog

🇨🇳 Chinese

  • Feat: 新增 clientAI 组件

🇺🇸 English

  • Feat: New Component ClientAI

Checklist

  • Test or no need
  • Document or no need
  • Changelog or no need

Other

  • Skip Changelog

Additional information

@SudoUserReal SudoUserReal changed the title Mcp Feat: Client AI Dec 29, 2025
@SudoUserReal SudoUserReal merged commit faca125 into release Dec 29, 2025
7 of 12 checks passed
@SudoUserReal SudoUserReal deleted the mcp branch December 29, 2025 09:34
### ClientAI

| 属性 | 说明 | 类型 | 默认值 |
|------|------|------|--------|
Copy link
Collaborator

Choose a reason for hiding this comment

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

image 类型不需要用代码格式?

const contentCls = cls(`${prefixCls}-content`);
const dialogueWrapperCls = cls(`${prefixCls}-dialogue-wrapper`);
const inputWrapperCls = cls(`${prefixCls}-input-wrapper`);
const inputEditCls = cls(`${prefixCls}-input-edit`);
Copy link
Collaborator

Choose a reason for hiding this comment

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

没用到,删掉?

showInfo={true}
size="large"
stroke="var(--semi-color-primary)"
aria-label={locale.loadingProgress}
Copy link
Collaborator

Choose a reason for hiding this comment

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

需要支持主题定制吗?如果要的话,通过 stroke 参数,而是 scss 中写?

// 调用我们的进度回调
progressCallback(report);
// 调用用户自定义的回调(如果存在)
if (originalCallback) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

629~631行和(614~617行)的逻辑重复了?progressCallback 中已经做了用户自定义回调的调用?

// 创建进度回调函数
const progressCallback: InitProgressCallback = (report: InitProgressReport) => {
// 更新进度状态
this._adapter.setInitProgress?.(report);
Copy link
Collaborator

Choose a reason for hiding this comment

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

不需要用 ?., 因为adapter中的这个函数是一定存在的?

// 添加用户消息到 WebLLM 格式(历史记录中保存原始消息,不带 /no_think)
const userMessage: WebLLMMessage = { role: 'user', content: inputText };
const updatedMessages = [...messages, userMessage];
const updatedChats = [...chats, userChatMessage];
Copy link
Collaborator

Choose a reason for hiding this comment

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

updatedChats 用的是 userChatMessage, 而不是 toolResponseChat?

/**
* 将 Message[] 转换为 WebLLMMessage[]
*/
private convertMessagesToWebLLM = (messages: Message[]): WebLLMMessage[] => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个函数没有在任何地方被调用?

/**
* 从 Message 中提取文本内容
*/
private extractTextFromMessage = (message: Message): string => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个函数也只在没有用过的convertMessagesToWebLLM 中被用到过?


let engine: WebWorkerMLCEngine;

if (useWorker && worker?.url) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

useWorker 中已经做了worker?.url的判断,这里没必要再加?

/**
* 处理编辑消息发送
*/
handleEditMessageSend = (messageContent: MessageContent) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

此函数逻辑是,编辑完成之后将修改被编辑的内容。就结束了?
通常来说,编辑完成,需要处理编辑的消息的回复(比如删掉原来的回复,重新发送给 AI,继续拿到回复)

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