style: sop样式调整

This commit is contained in:
dolphin
2025-08-12 12:15:20 +08:00
parent c71994a507
commit c4b66c4e21
7 changed files with 79 additions and 78 deletions
@@ -86,7 +86,7 @@ function ChatView({ index = 0 }: { index?: number }) {
window.open(`${__APP_ENV__.BASE_URL}/linsight/${caseId}`)
}
const selfHost = location.host.indexOf('bisheng') !== -1;
const selfHost = false; // location.host.indexOf('bisheng') !== -1;
return (
<ChatFormProvider {...methods}>
@@ -208,7 +208,7 @@ export default function SopToolsDown({
<div className="truncate">{child.label}</div>
</TooltipTrigger>
<TooltipContent>
<p>{child.desc}</p>
<p className="break-all max-w-96">{child.desc}</p>
</TooltipContent>
</Tooltip>
) : (
@@ -32,7 +32,7 @@ export const ThemeProvider = ({ initialTheme, children }) => {
const rawSetTheme = (rawTheme: string) => {
const root = window.document.documentElement;
const darkMode = isDark(rawTheme);
const darkMode = false // isDark(rawTheme);
root.classList.remove(darkMode ? 'light' : 'dark');
root.classList.add(darkMode ? 'dark' : 'light');
+1
View File
@@ -121,6 +121,7 @@ export const normalizeLayout = (layout: number[]) => {
export const playDing = () => {
// 1. 创建音频元素
const audio = new Audio(__APP_ENV__.BASE_URL + '/assets/ding.wav');
audio.volume = 0.5; // 50%音量
// 2. 播放音频
audio.play().catch(error => {
+2 -1
View File
@@ -23,7 +23,8 @@ export const applyFontSize = (val: string) => {
export const getInitialTheme = () => {
if (typeof window !== 'undefined' && window.localStorage) {
const storedPrefs = window.localStorage.getItem('color-theme') || 'light';
// const storedPrefs = window.localStorage.getItem('color-theme') || 'light';
const storedPrefs = 'light';
if (typeof storedPrefs === 'string') {
return storedPrefs;
}
@@ -740,20 +740,19 @@ export default function index({ formData: parentFormData, setFormData: parentSet
});
}
if (res.status_code !== 11010) {
if (res?.repeat_name) {
console.log(1111);
const formData = new FormData();
const formData = new FormData();
formData.append('file', importFiles[0]);
formData.append('file', importFiles[0]);
formData.append('ignore_error', 'false');
formData.append('override', 'false');
formData.append('save_new', 'false');
const res = await sopApi.UploadSopRecord(formData);
formData.append('ignore_error', 'false');
formData.append('override', 'false');
formData.append('save_new', 'false');
const res = await sopApi.UploadSopRecord(formData);
console.log(res, res?.repeat_name);
console.log(res, res?.repeat_name);
setImportDialogOpen(true)
setDuplicateNames(res?.repeat_name);
setDuplicateDialogOpen(true);
@@ -815,7 +814,7 @@ export default function index({ formData: parentFormData, setFormData: parentSet
<FormInput
label="输入框提示语"
value={formData.linsightConfig?.input_placeholder}
placeholder="请输入你的任务目标,然后交给 BISHENG 灵思"
placeholder="灵思是一位擅长完成复杂任务的Agent助理,除了描述任务目标外,您还可以用通俗的语言描述希望如何实现,这将有助于得到符合您预期的结果~"
maxLength={100}
onChange={(v) => {
setFormData(prev => ({
@@ -140,22 +140,22 @@ export default function index({ formData: parentFormData, setFormData: parentSet
// 非admin角色跳走
const { user } = useContext(userContext);
const navigate = useNavigate()
const [open, setOpen] = useState(false);
const [open, setOpen] = useState(false);
useEffect(() => {
if (user.user_id && user.role !== 'admin') {
navigate('/build/apps')
}
}, [user])
useEffect(() => {
if (!parentFormData) {
if (!parentFormData) {
console.log("parentFormData is null", parentFormData);
getWorkstationConfigApi().then(res => {
setWebSearchData(res.webSearch)
setFormData(res)
})
}
getWorkstationConfigApi().then(res => {
setWebSearchData(res.webSearch)
setFormData(res)
})
}
}, [])
const uploadAvator = (fileUrl: string, type: 'sidebar' | 'assistant', relativePath?: string) => {
setFormData(prev => ({
@@ -164,19 +164,19 @@ export default function index({ formData: parentFormData, setFormData: parentSet
}));
};
const handleWebSearchSave = async (config) => {
const res = await getAssistantToolsApi('default');
console.log(res, 222);
const webSearchTool = res.find(tool => tool.name === "联网搜索");
if (!webSearchTool) {
console.error("Web search tool not found");
return;
}
const toolId = webSearchTool.id;
setWebSearchData(config);
const res = await getAssistantToolsApi('default');
console.log(res, 222);
const webSearchTool = res.find(tool => tool.name === "联网搜索");
if (!webSearchTool) {
console.error("Web search tool not found");
return;
}
const toolId = webSearchTool.id;
setWebSearchData(config);
setFormData(prev => ({ ...prev, webSearch: config }));
await updateAssistantToolApi(toolId, config);
setWebSearchDialogOpen(false)
setWebSearchDialogOpen(false)
}
const handleModelChange = (index: number, id: string) => {
const newModels = [...formData.models];
@@ -196,31 +196,31 @@ export default function index({ formData: parentFormData, setFormData: parentSet
models: [...prev.models, { key: generateUUID(4), id: '', name: '', displayName: '' }]
}));
};
const handleOpenWebSearchSettings = () => {
const handleOpenWebSearchSettings = () => {
setWebSearchDialogOpen(true);
};
// 在父组件中添加这个方法
const handleWebSearchChange = useCallback((field: string, value: any) => {
console.log('更新字段:', field, '新值:', value);
// 更新本地状态
setFormData(prev => ({
...prev,
webSearch: {
...prev.webSearch,
const handleWebSearchChange = useCallback((field: string, value: any) => {
console.log('更新字段:', field, '新值:', value);
// 更新本地状态
setFormData(prev => ({
...prev,
webSearch: {
...prev.webSearch,
[field]: value
}
}));
// 同时更新全局状态 (zustand)
setWebSearchData(prev => ({
...prev,
[field]: value
}
}));
// 同时更新全局状态 (zustand)
setWebSearchData(prev => ({
...prev,
[field]: value
}));
}, [setFormData, setWebSearchData]); // 添加依赖项
}));
}, [setFormData, setWebSearchData]); // 添加依赖项
return (
<div className=" h-full overflow-y-scroll scrollbar-hide relative border-t">
<div className="pt-4 relative">
<div className="pt-4 relative">
<CardContent className="pt-4 relative ">
<div className="w-full max-h-[calc(100vh-180px)] overflow-y-scroll scrollbar-hide">
<ToggleSection
@@ -355,7 +355,7 @@ const handleWebSearchChange = useCallback((field: string, value: any) => {
</Select>
</div>
</ToggleSection> */}
<ToggleSection
<ToggleSection
title="联网搜索"
enabled={formData.webSearch.enabled}
onToggle={(enabled) => toggleFeature('webSearch', enabled)}
@@ -370,10 +370,10 @@ const handleWebSearchChange = useCallback((field: string, value: any) => {
</Button>
}
>
{console.log(1111,webSearchData, formData.webSearch.prompt)}
{console.log(1111, webSearchData, formData.webSearch.prompt)}
<WebSearchConfig
config={ formData.webSearch.prompt}
onChange={handleWebSearchChange}
config={formData.webSearch.prompt}
onChange={handleWebSearchChange}
/>
</ToggleSection>
<ToggleSection
@@ -421,13 +421,13 @@ const handleWebSearchChange = useCallback((field: string, value: any) => {
</div>
</CardContent>
</div>
<Dialog open={webSearchDialogOpen} onOpenChange={setWebSearchDialogOpen}>
<Dialog open={webSearchDialogOpen} onOpenChange={setWebSearchDialogOpen}>
<DialogContent className="sm:max-w-[625px] bg-background-login">
<DialogHeader>
<DialogTitle></DialogTitle>
</DialogHeader>
<WebSearchForm
prompt={ formData.webSearch.prompt}
prompt={formData.webSearch.prompt}
enabled={formData.webSearch.enabled}
formData={formData.webSearch}
onSubmit={handleWebSearchSave}
@@ -451,7 +451,7 @@ interface UseChatConfigProps {
}
const useChatConfig = (refs: UseChatConfigProps, parentFormData, parentSetFormData) => {
const [formData, setFormData] = useState<ChatConfigForm>( parentFormData ||{
const [formData, setFormData] = useState<ChatConfigForm>(parentFormData || {
menuShow: true,
systemPrompt: '你是毕昇 AI 助手',
sidebarIcon: { enabled: true, image: '', relative_path: '' },
@@ -496,15 +496,15 @@ const useChatConfig = (refs: UseChatConfigProps, parentFormData, parentSetFormDa
{question}`,
},
});
useEffect(() => {
if (parentFormData) {
setFormData(parentFormData);
}
}, [parentFormData]);
useEffect(() => {
if (parentFormData) {
setFormData(parentFormData);
}
}, [parentFormData]);
useEffect(() => {
parentSetFormData?.(formData);
}, [formData]);
useEffect(() => {
parentSetFormData?.(formData);
}, [formData]);
// const sidebarSloganRef = useRef<HTMLDivElement>(null);
// const welcomeMessageRef = useRef<HTMLDivElement>(null);
@@ -517,16 +517,16 @@ const useChatConfig = (refs: UseChatConfigProps, parentFormData, parentSetFormDa
useEffect(() => {
if (!parentFormData) {
console.log('parentFormData :>> ', parentFormData);
getWorkstationConfigApi().then((res) => {
// res.webSearch.params = {
// api_key: '',
// base_url: 'https://api.bing.microsoft.com/v7.0/search'
// }
res && setFormData(res);
})
getWorkstationConfigApi().then((res) => {
// res.webSearch.params = {
// api_key: '',
// base_url: 'https://api.bing.microsoft.com/v7.0/search'
// }
res && setFormData(res);
})
}
}, [])
const [errors, setErrors] = useState<FormErrors>({
@@ -604,7 +604,7 @@ const useChatConfig = (refs: UseChatConfigProps, parentFormData, parentSetFormDa
isValid = false;
}
if (formData.systemPrompt.length > 30000) {
if (formData.systemPrompt?.length > 30000) {
newErrors.systemPrompt = '最多30000个字符';
if (!firstErrorRef) firstErrorRef = refs.systemPromptRef;
isValid = false;