Merge pull request 'bugfix/ai-agent' (#43) from bugfix/ai-agent into release/v9.2.0

Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/desktop-sdk/pulls/43
This commit is contained in:
Oleg Korshul
2025-11-17 09:02:32 +00:00
5 changed files with 40 additions and 25 deletions

View File

@ -170,6 +170,7 @@ const ChatListItem = ({
}}
autoFocus
className="w-full"
maxLength={128}
/>
) : (
<>

View File

@ -1,16 +1,19 @@
import type { CodeHeaderProps } from "@assistant-ui/react-markdown";
import { ReactSVG } from "react-svg";
import { useTranslation } from "react-i18next";
import BtnCopyIconUrl from "@/assets/btn-copy.svg?url";
import BtnCheckIconUrl from "@/assets/checked.svg?url";
import { TooltipIconButton } from "../../tooltip-icon-button";
import { IconButton } from "../../icon-button";
import useCopyToClipboard from "../hooks/useCopyToClipboard";
const CodeHeader = ({ language, code }: CodeHeaderProps) => {
const { isCopied, copyToClipboard } = useCopyToClipboard();
const { t } = useTranslation();
const onCopy = () => {
if (!code || isCopied) return;
copyToClipboard(code);
@ -19,11 +22,20 @@ const CodeHeader = ({ language, code }: CodeHeaderProps) => {
return (
<div className="mt-4 flex items-center justify-between gap-4 rounded-t-lg bg-[var(--chat-message-code-block-background-color)] text-[var(--chat-message-code-block-header-color)] text-[14px] leading-[20px] px-[12px] pt-[12px] pb-[8px]">
<span className="lowercase">{language}</span>
<TooltipIconButton tooltip="Copy" onClick={onCopy} visible={!isCopied}>
{!isCopied && (
<ReactSVG className="cursor-pointer" src={BtnCopyIconUrl} />
<TooltipIconButton
tooltip={t("CopyToClipboard")}
onClick={onCopy}
visible={!isCopied}
>
{!isCopied && <IconButton iconName={BtnCopyIconUrl} size={16} />}
{isCopied && (
<IconButton
iconName={BtnCheckIconUrl}
size={16}
isStroke
disableHover
/>
)}
{isCopied && <ReactSVG src={BtnCheckIconUrl} />}
</TooltipIconButton>
</div>
);

View File

@ -63,7 +63,7 @@ const AssistantActionBar = () => {
className="col-start-3 row-start-2 ml-3 mt-3 flex gap-[8px]"
>
<ActionBarPrimitive.Copy asChild>
<TooltipIconButton tooltip="Copy">
<TooltipIconButton tooltip={t("CopyToClipboard")}>
<MessagePrimitive.If copied>
<IconButton
iconName={BtnCheckIconUrl}

View File

@ -109,7 +109,9 @@ class Provider {
createChatName = async (message: string) => {
if (!this.currentProvider) return "";
return this.currentProvider.createChatName(message);
const title = await this.currentProvider.createChatName(message);
return title.slice(0, 128);
};
sendMessage = (