mirror of
https://github.com/ONLYOFFICE/desktop-sdk.git
synced 2026-02-10 18:15:05 +08:00
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:
File diff suppressed because one or more lines are too long
@ -170,6 +170,7 @@ const ChatListItem = ({
|
||||
}}
|
||||
autoFocus
|
||||
className="w-full"
|
||||
maxLength={128}
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
|
||||
@ -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>
|
||||
);
|
||||
|
||||
@ -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}
|
||||
|
||||
@ -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 = (
|
||||
|
||||
Reference in New Issue
Block a user