Skip to content

Commit

Permalink
fix: some bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
dolphin0618 committed Dec 9, 2024
1 parent 7947b0c commit 024e6ff
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/frontend/public/locales/en/bs.json
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,7 @@
"10520": "Skill does not exist",
"10521": "Skill is online, cannot edit",
"10525": "Workflow is online and cannot be edited",
"10530": "Template name already exists",
"10900": "Knowledge base name already exists",
"10901": "Knowledge base must select an embedding model",
"10910": "Current knowledge base version does not support segment modification. Please create a new knowledge base to modify segments.",
Expand Down
1 change: 1 addition & 0 deletions src/frontend/public/locales/zh/bs.json
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,7 @@
"10520": "技能不存在",
"10521": "技能已上线,不可编辑",
"10525": "工作流已上线,不可编辑",
"10530": "模板名称已存在",
"10900": "知识库名称不可重复",
"10901": "知识库必须选择一个embedding模型",
"10910": "当前知识库版本不支持修改分段,请创建新知识库后进行分段修改",
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/components/bs-comp/apiComponent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const ApiMainPage = ({ type = API_TYPE.ASSISTANT }) => {
case 'no-login-link':
return <ChatLink noLogin type={type} />;
case 'login-link':
// return <ChatLink type={type} />;
return <ChatLink type={type} />;
default:
return <ApiAccess />;
}
Expand Down
8 changes: 8 additions & 0 deletions src/frontend/src/components/bs-icons/rbDrag/Drag.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/frontend/src/components/bs-icons/rbDrag/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React, { forwardRef } from "react";
import Drag from "./Drag.svg?react";

export const RbDragIcon = forwardRef<
SVGSVGElement & { className: any },
React.PropsWithChildren<{ className?: string }>
>(({ className, ...props }, ref) => {
return <Drag ref={ref} {...props} className={className || ''} />;
});
2 changes: 1 addition & 1 deletion src/frontend/src/controllers/API/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export async function readTempsDatabase(type, id?: number): Promise<FlowType[]>
}

