rhua-chatgpt-web 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{api_chain-BhV6_Pmq.js → api_chain-BdfZ6btS.js} +2 -2
- package/dist/{api_chain-DVLnAgiW.cjs → api_chain-BeqsfaDz.cjs} +1 -1
- package/dist/{combine_docs_chain-B9QorZsY.js → combine_docs_chain-COuoBXN8.js} +2 -2
- package/dist/{combine_docs_chain-D8mHPBmd.cjs → combine_docs_chain-DUTKgXFP.cjs} +1 -1
- package/dist/{few_shot-CFSdacSl.js → few_shot-CXrHoFil.js} +1 -1
- package/dist/{few_shot-bRG5F-EG.cjs → few_shot-D5v-GZVm.cjs} +1 -1
- package/dist/{index-CR8ZslxC.js → index-5XRIGdCC.js} +1 -1
- package/dist/index-6S2tDoUS.js +4 -0
- package/dist/index-B2TrxU0U.js +4 -0
- package/dist/{index-DrzloHWR.cjs → index-B2xNSa5_.cjs} +1 -1
- package/dist/{index-9eExIDsS.cjs → index-B8iepdgY.cjs} +1 -1
- package/dist/{index-C0mX7ZGP.js → index-BB--QoGv.js} +679 -254
- package/dist/{index-B1Wlx-OU.cjs → index-BWUHG_4F.cjs} +1 -1
- package/dist/{index-BwGX7L-I.cjs → index-C-KTbjuY.cjs} +1 -1
- package/dist/{index-Dg40JuSw.cjs → index-C8v1v0ZB.cjs} +1 -1
- package/dist/{index-DmZ6JkXr.cjs → index-CSKkNkjZ.cjs} +9 -9
- package/dist/{index-Bz6sXppL.js → index-CZx4UvyD.js} +2 -2
- package/dist/index-Cbk2vr7P.js +4 -0
- package/dist/index-D0EbNeWR.js +4 -0
- package/dist/{index-szMPQlBb.js → index-D1-LRbik.js} +1 -1
- package/dist/{index-CM5Ei0Fe.js → index-D6OD8ywf.js} +2 -2
- package/dist/{index-BKYMy9rL.cjs → index-D6T6bzDk.cjs} +1 -1
- package/dist/{index-CiJIlOWe.cjs → index-DIvROZpA.cjs} +1 -1
- package/dist/{index-B4QG5JFW.js → index-DL9k9te9.js} +1 -1
- package/dist/{index-BxehhQJ1.js → index-DS6Ey1Z3.js} +1 -1
- package/dist/{index-Bm3Y9HAz.cjs → index-Dkt-39To.cjs} +1 -1
- package/dist/{index-B_Zc2AO-.js → index-DpM0G23h.js} +1 -1
- package/dist/{index-B9enJf5m.cjs → index-MSPGHs3d.cjs} +1 -1
- package/dist/{index-BUvzgpbD.cjs → index-iTyupZ7c.cjs} +1 -1
- package/dist/{index-BmJffSUR.cjs → index-ufFGYeSY.cjs} +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/{index.es-lGV9_rDo.js → index.es-DD7ie9BT.js} +11 -11
- package/dist/{index.es-B2V8NsVE.cjs → index.es-DGO9vBB2.cjs} +2 -2
- package/dist/index.esm.js +1 -1
- package/dist/{llm_chain-1pCOifVt.js → llm_chain-BeI0W_p-.js} +1 -1
- package/dist/{llm_chain-D4IZ67iH.cjs → llm_chain-CCSE7ZH0.cjs} +1 -1
- package/dist/{sequential_chain-B9oXR3Bd.js → sequential_chain-DOfqDL23.js} +1 -1
- package/dist/{sequential_chain-DlVTyzea.cjs → sequential_chain-DPzxZkxm.cjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/{vector_db_qa-BrELsB11.js → vector_db_qa-DQnKfZL6.js} +3 -3
- package/dist/{vector_db_qa-CYd9aCx5.cjs → vector_db_qa-DrnJyLCE.cjs} +1 -1
- package/package.json +1 -1
- package/dist/index-BDLTve4Z.js +0 -4
- package/dist/index-NaKA8k_1.js +0 -4
- package/dist/index-m3hI35_N.js +0 -4
- package/dist/index-x-JUDIDN.js +0 -4
|
@@ -3,7 +3,7 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
|
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import React__default, { useState, useRef, useCallback, useEffect, useMemo, createRef, forwardRef, useLayoutEffect, useImperativeHandle } from "react";
|
|
5
5
|
import { Button, Input, Select, Checkbox, Tooltip, Toast, Typography, Collapsible, Dropdown, Tag, Avatar, Spin, Layout, Modal, TextArea, Empty, Form, TagGroup, Divider, Tree, SideSheet } from "@douyinfe/semi-ui";
|
|
6
|
-
import { IconChevronDown, IconClose, IconShareStroked, IconPlus, IconSearch, IconEdit2Stroked, IconDeleteStroked, IconCopyStroked, IconDownCircleStroked, IconBulb, IconChevronUp, IconLink, IconTreeTriangleDown, IconImage,
|
|
6
|
+
import { IconChevronDown, IconClose, IconShareStroked, IconPlus, IconSearch, IconEdit2Stroked, IconDeleteStroked, IconCopyStroked, IconDownCircleStroked, IconBulb, IconChevronUp, IconFile, IconLink, IconTreeTriangleDown, IconImage, IconArrowRight, IconRefresh, IconLikeThumb, IconArrowLeft, IconBolt, IconEditStroked, IconComment, IconDelete, IconCloud, IconStop, IconSend, IconChevronLeft, IconArrowUp, IconHistory } from "@douyinfe/semi-icons";
|
|
7
7
|
import styled from "styled-components";
|
|
8
8
|
import { useNavigate, useSearchParams } from "react-router-dom";
|
|
9
9
|
import localforage from "localforage";
|
|
@@ -1021,7 +1021,7 @@ const convertDifyAppToAgent = (difyApp) => {
|
|
|
1021
1021
|
const getAgentList = async (type = "app") => {
|
|
1022
1022
|
let preApi = location.hostname === "localhost" ? "http://111.6.44.42:30001" : location.origin;
|
|
1023
1023
|
let baseApi = `${preApi}/prod-api/system/apps/list?pageNum=1&pageSize=100&type=${type}`;
|
|
1024
|
-
let token = "eyJhbGciOiJIUzUxMiJ9.
|
|
1024
|
+
let token = "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImxvZ2luX3VzZXJfa2V5IjoiYjFlOTMwZWEtODY3ZS00Njg4LWI3ZWMtZTI5ODFkMWU5MmRhIn0.HSLFnVSIPAOSaHXCU2cRCevOO5qiXdLMWYRpn7lEbX-ICqcu96RXCk6gq51wCpoLxQX-Sf9yrCXneFpSdj1Ctw";
|
|
1025
1025
|
try {
|
|
1026
1026
|
const cacheData = localStorage.getItem("agentWebCache");
|
|
1027
1027
|
console.log("cacheData", cacheData);
|
|
@@ -1745,6 +1745,10 @@ const AiList = ({
|
|
|
1745
1745
|
};
|
|
1746
1746
|
const openCard = (card) => {
|
|
1747
1747
|
console.log("openCard", card);
|
|
1748
|
+
if (card.customize === "试金石") {
|
|
1749
|
+
navigate("/new-chat/interrogation-record");
|
|
1750
|
+
return;
|
|
1751
|
+
}
|
|
1748
1752
|
if (handleWrite) {
|
|
1749
1753
|
if (card.customize === "在线写作") {
|
|
1750
1754
|
return handleWrite(card);
|
|
@@ -41853,6 +41857,51 @@ const isEqual = (prevProps, currentProps) => {
|
|
|
41853
41857
|
};
|
|
41854
41858
|
const MarkdownBox = React__default.memo(({ content: content2, themeMode = "light" }) => {
|
|
41855
41859
|
const thinkingContent = parseThinkingContent(content2);
|
|
41860
|
+
const isDownloadLink = (href) => {
|
|
41861
|
+
if (!href) return false;
|
|
41862
|
+
const downloadExtensions = [
|
|
41863
|
+
".pdf",
|
|
41864
|
+
".doc",
|
|
41865
|
+
".docx",
|
|
41866
|
+
".xls",
|
|
41867
|
+
".xlsx",
|
|
41868
|
+
".ppt",
|
|
41869
|
+
".pptx",
|
|
41870
|
+
".zip",
|
|
41871
|
+
".rar",
|
|
41872
|
+
".7z",
|
|
41873
|
+
".tar",
|
|
41874
|
+
".gz",
|
|
41875
|
+
".txt",
|
|
41876
|
+
".csv",
|
|
41877
|
+
".json",
|
|
41878
|
+
".xml",
|
|
41879
|
+
".jpg",
|
|
41880
|
+
".jpeg",
|
|
41881
|
+
".png",
|
|
41882
|
+
".gif",
|
|
41883
|
+
".bmp",
|
|
41884
|
+
".svg",
|
|
41885
|
+
".webp",
|
|
41886
|
+
".mp4",
|
|
41887
|
+
".avi",
|
|
41888
|
+
".mov",
|
|
41889
|
+
".wmv",
|
|
41890
|
+
".flv",
|
|
41891
|
+
".mp3",
|
|
41892
|
+
".wav",
|
|
41893
|
+
".flac",
|
|
41894
|
+
".aac",
|
|
41895
|
+
".exe",
|
|
41896
|
+
".dmg",
|
|
41897
|
+
".deb",
|
|
41898
|
+
".rpm",
|
|
41899
|
+
".apk",
|
|
41900
|
+
".ipa"
|
|
41901
|
+
];
|
|
41902
|
+
const lowerHref = href.toLowerCase();
|
|
41903
|
+
return downloadExtensions.some((ext) => lowerHref.includes(ext));
|
|
41904
|
+
};
|
|
41856
41905
|
const extractLinkButtons = (text2) => {
|
|
41857
41906
|
const buttons2 = [];
|
|
41858
41907
|
const buttonPattern = /<button\s+data-link=["']([^"']+)["'][^>]*>([\s\S]*?)<\/button>/gi;
|
|
@@ -41879,7 +41928,46 @@ const MarkdownBox = React__default.memo(({ content: content2, themeMode = "light
|
|
|
41879
41928
|
children: MessageUtil.messageContentConvert(cleanedContent),
|
|
41880
41929
|
components: {
|
|
41881
41930
|
a: ({ href, children }) => {
|
|
41882
|
-
|
|
41931
|
+
if (!href) {
|
|
41932
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("a", { children });
|
|
41933
|
+
}
|
|
41934
|
+
const isDownload = isDownloadLink(href);
|
|
41935
|
+
const buttonText = isDownload ? "点击下载" : "点击跳转";
|
|
41936
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
41937
|
+
Button,
|
|
41938
|
+
{
|
|
41939
|
+
className: "markdown-link-button",
|
|
41940
|
+
theme: "solid",
|
|
41941
|
+
type: "primary",
|
|
41942
|
+
icon: isDownload ? /* @__PURE__ */ jsxRuntimeExports.jsx(IconFile, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(IconLink, {}),
|
|
41943
|
+
onClick: () => {
|
|
41944
|
+
if (isDownload) {
|
|
41945
|
+
try {
|
|
41946
|
+
const link2 = document.createElement("a");
|
|
41947
|
+
link2.href = href;
|
|
41948
|
+
const urlParts = href.split("/");
|
|
41949
|
+
const fileName = urlParts[urlParts.length - 1].split("?")[0];
|
|
41950
|
+
link2.download = fileName || "";
|
|
41951
|
+
link2.target = "_blank";
|
|
41952
|
+
link2.rel = "noopener noreferrer";
|
|
41953
|
+
document.body.appendChild(link2);
|
|
41954
|
+
link2.click();
|
|
41955
|
+
document.body.removeChild(link2);
|
|
41956
|
+
} catch (error) {
|
|
41957
|
+
window.open(href, "_blank", "noopener,noreferrer");
|
|
41958
|
+
}
|
|
41959
|
+
} else {
|
|
41960
|
+
window.open(href, "_blank", "noopener,noreferrer");
|
|
41961
|
+
}
|
|
41962
|
+
},
|
|
41963
|
+
style: {
|
|
41964
|
+
margin: "0px 8px 4px 8px",
|
|
41965
|
+
display: "inline-flex",
|
|
41966
|
+
alignItems: "center"
|
|
41967
|
+
},
|
|
41968
|
+
children: buttonText
|
|
41969
|
+
}
|
|
41970
|
+
);
|
|
41883
41971
|
},
|
|
41884
41972
|
code: ({ node: node2, className, children, ...props }) => {
|
|
41885
41973
|
const match = /language-(\w+)/.exec(className || "");
|
|
@@ -42118,11 +42206,20 @@ const BotMessageBox = React__default.memo(
|
|
|
42118
42206
|
agentApiKey,
|
|
42119
42207
|
openingPrompts,
|
|
42120
42208
|
showOpeningPrompts = true,
|
|
42121
|
-
agentDescription
|
|
42209
|
+
agentDescription,
|
|
42210
|
+
likeMessage,
|
|
42211
|
+
dislikeMessage,
|
|
42212
|
+
regenerateMessage
|
|
42122
42213
|
}) => {
|
|
42123
42214
|
const [showThink, setShowThink] = React__default.useState(true);
|
|
42124
42215
|
const [expandedReferences, setExpandedReferences] = React__default.useState(/* @__PURE__ */ new Set());
|
|
42216
|
+
const [isLiked, setIsLiked] = React__default.useState(message.isLiked || false);
|
|
42217
|
+
const [isDisliked, setIsDisliked] = React__default.useState(message.isDisliked || false);
|
|
42125
42218
|
const prevReferencesRef = useRef(message.references);
|
|
42219
|
+
useEffect(() => {
|
|
42220
|
+
setIsLiked(message.isLiked || false);
|
|
42221
|
+
setIsDisliked(message.isDisliked || false);
|
|
42222
|
+
}, [message.isLiked, message.isDisliked]);
|
|
42126
42223
|
useEffect(() => {
|
|
42127
42224
|
const prevRefs = prevReferencesRef.current;
|
|
42128
42225
|
const currentRefs = message.references;
|
|
@@ -42161,251 +42258,383 @@ const BotMessageBox = React__default.memo(
|
|
|
42161
42258
|
const hasThinkContent = thinkContent !== "";
|
|
42162
42259
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "comment-single-box bot", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "comment-single-wrapper", children: [
|
|
42163
42260
|
(!message.isNewChat || !isMobile) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "comment-single-avatar", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: robotIcon, alt: "机器人头像" }) }),
|
|
42164
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
42165
|
-
|
|
42166
|
-
|
|
42167
|
-
|
|
42168
|
-
|
|
42169
|
-
|
|
42170
|
-
|
|
42171
|
-
|
|
42172
|
-
|
|
42173
|
-
|
|
42174
|
-
|
|
42175
|
-
|
|
42176
|
-
|
|
42177
|
-
|
|
42178
|
-
|
|
42179
|
-
|
|
42180
|
-
|
|
42181
|
-
onClick: () => setShowThink(!showThink),
|
|
42182
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
|
|
42183
|
-
"思考过程 ",
|
|
42184
|
-
showThink ? "▲" : "▼"
|
|
42185
|
-
] })
|
|
42186
|
-
}
|
|
42187
|
-
),
|
|
42188
|
-
showThink && hasThinkContent && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
42189
|
-
"div",
|
|
42190
|
-
{
|
|
42191
|
-
style: {
|
|
42192
|
-
opacity: 0.8,
|
|
42193
|
-
borderLeft: "1px solid rgb(126, 126, 126)",
|
|
42194
|
-
paddingLeft: "12px",
|
|
42195
|
-
marginLeft: "4px",
|
|
42196
|
-
marginBottom: "16px"
|
|
42197
|
-
},
|
|
42198
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(MarkdownBox, { content: thinkContent, themeMode })
|
|
42199
|
-
}
|
|
42200
|
-
),
|
|
42201
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(MarkdownBox, { content: chatContent, themeMode }),
|
|
42202
|
-
message.isNewChat && showOpeningPrompts && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
42203
|
-
"div",
|
|
42204
|
-
{
|
|
42205
|
-
style: {
|
|
42206
|
-
marginTop: "16px",
|
|
42207
|
-
display: "flex",
|
|
42208
|
-
gap: "8px",
|
|
42209
|
-
flexWrap: "wrap"
|
|
42210
|
-
},
|
|
42211
|
-
children: (openingPrompts && openingPrompts.length > 0 ? openingPrompts : suggested_questions).map((messageText, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
42212
|
-
"span",
|
|
42213
|
-
{
|
|
42214
|
-
className: "opening-prompt-btn",
|
|
42215
|
-
onClick: () => chatSubmit(messageText),
|
|
42216
|
-
children: messageText
|
|
42261
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "comment-single-content", children: [
|
|
42262
|
+
!message.completed && message.content == "" ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "comment-single-text", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Spin, {}) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "comment-single-text markdown-body", children: [
|
|
42263
|
+
hasThinkContent && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
42264
|
+
"div",
|
|
42265
|
+
{
|
|
42266
|
+
style: {
|
|
42267
|
+
cursor: "pointer",
|
|
42268
|
+
color: "#333333",
|
|
42269
|
+
marginBottom: "8px",
|
|
42270
|
+
display: "flex",
|
|
42271
|
+
alignItems: "center",
|
|
42272
|
+
gap: "8px",
|
|
42273
|
+
fontSize: "14px",
|
|
42274
|
+
fontWeight: 600,
|
|
42275
|
+
userSelect: "none",
|
|
42276
|
+
WebkitUserSelect: "none",
|
|
42277
|
+
msUserSelect: "none"
|
|
42217
42278
|
},
|
|
42218
|
-
|
|
42219
|
-
|
|
42220
|
-
|
|
42221
|
-
|
|
42222
|
-
|
|
42223
|
-
|
|
42224
|
-
|
|
42225
|
-
|
|
42226
|
-
|
|
42227
|
-
|
|
42228
|
-
|
|
42229
|
-
|
|
42230
|
-
|
|
42231
|
-
|
|
42232
|
-
"
|
|
42233
|
-
|
|
42234
|
-
|
|
42235
|
-
|
|
42236
|
-
|
|
42237
|
-
|
|
42238
|
-
|
|
42239
|
-
|
|
42240
|
-
|
|
42241
|
-
|
|
42242
|
-
|
|
42243
|
-
|
|
42244
|
-
"
|
|
42279
|
+
onClick: () => setShowThink(!showThink),
|
|
42280
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
|
|
42281
|
+
"思考过程 ",
|
|
42282
|
+
showThink ? "▲" : "▼"
|
|
42283
|
+
] })
|
|
42284
|
+
}
|
|
42285
|
+
),
|
|
42286
|
+
showThink && hasThinkContent && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
42287
|
+
"div",
|
|
42288
|
+
{
|
|
42289
|
+
style: {
|
|
42290
|
+
opacity: 0.8,
|
|
42291
|
+
borderLeft: "1px solid rgb(126, 126, 126)",
|
|
42292
|
+
paddingLeft: "12px",
|
|
42293
|
+
marginLeft: "4px",
|
|
42294
|
+
marginBottom: "16px"
|
|
42295
|
+
},
|
|
42296
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(MarkdownBox, { content: thinkContent, themeMode })
|
|
42297
|
+
}
|
|
42298
|
+
),
|
|
42299
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(MarkdownBox, { content: chatContent, themeMode }),
|
|
42300
|
+
message.isNewChat && showOpeningPrompts && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
42301
|
+
"div",
|
|
42302
|
+
{
|
|
42303
|
+
style: {
|
|
42304
|
+
marginTop: "16px",
|
|
42305
|
+
display: "flex",
|
|
42306
|
+
gap: "8px",
|
|
42307
|
+
flexWrap: "wrap"
|
|
42308
|
+
},
|
|
42309
|
+
children: (openingPrompts && openingPrompts.length > 0 ? openingPrompts : suggested_questions).map((messageText, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
42310
|
+
"span",
|
|
42245
42311
|
{
|
|
42246
|
-
|
|
42247
|
-
|
|
42248
|
-
|
|
42249
|
-
|
|
42250
|
-
|
|
42251
|
-
|
|
42252
|
-
|
|
42253
|
-
|
|
42254
|
-
|
|
42255
|
-
|
|
42256
|
-
|
|
42257
|
-
|
|
42258
|
-
|
|
42259
|
-
|
|
42260
|
-
|
|
42261
|
-
|
|
42262
|
-
|
|
42263
|
-
|
|
42264
|
-
|
|
42265
|
-
|
|
42266
|
-
|
|
42267
|
-
|
|
42268
|
-
|
|
42269
|
-
|
|
42270
|
-
|
|
42271
|
-
|
|
42272
|
-
|
|
42273
|
-
|
|
42274
|
-
|
|
42275
|
-
|
|
42276
|
-
|
|
42277
|
-
|
|
42278
|
-
|
|
42279
|
-
|
|
42280
|
-
|
|
42281
|
-
|
|
42282
|
-
|
|
42283
|
-
|
|
42284
|
-
|
|
42285
|
-
|
|
42286
|
-
|
|
42287
|
-
|
|
42288
|
-
|
|
42289
|
-
|
|
42290
|
-
|
|
42312
|
+
className: "opening-prompt-btn",
|
|
42313
|
+
onClick: () => chatSubmit(messageText),
|
|
42314
|
+
children: messageText
|
|
42315
|
+
},
|
|
42316
|
+
index2
|
|
42317
|
+
))
|
|
42318
|
+
}
|
|
42319
|
+
),
|
|
42320
|
+
message.references && message.references.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
42321
|
+
"div",
|
|
42322
|
+
{
|
|
42323
|
+
style: {
|
|
42324
|
+
marginTop: "16px",
|
|
42325
|
+
paddingTop: "16px",
|
|
42326
|
+
borderTop: `1px solid ${themeMode === "dark" ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.1)"}`
|
|
42327
|
+
},
|
|
42328
|
+
children: [
|
|
42329
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
42330
|
+
"div",
|
|
42331
|
+
{
|
|
42332
|
+
style: {
|
|
42333
|
+
fontSize: "14px",
|
|
42334
|
+
fontWeight: 600,
|
|
42335
|
+
marginBottom: "12px",
|
|
42336
|
+
color: themeMode === "dark" ? "#fff" : "#333"
|
|
42337
|
+
},
|
|
42338
|
+
children: "引用"
|
|
42339
|
+
}
|
|
42340
|
+
),
|
|
42341
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
42342
|
+
"div",
|
|
42343
|
+
{
|
|
42344
|
+
style: {
|
|
42345
|
+
display: "flex",
|
|
42346
|
+
flexDirection: "column",
|
|
42347
|
+
gap: "12px"
|
|
42348
|
+
},
|
|
42349
|
+
children: message.references.map((ref, index2) => {
|
|
42350
|
+
const isExpanded = expandedReferences.has(index2);
|
|
42351
|
+
const toggleExpand = () => {
|
|
42352
|
+
const newSet = new Set(expandedReferences);
|
|
42353
|
+
if (isExpanded) {
|
|
42354
|
+
newSet.delete(index2);
|
|
42355
|
+
} else {
|
|
42356
|
+
newSet.add(index2);
|
|
42357
|
+
}
|
|
42358
|
+
setExpandedReferences(newSet);
|
|
42359
|
+
};
|
|
42360
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
42361
|
+
"div",
|
|
42362
|
+
{
|
|
42363
|
+
style: {
|
|
42364
|
+
backgroundColor: themeMode === "dark" ? "rgba(255, 255, 255, 0.05)" : "rgba(0, 0, 0, 0.02)",
|
|
42365
|
+
borderRadius: "6px",
|
|
42366
|
+
overflow: "hidden",
|
|
42367
|
+
border: `1px solid ${themeMode === "dark" ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.08)"}`
|
|
42368
|
+
},
|
|
42369
|
+
children: [
|
|
42370
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
42371
|
+
"div",
|
|
42372
|
+
{
|
|
42373
|
+
style: {
|
|
42374
|
+
display: "flex",
|
|
42375
|
+
alignItems: "center",
|
|
42376
|
+
gap: "8px",
|
|
42377
|
+
padding: "12px",
|
|
42378
|
+
cursor: ref.content ? "pointer" : "default"
|
|
42379
|
+
},
|
|
42380
|
+
onClick: toggleExpand,
|
|
42381
|
+
children: [
|
|
42382
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
42383
|
+
IconFile,
|
|
42384
|
+
{
|
|
42385
|
+
style: {
|
|
42386
|
+
color: themeMode === "dark" ? "rgba(255, 255, 255, 0.7)" : "rgba(0, 0, 0, 0.6)",
|
|
42387
|
+
fontSize: "16px",
|
|
42388
|
+
flexShrink: 0
|
|
42389
|
+
}
|
|
42291
42390
|
}
|
|
42292
|
-
|
|
42293
|
-
|
|
42294
|
-
|
|
42295
|
-
|
|
42296
|
-
|
|
42297
|
-
|
|
42298
|
-
|
|
42299
|
-
|
|
42300
|
-
|
|
42301
|
-
|
|
42302
|
-
|
|
42303
|
-
children: ref.name
|
|
42304
|
-
}
|
|
42305
|
-
),
|
|
42306
|
-
ref.content && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { flexShrink: 0 }, children: isExpanded ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
42307
|
-
IconChevronUp,
|
|
42308
|
-
{
|
|
42309
|
-
style: {
|
|
42310
|
-
color: themeMode === "dark" ? "rgba(255, 255, 255, 0.6)" : "rgba(0, 0, 0, 0.5)",
|
|
42311
|
-
fontSize: "16px"
|
|
42391
|
+
),
|
|
42392
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
42393
|
+
"span",
|
|
42394
|
+
{
|
|
42395
|
+
style: {
|
|
42396
|
+
fontSize: "14px",
|
|
42397
|
+
color: themeMode === "dark" ? "rgba(255, 255, 255, 0.9)" : "rgba(0, 0, 0, 0.8)",
|
|
42398
|
+
flex: 1,
|
|
42399
|
+
fontWeight: 500
|
|
42400
|
+
},
|
|
42401
|
+
children: ref.name
|
|
42312
42402
|
}
|
|
42313
|
-
|
|
42314
|
-
|
|
42315
|
-
|
|
42316
|
-
|
|
42317
|
-
|
|
42318
|
-
|
|
42319
|
-
|
|
42403
|
+
),
|
|
42404
|
+
ref.content && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { flexShrink: 0 }, children: isExpanded ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
42405
|
+
IconChevronUp,
|
|
42406
|
+
{
|
|
42407
|
+
style: {
|
|
42408
|
+
color: themeMode === "dark" ? "rgba(255, 255, 255, 0.6)" : "rgba(0, 0, 0, 0.5)",
|
|
42409
|
+
fontSize: "16px"
|
|
42410
|
+
}
|
|
42320
42411
|
}
|
|
42321
|
-
|
|
42322
|
-
|
|
42323
|
-
|
|
42324
|
-
|
|
42325
|
-
|
|
42326
|
-
|
|
42327
|
-
"div",
|
|
42328
|
-
{
|
|
42329
|
-
style: {
|
|
42330
|
-
padding: "0 12px 12px 12px",
|
|
42331
|
-
borderTop: `1px solid ${themeMode === "dark" ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.08)"}`
|
|
42332
|
-
},
|
|
42333
|
-
children: [
|
|
42334
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
42335
|
-
"div",
|
|
42336
|
-
{
|
|
42337
|
-
style: {
|
|
42338
|
-
fontSize: "13px",
|
|
42339
|
-
lineHeight: "1.6",
|
|
42340
|
-
color: themeMode === "dark" ? "rgba(255, 255, 255, 0.8)" : "rgba(0, 0, 0, 0.7)",
|
|
42341
|
-
whiteSpace: "pre-wrap",
|
|
42342
|
-
wordBreak: "break-word",
|
|
42343
|
-
paddingTop: "12px",
|
|
42344
|
-
marginBottom: ref.dataset_id && ref.id ? "12px" : "0"
|
|
42345
|
-
},
|
|
42346
|
-
children: ref.content
|
|
42347
|
-
}
|
|
42348
|
-
),
|
|
42349
|
-
ref.dataset_id && ref.id && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
42350
|
-
"div",
|
|
42351
|
-
{
|
|
42352
|
-
style: {
|
|
42353
|
-
display: "flex",
|
|
42354
|
-
justifyContent: "flex-end"
|
|
42355
|
-
},
|
|
42356
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
42357
|
-
"div",
|
|
42358
|
-
{
|
|
42359
|
-
style: {
|
|
42360
|
-
display: "flex",
|
|
42361
|
-
alignItems: "center",
|
|
42362
|
-
gap: "4px",
|
|
42363
|
-
fontSize: "13px",
|
|
42364
|
-
color: themeMode === "dark" ? "rgba(100, 181, 246, 1)" : "rgba(25, 118, 210, 1)",
|
|
42365
|
-
cursor: "pointer",
|
|
42366
|
-
fontWeight: 500
|
|
42367
|
-
},
|
|
42368
|
-
onClick: (e) => {
|
|
42369
|
-
e.stopPropagation();
|
|
42370
|
-
const baseUrl = CommonUtil.getDifyApiBaseUrl();
|
|
42371
|
-
const knowledgeBaseUrl = `${baseUrl.replace(/\/api$/, "")}/datasets/${ref.dataset_id}/documents/${ref.id}`;
|
|
42372
|
-
window.open(knowledgeBaseUrl, "_blank");
|
|
42373
|
-
},
|
|
42374
|
-
onMouseEnter: (e) => {
|
|
42375
|
-
e.currentTarget.style.opacity = "0.8";
|
|
42376
|
-
},
|
|
42377
|
-
onMouseLeave: (e) => {
|
|
42378
|
-
e.currentTarget.style.opacity = "1";
|
|
42379
|
-
},
|
|
42380
|
-
children: [
|
|
42381
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "跳转至知识库" }),
|
|
42382
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
42383
|
-
IconArrowRight,
|
|
42384
|
-
{
|
|
42385
|
-
style: {
|
|
42386
|
-
fontSize: "14px"
|
|
42387
|
-
}
|
|
42388
|
-
}
|
|
42389
|
-
)
|
|
42390
|
-
]
|
|
42412
|
+
) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
42413
|
+
IconChevronDown,
|
|
42414
|
+
{
|
|
42415
|
+
style: {
|
|
42416
|
+
color: themeMode === "dark" ? "rgba(255, 255, 255, 0.6)" : "rgba(0, 0, 0, 0.5)",
|
|
42417
|
+
fontSize: "16px"
|
|
42391
42418
|
}
|
|
42392
|
-
|
|
42393
|
-
}
|
|
42394
|
-
|
|
42395
|
-
|
|
42396
|
-
|
|
42397
|
-
|
|
42398
|
-
|
|
42399
|
-
|
|
42400
|
-
|
|
42401
|
-
|
|
42402
|
-
|
|
42419
|
+
}
|
|
42420
|
+
) })
|
|
42421
|
+
]
|
|
42422
|
+
}
|
|
42423
|
+
),
|
|
42424
|
+
isExpanded && ref.content && /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
42425
|
+
"div",
|
|
42426
|
+
{
|
|
42427
|
+
style: {
|
|
42428
|
+
padding: "0 12px 12px 12px",
|
|
42429
|
+
borderTop: `1px solid ${themeMode === "dark" ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.08)"}`
|
|
42430
|
+
},
|
|
42431
|
+
children: [
|
|
42432
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
42433
|
+
"div",
|
|
42434
|
+
{
|
|
42435
|
+
style: {
|
|
42436
|
+
fontSize: "13px",
|
|
42437
|
+
lineHeight: "1.6",
|
|
42438
|
+
color: themeMode === "dark" ? "rgba(255, 255, 255, 0.8)" : "rgba(0, 0, 0, 0.7)",
|
|
42439
|
+
whiteSpace: "pre-wrap",
|
|
42440
|
+
wordBreak: "break-word",
|
|
42441
|
+
paddingTop: "12px",
|
|
42442
|
+
marginBottom: ref.dataset_id && ref.id ? "12px" : "0"
|
|
42443
|
+
},
|
|
42444
|
+
children: ref.content
|
|
42445
|
+
}
|
|
42446
|
+
),
|
|
42447
|
+
ref.dataset_id && ref.id && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
42448
|
+
"div",
|
|
42449
|
+
{
|
|
42450
|
+
style: {
|
|
42451
|
+
display: "flex",
|
|
42452
|
+
justifyContent: "flex-end"
|
|
42453
|
+
},
|
|
42454
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
42455
|
+
"div",
|
|
42456
|
+
{
|
|
42457
|
+
style: {
|
|
42458
|
+
display: "flex",
|
|
42459
|
+
alignItems: "center",
|
|
42460
|
+
gap: "4px",
|
|
42461
|
+
fontSize: "13px",
|
|
42462
|
+
color: themeMode === "dark" ? "rgba(100, 181, 246, 1)" : "rgba(25, 118, 210, 1)",
|
|
42463
|
+
cursor: "pointer",
|
|
42464
|
+
fontWeight: 500
|
|
42465
|
+
},
|
|
42466
|
+
onClick: (e) => {
|
|
42467
|
+
e.stopPropagation();
|
|
42468
|
+
const baseUrl = CommonUtil.getDifyApiBaseUrl();
|
|
42469
|
+
const knowledgeBaseUrl = `${baseUrl.replace(/\/api$/, "")}/datasets/${ref.dataset_id}/documents/${ref.id}`;
|
|
42470
|
+
window.open(knowledgeBaseUrl, "_blank");
|
|
42471
|
+
},
|
|
42472
|
+
onMouseEnter: (e) => {
|
|
42473
|
+
e.currentTarget.style.opacity = "0.8";
|
|
42474
|
+
},
|
|
42475
|
+
onMouseLeave: (e) => {
|
|
42476
|
+
e.currentTarget.style.opacity = "1";
|
|
42477
|
+
},
|
|
42478
|
+
children: [
|
|
42479
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "跳转至知识库" }),
|
|
42480
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
42481
|
+
IconArrowRight,
|
|
42482
|
+
{
|
|
42483
|
+
style: {
|
|
42484
|
+
fontSize: "14px"
|
|
42485
|
+
}
|
|
42486
|
+
}
|
|
42487
|
+
)
|
|
42488
|
+
]
|
|
42489
|
+
}
|
|
42490
|
+
)
|
|
42491
|
+
}
|
|
42492
|
+
)
|
|
42493
|
+
]
|
|
42494
|
+
}
|
|
42495
|
+
)
|
|
42496
|
+
]
|
|
42497
|
+
},
|
|
42498
|
+
index2
|
|
42499
|
+
);
|
|
42500
|
+
})
|
|
42501
|
+
}
|
|
42502
|
+
)
|
|
42503
|
+
]
|
|
42504
|
+
}
|
|
42505
|
+
)
|
|
42506
|
+
] }),
|
|
42507
|
+
message.completed && !message.isNewChat && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "comment-single-action-buttons", children: [
|
|
42508
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { content: "复制", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
42509
|
+
Button,
|
|
42510
|
+
{
|
|
42511
|
+
theme: "borderless",
|
|
42512
|
+
type: "tertiary",
|
|
42513
|
+
size: "small",
|
|
42514
|
+
icon: /* @__PURE__ */ jsxRuntimeExports.jsx(IconCopyStroked, {}),
|
|
42515
|
+
onClick: (e) => {
|
|
42516
|
+
e.stopPropagation();
|
|
42517
|
+
copyCommentChatItem(message.id);
|
|
42518
|
+
},
|
|
42519
|
+
style: {
|
|
42520
|
+
width: "28px",
|
|
42521
|
+
height: "28px",
|
|
42522
|
+
minWidth: "28px",
|
|
42523
|
+
padding: "0",
|
|
42524
|
+
borderRadius: "8px",
|
|
42525
|
+
background: "#ffffff",
|
|
42526
|
+
border: "1px solid rgba(180, 197, 226, 0.6)",
|
|
42527
|
+
boxShadow: "0 1px 3px rgba(0, 0, 0, 0.1)"
|
|
42528
|
+
},
|
|
42529
|
+
className: "comment-single-action-button"
|
|
42530
|
+
}
|
|
42531
|
+
) }),
|
|
42532
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { content: "重写", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
42533
|
+
Button,
|
|
42534
|
+
{
|
|
42535
|
+
theme: "borderless",
|
|
42536
|
+
type: "tertiary",
|
|
42537
|
+
size: "small",
|
|
42538
|
+
icon: /* @__PURE__ */ jsxRuntimeExports.jsx(IconRefresh, {}),
|
|
42539
|
+
onClick: async (e) => {
|
|
42540
|
+
e.stopPropagation();
|
|
42541
|
+
if (regenerateMessage) {
|
|
42542
|
+
try {
|
|
42543
|
+
await regenerateMessage(message.id);
|
|
42544
|
+
} catch (error) {
|
|
42545
|
+
console.error("重写失败:", error);
|
|
42546
|
+
}
|
|
42403
42547
|
}
|
|
42404
|
-
|
|
42405
|
-
|
|
42406
|
-
|
|
42407
|
-
|
|
42408
|
-
|
|
42548
|
+
},
|
|
42549
|
+
style: {
|
|
42550
|
+
width: "28px",
|
|
42551
|
+
height: "28px",
|
|
42552
|
+
minWidth: "28px",
|
|
42553
|
+
padding: "0",
|
|
42554
|
+
borderRadius: "8px",
|
|
42555
|
+
background: "#ffffff",
|
|
42556
|
+
border: "1px solid rgba(180, 197, 226, 0.6)",
|
|
42557
|
+
boxShadow: "0 1px 3px rgba(0, 0, 0, 0.1)"
|
|
42558
|
+
},
|
|
42559
|
+
className: "comment-single-action-button"
|
|
42560
|
+
}
|
|
42561
|
+
) }),
|
|
42562
|
+
!isDisliked && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { content: "点赞", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
42563
|
+
Button,
|
|
42564
|
+
{
|
|
42565
|
+
theme: "borderless",
|
|
42566
|
+
type: "tertiary",
|
|
42567
|
+
size: "small",
|
|
42568
|
+
icon: /* @__PURE__ */ jsxRuntimeExports.jsx(IconLikeThumb, {}),
|
|
42569
|
+
onClick: async (e) => {
|
|
42570
|
+
e.stopPropagation();
|
|
42571
|
+
const newLikedState = !isLiked;
|
|
42572
|
+
setIsLiked(newLikedState);
|
|
42573
|
+
if (newLikedState && isDisliked) {
|
|
42574
|
+
setIsDisliked(false);
|
|
42575
|
+
}
|
|
42576
|
+
if (likeMessage) {
|
|
42577
|
+
try {
|
|
42578
|
+
await likeMessage(message.id);
|
|
42579
|
+
} catch (error) {
|
|
42580
|
+
setIsLiked(!newLikedState);
|
|
42581
|
+
console.error("点赞失败:", error);
|
|
42582
|
+
}
|
|
42583
|
+
}
|
|
42584
|
+
},
|
|
42585
|
+
style: {
|
|
42586
|
+
color: isLiked ? "#ffc107" : "rgba(0, 0, 0, 0.6)",
|
|
42587
|
+
width: "28px",
|
|
42588
|
+
height: "28px",
|
|
42589
|
+
minWidth: "28px",
|
|
42590
|
+
padding: "0",
|
|
42591
|
+
borderRadius: "8px",
|
|
42592
|
+
background: "#ffffff",
|
|
42593
|
+
border: "1px solid rgba(180, 197, 226, 0.6)",
|
|
42594
|
+
boxShadow: "0 1px 3px rgba(0, 0, 0, 0.1)"
|
|
42595
|
+
},
|
|
42596
|
+
className: "comment-single-action-button"
|
|
42597
|
+
}
|
|
42598
|
+
) }),
|
|
42599
|
+
!isLiked && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { content: "点踩", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
42600
|
+
Button,
|
|
42601
|
+
{
|
|
42602
|
+
theme: "borderless",
|
|
42603
|
+
type: "tertiary",
|
|
42604
|
+
size: "small",
|
|
42605
|
+
icon: /* @__PURE__ */ jsxRuntimeExports.jsx(IconLikeThumb, { style: { transform: "rotate(180deg)" } }),
|
|
42606
|
+
onClick: async (e) => {
|
|
42607
|
+
e.stopPropagation();
|
|
42608
|
+
const newDislikedState = !isDisliked;
|
|
42609
|
+
setIsDisliked(newDislikedState);
|
|
42610
|
+
if (newDislikedState && isLiked) {
|
|
42611
|
+
setIsLiked(false);
|
|
42612
|
+
}
|
|
42613
|
+
if (dislikeMessage) {
|
|
42614
|
+
try {
|
|
42615
|
+
await dislikeMessage(message.id);
|
|
42616
|
+
} catch (error) {
|
|
42617
|
+
setIsDisliked(!newDislikedState);
|
|
42618
|
+
console.error("点踩失败:", error);
|
|
42619
|
+
}
|
|
42620
|
+
}
|
|
42621
|
+
},
|
|
42622
|
+
style: {
|
|
42623
|
+
color: isDisliked ? "#f56565" : "rgba(0, 0, 0, 0.6)",
|
|
42624
|
+
width: "28px",
|
|
42625
|
+
height: "28px",
|
|
42626
|
+
minWidth: "28px",
|
|
42627
|
+
padding: "0",
|
|
42628
|
+
borderRadius: "8px",
|
|
42629
|
+
background: "#ffffff",
|
|
42630
|
+
border: "1px solid rgba(180, 197, 226, 0.6)",
|
|
42631
|
+
boxShadow: "0 1px 3px rgba(0, 0, 0, 0.1)"
|
|
42632
|
+
},
|
|
42633
|
+
className: "comment-single-action-button"
|
|
42634
|
+
}
|
|
42635
|
+
) })
|
|
42636
|
+
] })
|
|
42637
|
+
] }),
|
|
42409
42638
|
!message.isNewChat && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: `csh-${message.id}`, className: "comment-single-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
42410
42639
|
Dropdown,
|
|
42411
42640
|
{
|
|
@@ -44685,11 +44914,20 @@ function CommentIndex({
|
|
|
44685
44914
|
};
|
|
44686
44915
|
});
|
|
44687
44916
|
}
|
|
44917
|
+
let serverMessageId = currentMessage.serverMessageId;
|
|
44918
|
+
if (parsed.message_id && !serverMessageId) {
|
|
44919
|
+
serverMessageId = parsed.message_id;
|
|
44920
|
+
}
|
|
44688
44921
|
newChatList[findIndex] = {
|
|
44689
44922
|
...currentMessage,
|
|
44690
44923
|
completed: true,
|
|
44691
|
-
references: references.length > 0 ? references : currentMessage.references
|
|
44924
|
+
references: references.length > 0 ? references : currentMessage.references,
|
|
44925
|
+
serverMessageId: serverMessageId || currentMessage.serverMessageId
|
|
44692
44926
|
};
|
|
44927
|
+
if (serverMessageId && serverMessageId !== currentMessage.serverMessageId && currentCommentSessionId) {
|
|
44928
|
+
LocalForageService.setItem(`chat_list_${currentCommentSessionId}`, newChatList).catch((error) => {
|
|
44929
|
+
});
|
|
44930
|
+
}
|
|
44693
44931
|
return newChatList;
|
|
44694
44932
|
});
|
|
44695
44933
|
setTimeout(() => {
|
|
@@ -44718,6 +44956,24 @@ function CommentIndex({
|
|
|
44718
44956
|
}).catch((error) => {
|
|
44719
44957
|
});
|
|
44720
44958
|
}
|
|
44959
|
+
if (parsed.message_id && currentCommentSessionId) {
|
|
44960
|
+
setCommentChatList((chatList) => {
|
|
44961
|
+
const findIndex = chatList.findIndex(
|
|
44962
|
+
(message) => message.id === botMessage.id
|
|
44963
|
+
);
|
|
44964
|
+
if (findIndex < 0) return chatList;
|
|
44965
|
+
const currentMessage = chatList[findIndex];
|
|
44966
|
+
if (currentMessage.serverMessageId) return chatList;
|
|
44967
|
+
const newChatList = [...chatList];
|
|
44968
|
+
newChatList[findIndex] = {
|
|
44969
|
+
...currentMessage,
|
|
44970
|
+
serverMessageId: parsed.message_id
|
|
44971
|
+
};
|
|
44972
|
+
LocalForageService.setItem(`chat_list_${currentCommentSessionId}`, newChatList).catch((error) => {
|
|
44973
|
+
});
|
|
44974
|
+
return newChatList;
|
|
44975
|
+
});
|
|
44976
|
+
}
|
|
44721
44977
|
if (parsed.answer) {
|
|
44722
44978
|
setCommentChatList((chatList) => {
|
|
44723
44979
|
const findIndex = chatList.findIndex(
|
|
@@ -45632,6 +45888,172 @@ function CommentIndex({
|
|
|
45632
45888
|
return chatList;
|
|
45633
45889
|
});
|
|
45634
45890
|
}, []);
|
|
45891
|
+
const likeMessage = useCallback(async (messageId) => {
|
|
45892
|
+
const message = commentChatList.find((msg) => msg.id === messageId);
|
|
45893
|
+
if (!message || message.type !== "bot") {
|
|
45894
|
+
Toast.warning({
|
|
45895
|
+
content: "无法找到该消息",
|
|
45896
|
+
showClose: false,
|
|
45897
|
+
duration: 2
|
|
45898
|
+
});
|
|
45899
|
+
return;
|
|
45900
|
+
}
|
|
45901
|
+
const serverMessageId = message.serverMessageId || messageId;
|
|
45902
|
+
const newLikedState = !message.isLiked;
|
|
45903
|
+
const requestBody = {
|
|
45904
|
+
rating: newLikedState ? "like" : null
|
|
45905
|
+
};
|
|
45906
|
+
try {
|
|
45907
|
+
let preApi = location.hostname === "localhost" ? "http://111.6.44.42:30001" : location.origin;
|
|
45908
|
+
const response = await fetch(`${preApi}/prod-api/v1/messages/${serverMessageId}/feedbacks`, {
|
|
45909
|
+
method: "POST",
|
|
45910
|
+
headers: {
|
|
45911
|
+
"Content-Type": "application/json"
|
|
45912
|
+
},
|
|
45913
|
+
body: JSON.stringify(requestBody)
|
|
45914
|
+
});
|
|
45915
|
+
if (!response.ok) {
|
|
45916
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
45917
|
+
}
|
|
45918
|
+
setCommentChatList((chatList) => {
|
|
45919
|
+
const newChatList = chatList.map((msg) => {
|
|
45920
|
+
if (msg.id === messageId) {
|
|
45921
|
+
return {
|
|
45922
|
+
...msg,
|
|
45923
|
+
isLiked: newLikedState,
|
|
45924
|
+
// 如果点赞,取消点踩
|
|
45925
|
+
isDisliked: newLikedState ? false : msg.isDisliked
|
|
45926
|
+
};
|
|
45927
|
+
}
|
|
45928
|
+
return msg;
|
|
45929
|
+
});
|
|
45930
|
+
if (currentCommentSessionId) {
|
|
45931
|
+
LocalForageService.setItem(`chat_list_${currentCommentSessionId}`, newChatList);
|
|
45932
|
+
}
|
|
45933
|
+
return newChatList;
|
|
45934
|
+
});
|
|
45935
|
+
Toast.success({
|
|
45936
|
+
content: newLikedState ? "点赞成功" : "已取消点赞",
|
|
45937
|
+
showClose: false,
|
|
45938
|
+
duration: 2
|
|
45939
|
+
});
|
|
45940
|
+
} catch (error) {
|
|
45941
|
+
console.error("点赞失败:", error);
|
|
45942
|
+
Toast.error({
|
|
45943
|
+
content: "点赞失败,请稍后重试",
|
|
45944
|
+
showClose: false,
|
|
45945
|
+
duration: 2
|
|
45946
|
+
});
|
|
45947
|
+
throw error;
|
|
45948
|
+
}
|
|
45949
|
+
}, [commentChatList, currentCommentSessionId, currentCommentSession, agentList, selectedAgentId, sessionSetting]);
|
|
45950
|
+
const dislikeMessage = useCallback(async (messageId) => {
|
|
45951
|
+
const message = commentChatList.find((msg) => msg.id === messageId);
|
|
45952
|
+
if (!message || message.type !== "bot") {
|
|
45953
|
+
Toast.warning({
|
|
45954
|
+
content: "无法找到该消息",
|
|
45955
|
+
showClose: false,
|
|
45956
|
+
duration: 2
|
|
45957
|
+
});
|
|
45958
|
+
return;
|
|
45959
|
+
}
|
|
45960
|
+
const serverMessageId = message.serverMessageId || messageId;
|
|
45961
|
+
const newDislikedState = !message.isDisliked;
|
|
45962
|
+
const requestBody = {
|
|
45963
|
+
rating: newDislikedState ? "dislike" : null
|
|
45964
|
+
};
|
|
45965
|
+
try {
|
|
45966
|
+
let preApi = location.hostname === "localhost" ? "http://111.6.44.42:30001" : location.origin;
|
|
45967
|
+
const response = await fetch(`${preApi}/prod-api/v1/messages/${serverMessageId}/feedbacks`, {
|
|
45968
|
+
method: "POST",
|
|
45969
|
+
headers: {
|
|
45970
|
+
"Content-Type": "application/json"
|
|
45971
|
+
},
|
|
45972
|
+
body: JSON.stringify(requestBody)
|
|
45973
|
+
});
|
|
45974
|
+
if (!response.ok) {
|
|
45975
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
45976
|
+
}
|
|
45977
|
+
setCommentChatList((chatList) => {
|
|
45978
|
+
const newChatList = chatList.map((msg) => {
|
|
45979
|
+
if (msg.id === messageId) {
|
|
45980
|
+
return {
|
|
45981
|
+
...msg,
|
|
45982
|
+
isDisliked: newDislikedState,
|
|
45983
|
+
// 如果点踩,取消点赞
|
|
45984
|
+
isLiked: newDislikedState ? false : msg.isLiked
|
|
45985
|
+
};
|
|
45986
|
+
}
|
|
45987
|
+
return msg;
|
|
45988
|
+
});
|
|
45989
|
+
if (currentCommentSessionId) {
|
|
45990
|
+
LocalForageService.setItem(`chat_list_${currentCommentSessionId}`, newChatList);
|
|
45991
|
+
}
|
|
45992
|
+
return newChatList;
|
|
45993
|
+
});
|
|
45994
|
+
Toast.success({
|
|
45995
|
+
content: newDislikedState ? "点踩成功" : "已取消点踩",
|
|
45996
|
+
showClose: false,
|
|
45997
|
+
duration: 2
|
|
45998
|
+
});
|
|
45999
|
+
} catch (error) {
|
|
46000
|
+
console.error("点踩失败:", error);
|
|
46001
|
+
Toast.error({
|
|
46002
|
+
content: "点踩失败,请稍后重试",
|
|
46003
|
+
showClose: false,
|
|
46004
|
+
duration: 2
|
|
46005
|
+
});
|
|
46006
|
+
throw error;
|
|
46007
|
+
}
|
|
46008
|
+
}, [commentChatList, currentCommentSessionId, currentCommentSession, agentList, selectedAgentId, sessionSetting]);
|
|
46009
|
+
const regenerateMessage = useCallback(async (messageId) => {
|
|
46010
|
+
if (!currentCommentSessionId) {
|
|
46011
|
+
Toast.warning({
|
|
46012
|
+
content: "请先创建对话",
|
|
46013
|
+
showClose: false,
|
|
46014
|
+
duration: 2
|
|
46015
|
+
});
|
|
46016
|
+
return;
|
|
46017
|
+
}
|
|
46018
|
+
const messageIndex = commentChatList.findIndex((msg) => msg.id === messageId);
|
|
46019
|
+
if (messageIndex < 0) {
|
|
46020
|
+
Toast.warning({
|
|
46021
|
+
content: "无法找到该消息",
|
|
46022
|
+
showClose: false,
|
|
46023
|
+
duration: 2
|
|
46024
|
+
});
|
|
46025
|
+
return;
|
|
46026
|
+
}
|
|
46027
|
+
const botMessage = commentChatList[messageIndex];
|
|
46028
|
+
if (botMessage.type !== "bot") {
|
|
46029
|
+
Toast.warning({
|
|
46030
|
+
content: "只能重写AI回复的消息",
|
|
46031
|
+
showClose: false,
|
|
46032
|
+
duration: 2
|
|
46033
|
+
});
|
|
46034
|
+
return;
|
|
46035
|
+
}
|
|
46036
|
+
const userMessage = commentChatList[messageIndex - 1];
|
|
46037
|
+
if (!userMessage || userMessage.type !== "user") {
|
|
46038
|
+
Toast.warning({
|
|
46039
|
+
content: "无法找到对应的用户消息",
|
|
46040
|
+
showClose: false,
|
|
46041
|
+
duration: 2
|
|
46042
|
+
});
|
|
46043
|
+
return;
|
|
46044
|
+
}
|
|
46045
|
+
setCommentChatList((chatList) => {
|
|
46046
|
+
const newChatList = [...chatList];
|
|
46047
|
+
newChatList.splice(messageIndex - 1, 2);
|
|
46048
|
+
if (currentCommentSessionId) {
|
|
46049
|
+
LocalForageService.setItem(`chat_list_${currentCommentSessionId}`, newChatList);
|
|
46050
|
+
}
|
|
46051
|
+
return newChatList;
|
|
46052
|
+
});
|
|
46053
|
+
setTimeout(() => {
|
|
46054
|
+
chatSubmit(userMessage.content);
|
|
46055
|
+
}, 100);
|
|
46056
|
+
}, [commentChatList, currentCommentSessionId, chatSubmit]);
|
|
45635
46057
|
const [updateChatVisible, setUpdateChatVisible] = useState(false);
|
|
45636
46058
|
const [chatToUpdate, setChatToUpdate] = useState();
|
|
45637
46059
|
const chatFormRef = createRef();
|
|
@@ -46108,6 +46530,9 @@ function CommentIndex({
|
|
|
46108
46530
|
chatSubmit,
|
|
46109
46531
|
themeMode,
|
|
46110
46532
|
agentApiKey: (_a3 = agentList.find((agent) => agent.id === selectedAgentId)) == null ? void 0 : _a3.apiKeys,
|
|
46533
|
+
likeMessage,
|
|
46534
|
+
dislikeMessage,
|
|
46535
|
+
regenerateMessage,
|
|
46111
46536
|
openingPrompts: (() => {
|
|
46112
46537
|
var _a5, _b3;
|
|
46113
46538
|
const sessionPrompts = currentCommentSession == null ? void 0 : currentCommentSession.openingPrompts;
|
|
@@ -46407,7 +46832,7 @@ const BlockEdit = ({
|
|
|
46407
46832
|
const initVueEditor = async () => {
|
|
46408
46833
|
if (editorRef.current) {
|
|
46409
46834
|
try {
|
|
46410
|
-
const BlockNoteEditorModule = await import("./index.es-
|
|
46835
|
+
const BlockNoteEditorModule = await import("./index.es-DD7ie9BT.js");
|
|
46411
46836
|
const BlockNoteEditor = BlockNoteEditorModule.BlockNoteEditor;
|
|
46412
46837
|
const theme = {
|
|
46413
46838
|
colors: {
|
|
@@ -47363,7 +47788,7 @@ const AiBlockEdit = ({
|
|
|
47363
47788
|
const initVueEditor = async () => {
|
|
47364
47789
|
if (editorRef.current) {
|
|
47365
47790
|
try {
|
|
47366
|
-
const BlockNoteEditorModule = await import("./index.es-
|
|
47791
|
+
const BlockNoteEditorModule = await import("./index.es-DD7ie9BT.js");
|
|
47367
47792
|
const BlockNoteEditor = BlockNoteEditorModule.BlockNoteEditor;
|
|
47368
47793
|
const theme = {
|
|
47369
47794
|
colors: {
|
|
@@ -48412,7 +48837,7 @@ class BasePromptTemplate extends Runnable {
|
|
|
48412
48837
|
return PromptTemplate2.deserialize({ ...data, _type: "prompt" });
|
|
48413
48838
|
}
|
|
48414
48839
|
case "few_shot": {
|
|
48415
|
-
const { FewShotPromptTemplate } = await import("./few_shot-
|
|
48840
|
+
const { FewShotPromptTemplate } = await import("./few_shot-CXrHoFil.js");
|
|
48416
48841
|
return FewShotPromptTemplate.deserialize(data);
|
|
48417
48842
|
}
|
|
48418
48843
|
default:
|
|
@@ -49984,35 +50409,35 @@ class BaseChain extends BaseLangChain {
|
|
|
49984
50409
|
static async deserialize(data, values = {}) {
|
|
49985
50410
|
switch (data._type) {
|
|
49986
50411
|
case "llm_chain": {
|
|
49987
|
-
const { LLMChain } = await import("./llm_chain-
|
|
50412
|
+
const { LLMChain } = await import("./llm_chain-BeI0W_p-.js");
|
|
49988
50413
|
return LLMChain.deserialize(data);
|
|
49989
50414
|
}
|
|
49990
50415
|
case "sequential_chain": {
|
|
49991
|
-
const { SequentialChain } = await import("./sequential_chain-
|
|
50416
|
+
const { SequentialChain } = await import("./sequential_chain-DOfqDL23.js");
|
|
49992
50417
|
return SequentialChain.deserialize(data);
|
|
49993
50418
|
}
|
|
49994
50419
|
case "simple_sequential_chain": {
|
|
49995
|
-
const { SimpleSequentialChain } = await import("./sequential_chain-
|
|
50420
|
+
const { SimpleSequentialChain } = await import("./sequential_chain-DOfqDL23.js");
|
|
49996
50421
|
return SimpleSequentialChain.deserialize(data);
|
|
49997
50422
|
}
|
|
49998
50423
|
case "stuff_documents_chain": {
|
|
49999
|
-
const { StuffDocumentsChain } = await import("./combine_docs_chain-
|
|
50424
|
+
const { StuffDocumentsChain } = await import("./combine_docs_chain-COuoBXN8.js");
|
|
50000
50425
|
return StuffDocumentsChain.deserialize(data);
|
|
50001
50426
|
}
|
|
50002
50427
|
case "map_reduce_documents_chain": {
|
|
50003
|
-
const { MapReduceDocumentsChain } = await import("./combine_docs_chain-
|
|
50428
|
+
const { MapReduceDocumentsChain } = await import("./combine_docs_chain-COuoBXN8.js");
|
|
50004
50429
|
return MapReduceDocumentsChain.deserialize(data);
|
|
50005
50430
|
}
|
|
50006
50431
|
case "refine_documents_chain": {
|
|
50007
|
-
const { RefineDocumentsChain } = await import("./combine_docs_chain-
|
|
50432
|
+
const { RefineDocumentsChain } = await import("./combine_docs_chain-COuoBXN8.js");
|
|
50008
50433
|
return RefineDocumentsChain.deserialize(data);
|
|
50009
50434
|
}
|
|
50010
50435
|
case "vector_db_qa": {
|
|
50011
|
-
const { VectorDBQAChain } = await import("./vector_db_qa-
|
|
50436
|
+
const { VectorDBQAChain } = await import("./vector_db_qa-DQnKfZL6.js");
|
|
50012
50437
|
return VectorDBQAChain.deserialize(data, values);
|
|
50013
50438
|
}
|
|
50014
50439
|
case "api_chain": {
|
|
50015
|
-
const { APIChain } = await import("./api_chain-
|
|
50440
|
+
const { APIChain } = await import("./api_chain-BdfZ6btS.js");
|
|
50016
50441
|
return APIChain.deserialize(data);
|
|
50017
50442
|
}
|
|
50018
50443
|
default:
|