Skip to content

Commit

Permalink
Feat/0.3.3 (#739)
Browse files Browse the repository at this point in the history
  • Loading branch information
zgqgit committed Jul 10, 2024
2 parents 965180f + fc1ae56 commit 1812231
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 62 deletions.
4 changes: 2 additions & 2 deletions src/backend/bisheng/api/services/assistant_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,8 @@ async def react_run(self, query: str, chat_history: List = None, callback: Callb
'input': query,
'chat_history': chat_history
}, config=RunnableConfig(callbacks=callback))
print(result)
logger.debug(f"react_run result: {result}")
output = result['agent_outcome'].return_values['output']
if isinstance(output, dict):
output = output['text']
output = list(output.values())[0]
return [AIMessage(content=output)]
3 changes: 1 addition & 2 deletions src/backend/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

[tool.poetry]
name = "bisheng"
version = "0.3.3"
Expand Down Expand Up @@ -89,7 +88,7 @@ matplotlib = "3.8.4"
cchardet = "^2.1.7"
llama-index = "0.9.48"
tenacity = "<8.4.0"
bisheng-ragas = {version = "^1.0.0", source = "dataelem-index"}
bisheng-ragas = { version = "^1.0.0", source = "dataelem-index" }

[tool.poetry.dev-dependencies]
black = "^23.1.0"
Expand Down
2 changes: 1 addition & 1 deletion src/bisheng-langchain/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pydantic==1.10.13
pymupdf==1.23.8
shapely==2.0.2
filetype==1.2.0
langgraph==0.1.5
langgraph==0.0.50
openai==1.14.3
langchain-openai==0.1.0
llama-index==0.9.48
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ export default function ChatInput({ clear, form, stop, questions, inputForm, wsU
if (data.type === 'start') {
createWsMsg(data)
} else if (data.type === 'stream') {
//@ts-ignore
updateCurrentMessage({
chat_id: data.chat_id,
message: data.message,
Expand Down Expand Up @@ -256,7 +257,7 @@ export default function ChatInput({ clear, form, stop, questions, inputForm, wsU
{/* form */}
{
formShow && <div className="relative">
<div className="absolute left-0 border bottom-2 bg-[#fff] px-4 py-2 rounded-md w-[50%] min-w-80 z-50">
<div className="absolute left-0 border bottom-2 bg-background-login px-4 py-2 rounded-md w-[50%] min-w-80 z-50">
{inputForm}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function SkillTempSheet({ children, onSelect }) {
<SheetDescription>{t('skills.skillTemplateChoose')}</SheetDescription>
<SearchInput value={keyword} placeholder={t('build.search')} className="my-6" onChange={(e) => setKeyword(e.target.value)} />
</div>
<div className="flex-1 min-w-[696px] bg-[#fff] p-5 pt-12 h-full flex flex-wrap gap-1.5 overflow-y-auto scrollbar-hide content-start">
<div className="flex-1 min-w-[696px] bg-[#fff] dark:bg-[#030712] p-5 pt-12 h-full flex flex-wrap gap-1.5 overflow-y-auto scrollbar-hide content-start">
<CardComponent
id={0}
type="sheet"
Expand Down
24 changes: 23 additions & 1 deletion src/frontend/src/components/bs-ui/input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { cname } from "../utils"
import { SearchIcon } from "../../bs-icons/search"
import { generateUUID } from "../utils"
import { MinusCircledIcon } from "@radix-ui/react-icons"
import { EyeOpenIcon, EyeNoneIcon } from "@radix-ui/react-icons"
import { useState } from "react"

export interface InputProps
extends React.InputHTMLAttributes<HTMLInputElement> { }

Expand Down Expand Up @@ -36,6 +39,25 @@ const SearchInput = React.forwardRef<HTMLInputElement, InputProps & { inputClass
SearchInput.displayName = "SearchInput"


const PasswordInput = React.forwardRef<HTMLInputElement, InputProps & { inputClassName?: string, iconClassName?: string }>(
({ className, inputClassName, iconClassName, ...props }, ref) => {
const [type, setType] = useState('password')
const handleShowPwd = () => {
type === 'password' ? setType('text') : setType('password')
}
return <div className={cname("relative flex place-items-center", className)}>
<Input type={type} ref={ref} className={cname("pr-8 bg-search-input", inputClassName)} {...props}></Input>
{
type === 'password'
? <EyeNoneIcon onClick={handleShowPwd} className={cname("absolute right-2 text-gray-950 dark:text-gray-500 cursor-pointer", iconClassName)}/>
: <EyeOpenIcon onClick={handleShowPwd} className={cname("absolute right-2 text-gray-950 dark:text-gray-500 cursor-pointer", iconClassName)}/>
}
</div>
}
)

PasswordInput.displayName = 'PasswordInput'


/**
* 多行文本
Expand Down Expand Up @@ -144,4 +166,4 @@ const InputList = React.forwardRef<HTMLDivElement, InputProps & {
}
)

export { Input, SearchInput, Textarea, InputList }
export { Input, SearchInput, PasswordInput, Textarea, InputList }
5 changes: 2 additions & 3 deletions src/frontend/src/pages/LoginPage/UserPwdModal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Button } from "@/components/bs-ui/button";
import { Dialog, DialogClose, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/bs-ui/dialog";
import { Input } from "@/components/bs-ui/input";
import { PasswordInput } from "@/components/bs-ui/input";
import { forwardRef, useImperativeHandle, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
// import { resetUserPasswordApi } from "../controllers/API/user"; // 假设这是重置密码的API函数
Expand Down Expand Up @@ -66,11 +66,10 @@ const UserPwdModal = forwardRef<UserPwdModalRef, UserPwdModalProps>((props, ref)
<div className="flex flex-col gap-8 py-6">
<div>
<label htmlFor="password" className="bisheng-label">{t('resetPassword.newPassword')}<span className="bisheng-tip">*</span></label>
<Input
<PasswordInput
ref={passwordRef}
id="password"
name="password"
type="password"
placeholder={t('resetPassword.newPassword')}
className="mt-2"
onChange={(e) => passwordRef.current.value = e.target.value}
Expand Down
17 changes: 7 additions & 10 deletions src/frontend/src/pages/LoginPage/resetPwd.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useEffect, useRef } from "react";
import { useTranslation } from 'react-i18next';
import { useLocation, useNavigate } from 'react-router-dom';
import { Button } from "../../components/bs-ui/button";
import { Input } from "../../components/bs-ui/input";
import { PasswordInput } from "../../components/bs-ui/input";
import { loggedChangePasswordApi, changePasswordApi } from "../../controllers/API/user";
import { captureAndAlertRequestErrorHoc } from "../../controllers/request";
import { PWD_RULE, handleEncrypt } from './utils';
Expand Down Expand Up @@ -89,30 +89,27 @@ export const ResetPwdPage = () => {
</div>
<div className="grid gap-[12px] mt-[68px]">
<div className="grid">
<Input
<PasswordInput
id="currentPassword"
className='h-[48px] dark:bg-login-input'
inputClassName='h-[48px] dark:bg-login-input'
ref={currentPwdRef}
placeholder={t('resetPassword.currentPassword')}
type="password"
/>
</div>
<div className="grid">
<Input
<PasswordInput
id="newPassword"
className='h-[48px] dark:bg-login-input'
inputClassName='h-[48px] dark:bg-login-input'
ref={newPwdRef}
placeholder={t('resetPassword.newPassword')}
type="password"
/>
</div>
<div className="grid">
<Input
<PasswordInput
id="confirmNewPassword"
className='h-[48px] dark:bg-login-input'
inputClassName='h-[48px] dark:bg-login-input'
ref={confirmPwdRef}
placeholder={t('resetPassword.confirmNewPassword')}
type="password"
/>
</div>
<Button
Expand Down
25 changes: 5 additions & 20 deletions src/frontend/src/pages/SystemPage/components/CreateUser.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
import { Button } from "@/components/bs-ui/button"
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/bs-ui/dialog"
import { Input } from "@/components/bs-ui/input"
import { Input, PasswordInput } from "@/components/bs-ui/input"
import { Label } from "@/components/bs-ui/label"
import { useToast } from "@/components/bs-ui/toast/use-toast"
import { generateUUID } from "@/components/bs-ui/utils"
import { createUserApi } from "@/controllers/API/user"
import { captureAndAlertRequestErrorHoc } from "@/controllers/request"
import { handleEncrypt, PWD_RULE } from "@/pages/LoginPage/utils"
import { copyText } from "@/utils"
import { EyeNoneIcon, EyeOpenIcon, PlusIcon } from "@radix-ui/react-icons"
import { PlusIcon } from "@radix-ui/react-icons"
import { useState } from "react"
import { useTranslation } from "react-i18next"
import UserRoleItem from "./UserRoleItem"

enum inputType {
PASSWORD = 'password',
TEXT = 'text'
}
const EyeIconStyle = 'absolute right-7 cursor-pointer'

export default function CreateUser({open, onClose, onSave}) {
const { t } = useTranslation()
const { message } = useToast()
Expand Down Expand Up @@ -65,11 +59,6 @@ export default function CreateUser({open, onClose, onSave}) {
}))
}

const [type, setType] = useState(inputType.PASSWORD)
const handleShowPwd = () => {
type === inputType.PASSWORD ? setType(inputType.TEXT) : setType(inputType.PASSWORD)
}

return <Dialog open={open} onOpenChange={b => onClose(b)}>
<DialogContent className="sm:max-w-[625px]">
<DialogHeader>
Expand All @@ -79,16 +68,12 @@ export default function CreateUser({open, onClose, onSave}) {
<div>
<Label htmlFor="user" className="bisheng-label">{t('log.username')}</Label>
<Input id="user" value={form.user_name} onChange={(e) => setForm({...form, user_name:e.target.value})}
placeholder="后续使用此用户名进行登录,用户名不可修改" className="h-[50px]"/>
placeholder="后续使用此用户名进行登录,用户名不可修改" className="h-[48px]"/>
</div>
<div>
<Label htmlFor="password" className="bisheng-label">初始密码</Label>
<div className="flex place-items-center">
<Input type={type} id="password" value={form.password} placeholder="至少 8 个字符,必须包含大写字母、小写字母、数字和符号的组合"
onChange={(e) => setForm({...form, password:e.target.value})} className="h-[50px]"/>
{type === inputType.PASSWORD ? <EyeNoneIcon onClick={handleShowPwd} className={EyeIconStyle}/>
: <EyeOpenIcon onClick={handleShowPwd} className={EyeIconStyle}/>}
</div>
<PasswordInput id="password" value={form.password} placeholder="至少 8 个字符,必须包含大写字母、小写字母、数字和符号的组合"
onChange={(e) => setForm({...form, password:e.target.value})} inputClassName="h-[48px]"/>
</div>
<div className="flex flex-col gap-2">
<Label className="bisheng-label">用户组/角色选择</Label>
Expand Down
Loading

0 comments on commit 1812231

Please sign in to comment.