/**
* 创建模板.
* 创建模板.(工作流\助手\技能)
*
* @param data {flow_id name description}
* @returns null.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,6 @@ export default function ChatMessages({ mark = false, logo, useName, guideWord, l
return <MessageBsChoose type='input' key={msg.message_id} data={msg} logo={logo} />;
case 'node_run':
return <MessageNodeRun key={msg.message_id} data={msg} />;
// case 'file':
// return <FileBs key={msg.id} data={msg} />;
// case 'runLog':
// return <RunLog key={msg.id} data={msg} />;
default:
return <div className="text-sm mt-2 border rounded-md p-2" key={msg.message_id}>Unknown message type</div>;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const handleHistoryMsg = (data: any[]): ChatMessageType[] => {
.replace(/\t/g, '\\t') // 转义制表符
.replace(/'/g, '"'); // 将单引号替换为双引号

return data.filter(item => ['answer', 'question', 'processing', 'system', 'report', 'tool', 'knowledge', 'divider', 'flow'].includes(item.category)).map(item => {
return data.filter(item => ["question", "output_input_msg", "output_choose_msg", "stream_msg", "output_msg", "guide_question", "guide_word", "user_input", "node_run"].includes(item.category)).map(item => {
let { message, files, is_bot, intermediate_steps, category, ...other } = item
try {
message = message && message[0] === '{' ? JSON.parse(message) : message || ''
Expand Down Expand Up @@ -170,6 +170,7 @@ export const useMessageStore = create<State & Actions>((set, get) => ({
})
},
async loadHistoryMsg(flowid, chatId, { lastMsg }) {
console.log('1234 :>> ', 1234);
const res = await getChatHistory(flowid, chatId, 30, 0)
const msgs = handleHistoryMsg(res)
const hisMessages = msgs.reverse()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { UploadCloud, Variable } from "lucide-react";
import { useEffect, useRef, useState } from "react";
import useFlowStore from "../../flowStore";
import SelectVar from "./SelectVar";
import { RbDragIcon } from "@/components/bs-icons/rbDrag";

// 解析富文本内容为保存格式
function parseToValue(input, flowNode) {
Expand Down Expand Up @@ -189,9 +190,9 @@ export default function VarInput({
></div>
{children}
<div
className="resize-handle w-4 h-4 bg-transparent absolute cursor-ns-resize right-0 bottom-0"
className="resize-handle w-4 h-4 bg-transparent absolute cursor-ns-resize right-0 bottom-0 rounded-ee-md overflow-hidden"
onMouseDown={handleMouseDown}
></div>
><RbDragIcon /></div>
</div>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/pages/BuildPage/flow/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export default function Sidebar({ dropdown = false, onInitStartNode = (node: any
</TooltipProvider>
</TabsContent>
{/* tool */}
<TabsContent value="tool" className="overflow-y-auto h-[calc(100vh-10rem)]">
<TabsContent value="tool" className="overflow-y-auto h-[calc(100vh-10rem)] max-w-44">
<Accordion type="multiple" className="w-full">
<TooltipProvider delayDuration={100}>
{toolTemps.map((temp, index) =>
Expand Down
15 changes: 14 additions & 1 deletion src/frontend/src/pages/BuildPage/skills/editSkill/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router-dom";
import TipPng from "@/assets/tip.jpg";

export default function Header({ flow }) {
export default function Header({ flow, onTabChange }) {
const navgate = useNavigate()
const { t } = useTranslation()
const { message } = useToast()
Expand Down Expand Up @@ -105,6 +105,7 @@ export default function Header({ flow }) {
}))
}

const [tabType, setTabType] = useState('edit')
return <div className="flex justify-between items-center border-b px-4">
{
loading && <div className=" fixed left-0 top-0 w-full h-screen bg-background/60 z-50 flex items-center justify-center">
Expand All @@ -131,6 +132,18 @@ export default function Header({ flow }) {
<Layers2 className="h-4 w-4 mr-1" />{t('skills.simplify')}
</Button>
</div>
{/* api */}
<div className="flex gap-4 items-center">
<div
className={`${tabType === 'edit' ? 'text-primary' : ''} hover:bg-border px-4 py-1 rounded-md cursor-pointer`}
onClick={() => { setTabType('edit'); onTabChange('edit') }}
>{t('api.skillOrchestration')}</div>
<div
className={`${tabType === 'api' ? 'text-primary' : ''} hover:bg-border px-4 py-1 rounded-md cursor-pointer`}
onClick={() => { setTabType('api'); onTabChange('api') }}
>{t('api.externalPublishing')}
</div>
</div>
{
version && <div className="flex gap-4">
<Button className="px-6 flex gap-2" type="button" onClick={handleSaveVersion}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ export default function Page({ flow, preFlow }: { flow: FlowType, preFlow: strin
</main>
</div>
<div className={`flex flex-1 min-h-0 overflow-hidden ${showApiPage ? '' : 'hidden'}`}>
<ApiMainPage type={'flow'} />
<ApiMainPage type={'skill'} />
</div>
{/* 删除确认 */}
<Dialog open={blocker.state === "blocked"}>
Expand Down
5 changes: 4 additions & 1 deletion src/frontend/src/pages/ChatAppPage/components/ChatPanne.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,13 @@ export default function ChatPanne({ customWsHost = '', appendHistory = false, da
setAssistant(null)
setFlow(null)
const _flow = await getFlowApi(id, version)
version === 'v1' ? loadFlowHistoryMsg(_flow.id, chatId, {
version === 'v1' ? await loadFlowHistoryMsg(_flow.id, chatId, {
lastMsg: '本轮会话已结束'
}).then(res =>
{
console.log('1234 :>> ', 1234);
setAutoRun(!res.length)
}
// setAutoRun()
) : clearMsgs()
const { data, ...f } = _flow
Expand Down

0 comments on commit 024e6ff

Please sign in to comment.