Commit 0c67f369 by 杨明

重新生成

1 parent e948cb6f
...@@ -24,6 +24,7 @@ type AnswerProps = { ...@@ -24,6 +24,7 @@ type AnswerProps = {
config?: ChatConfig; config?: ChatConfig;
answerIcon?: ReactNode; answerIcon?: ReactNode;
responding?: boolean; responding?: boolean;
isLast?: boolean;
showPromptLog?: boolean; showPromptLog?: boolean;
chatAnswerContainerInner?: string; chatAnswerContainerInner?: string;
hideProcessDetail?: boolean; hideProcessDetail?: boolean;
...@@ -39,6 +40,7 @@ const Answer: FC<AnswerProps> = ({ ...@@ -39,6 +40,7 @@ const Answer: FC<AnswerProps> = ({
answerIcon, answerIcon,
responding, responding,
showPromptLog, showPromptLog,
isLast,
chatAnswerContainerInner, chatAnswerContainerInner,
hideProcessDetail, hideProcessDetail,
appData, appData,
...@@ -119,6 +121,7 @@ const Answer: FC<AnswerProps> = ({ ...@@ -119,6 +121,7 @@ const Answer: FC<AnswerProps> = ({
maxSize={containerWidth - contentWidth - 4} maxSize={containerWidth - contentWidth - 4}
contentWidth={contentWidth} contentWidth={contentWidth}
item={item} item={item}
isLast={isLast}
question={question} question={question}
index={index} index={index}
showPromptLog={showPromptLog} showPromptLog={showPromptLog}
...@@ -188,37 +191,6 @@ const Answer: FC<AnswerProps> = ({ ...@@ -188,37 +191,6 @@ const Answer: FC<AnswerProps> = ({
showHitInfo={config?.supportCitationHitInfo} showHitInfo={config?.supportCitationHitInfo}
/> />
)} )}
{item.siblingCount &&
item.siblingCount > 1 &&
item.siblingIndex !== undefined && (
<div className="flex items-center justify-center pt-3.5 text-sm">
<button
className={`${
item.prevSibling ? "opacity-100" : "opacity-30"
}`}
disabled={!item.prevSibling}
onClick={() =>
item.prevSibling && switchSibling?.(item.prevSibling)
}
>
<ChevronRight className="h-[14px] w-[14px] rotate-180 text-text-primary" />
</button>
<span className="px-2 text-xs text-text-primary">
{item.siblingIndex + 1} / {item.siblingCount}
</span>
<button
className={`${
item.nextSibling ? "opacity-100" : "opacity-30"
}`}
disabled={!item.nextSibling}
onClick={() =>
item.nextSibling && switchSibling?.(item.nextSibling)
}
>
<ChevronRight className="h-[14px] w-[14px] text-text-primary" />
</button>
</div>
)}
</div> </div>
</div> </div>
<More more={more} /> <More more={more} />
......
...@@ -26,12 +26,14 @@ type OperationProps = { ...@@ -26,12 +26,14 @@ type OperationProps = {
index: number; index: number;
showPromptLog?: boolean; showPromptLog?: boolean;
maxSize: number; maxSize: number;
isLast?: boolean;
contentWidth: number; contentWidth: number;
hasWorkflowProcess: boolean; hasWorkflowProcess: boolean;
noChatInput?: boolean; noChatInput?: boolean;
}; };
const Operation: FC<OperationProps> = ({ const Operation: FC<OperationProps> = ({
item, item,
isLast,
question, question,
index, index,
showPromptLog, showPromptLog,
...@@ -75,6 +77,10 @@ const Operation: FC<OperationProps> = ({ ...@@ -75,6 +77,10 @@ const Operation: FC<OperationProps> = ({
await onFeedback?.(id, { rating }); await onFeedback?.(id, { rating });
setLocalFeedback({ rating }); setLocalFeedback({ rating });
Toast.notify({
type: "success",
message: "成功",
});
}; };
const operationWidth = useMemo(() => { const operationWidth = useMemo(() => {
...@@ -151,13 +157,13 @@ const Operation: FC<OperationProps> = ({ ...@@ -151,13 +157,13 @@ const Operation: FC<OperationProps> = ({
copy(content); copy(content);
Toast.notify({ Toast.notify({
type: "success", type: "success",
message: t("common.actionMsg.copySuccessfully"), message: "复制成功",
}); });
}} }}
> >
<RiClipboardLine className="h-4 w-4" /> <RiClipboardLine className="h-4 w-4" />
</ActionButton> </ActionButton>
{!noChatInput && ( {!noChatInput && isLast&& (
<ActionButton onClick={() => onRegenerate?.(item)}> <ActionButton onClick={() => onRegenerate?.(item)}>
<RiResetLeftLine className="h-4 w-4" /> <RiResetLeftLine className="h-4 w-4" />
</ActionButton> </ActionButton>
......
...@@ -271,6 +271,7 @@ const Chat: FC<ChatProps> = ({ ...@@ -271,6 +271,7 @@ const Chat: FC<ChatProps> = ({
{chatList.map((item, index) => { {chatList.map((item, index) => {
if (item.isAnswer) { if (item.isAnswer) {
const isLast = item.id === chatList[chatList.length - 1]?.id; const isLast = item.id === chatList[chatList.length - 1]?.id;
return ( return (
<Answer <Answer
appData={appData} appData={appData}
...@@ -280,6 +281,7 @@ const Chat: FC<ChatProps> = ({ ...@@ -280,6 +281,7 @@ const Chat: FC<ChatProps> = ({
index={index} index={index}
config={config} config={config}
answerIcon={answerIcon} answerIcon={answerIcon}
isLast={isLast}
responding={isLast && isResponding} responding={isLast && isResponding}
showPromptLog={showPromptLog} showPromptLog={showPromptLog}
chatAnswerContainerInner={chatAnswerContainerInner} chatAnswerContainerInner={chatAnswerContainerInner}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!