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
|
autoFocus
|
||||||
className="w-full"
|
className="w-full"
|
||||||
|
maxLength={128}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@ -1,16 +1,19 @@
|
|||||||
import type { CodeHeaderProps } from "@assistant-ui/react-markdown";
|
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 BtnCopyIconUrl from "@/assets/btn-copy.svg?url";
|
||||||
import BtnCheckIconUrl from "@/assets/checked.svg?url";
|
import BtnCheckIconUrl from "@/assets/checked.svg?url";
|
||||||
|
|
||||||
import { TooltipIconButton } from "../../tooltip-icon-button";
|
import { TooltipIconButton } from "../../tooltip-icon-button";
|
||||||
|
import { IconButton } from "../../icon-button";
|
||||||
|
|
||||||
import useCopyToClipboard from "../hooks/useCopyToClipboard";
|
import useCopyToClipboard from "../hooks/useCopyToClipboard";
|
||||||
|
|
||||||
const CodeHeader = ({ language, code }: CodeHeaderProps) => {
|
const CodeHeader = ({ language, code }: CodeHeaderProps) => {
|
||||||
const { isCopied, copyToClipboard } = useCopyToClipboard();
|
const { isCopied, copyToClipboard } = useCopyToClipboard();
|
||||||
|
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const onCopy = () => {
|
const onCopy = () => {
|
||||||
if (!code || isCopied) return;
|
if (!code || isCopied) return;
|
||||||
copyToClipboard(code);
|
copyToClipboard(code);
|
||||||
@ -19,11 +22,20 @@ const CodeHeader = ({ language, code }: CodeHeaderProps) => {
|
|||||||
return (
|
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]">
|
<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>
|
<span className="lowercase">{language}</span>
|
||||||
<TooltipIconButton tooltip="Copy" onClick={onCopy} visible={!isCopied}>
|
<TooltipIconButton
|
||||||
{!isCopied && (
|
tooltip={t("CopyToClipboard")}
|
||||||
<ReactSVG className="cursor-pointer" src={BtnCopyIconUrl} />
|
onClick={onCopy}
|
||||||
|
visible={!isCopied}
|
||||||
|
>
|
||||||
|
{!isCopied && <IconButton iconName={BtnCopyIconUrl} size={16} />}
|
||||||
|
{isCopied && (
|
||||||
|
<IconButton
|
||||||
|
iconName={BtnCheckIconUrl}
|
||||||
|
size={16}
|
||||||
|
isStroke
|
||||||
|
disableHover
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
{isCopied && <ReactSVG src={BtnCheckIconUrl} />}
|
|
||||||
</TooltipIconButton>
|
</TooltipIconButton>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -63,7 +63,7 @@ const AssistantActionBar = () => {
|
|||||||
className="col-start-3 row-start-2 ml-3 mt-3 flex gap-[8px]"
|
className="col-start-3 row-start-2 ml-3 mt-3 flex gap-[8px]"
|
||||||
>
|
>
|
||||||
<ActionBarPrimitive.Copy asChild>
|
<ActionBarPrimitive.Copy asChild>
|
||||||
<TooltipIconButton tooltip="Copy">
|
<TooltipIconButton tooltip={t("CopyToClipboard")}>
|
||||||
<MessagePrimitive.If copied>
|
<MessagePrimitive.If copied>
|
||||||
<IconButton
|
<IconButton
|
||||||
iconName={BtnCheckIconUrl}
|
iconName={BtnCheckIconUrl}
|
||||||
|
|||||||
@ -109,7 +109,9 @@ class Provider {
|
|||||||
createChatName = async (message: string) => {
|
createChatName = async (message: string) => {
|
||||||
if (!this.currentProvider) return "";
|
if (!this.currentProvider) return "";
|
||||||
|
|
||||||
return this.currentProvider.createChatName(message);
|
const title = await this.currentProvider.createChatName(message);
|
||||||
|
|
||||||
|
return title.slice(0, 128);
|
||||||
};
|
};
|
||||||
|
|
||||||
sendMessage = (
|
sendMessage = (
|
||||||
|
|||||||
Reference in New Issue
Block a user