mirror of
https://github.com/lencx/ChatGPT.git
synced 2024-10-01 01:06:13 -04:00
fix: program exception when Awesome data is empty (#248)
This commit is contained in:
parent
7aa70c83de
commit
ca171b7c1b
@ -1,5 +1,11 @@
|
||||
# UPDATE LOG
|
||||
|
||||
## v0.10.1
|
||||
|
||||
Fix:
|
||||
|
||||
- Program exception when `Awesome` data is empty (https://github.com/lencx/ChatGPT/issues/248)
|
||||
|
||||
## v0.10.0
|
||||
|
||||
Fix:
|
||||
|
27
src/components/SwitchOrigin/index.tsx
vendored
27
src/components/SwitchOrigin/index.tsx
vendored
@ -18,6 +18,11 @@ const SwitchOrigin: FC<SwitchOriginProps> = ({ name }) => {
|
||||
const originName = `${name}_origin`;
|
||||
const isEnable = Form.useWatch(dashboardName, form);
|
||||
|
||||
let urlList = [{ title: 'ChatGPT', url: 'https://chat.openai.com', init: true }];
|
||||
if (Array.isArray(list)) {
|
||||
urlList = urlList.concat(list);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Form.Item
|
||||
@ -74,18 +79,16 @@ const SwitchOrigin: FC<SwitchOriginProps> = ({ name }) => {
|
||||
name={originName}
|
||||
>
|
||||
<Select disabled={isEnable} showSearch {...DISABLE_AUTO_COMPLETE} optionLabelProp="url">
|
||||
{[{ title: 'ChatGPT', url: 'https://chat.openai.com', init: true }, ...list].map(
|
||||
(i, idx) => (
|
||||
<Select.Option
|
||||
key={`${idx}_${i.url}`}
|
||||
label={i.title}
|
||||
value={i.url}
|
||||
title={`${i.title}${i.init ? '(Built-in)' : ''}: ${i.url}`}
|
||||
>
|
||||
<Tag color={i.init ? 'orange' : 'geekblue'}>{i.title}</Tag> {i.url}
|
||||
</Select.Option>
|
||||
),
|
||||
)}
|
||||
{urlList.map((i, idx) => (
|
||||
<Select.Option
|
||||
key={`${idx}_${i.url}`}
|
||||
label={i.title}
|
||||
value={i.url}
|
||||
title={`${i.title}${i.init ? '(Built-in)' : ''}: ${i.url}`}
|
||||
>
|
||||
<Tag color={i.init ? 'orange' : 'geekblue'}>{i.title}</Tag> {i.url}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
</>
|
||||
|
4
src/view/about/index.scss
vendored
4
src/view/about/index.scss
vendored
@ -7,6 +7,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
.markdown-body {
|
||||
background-color: unset;
|
||||
}
|
||||
|
||||
.about-tab {
|
||||
.imgs {
|
||||
img {
|
||||
|
22
src/view/dashboard/index.tsx
vendored
22
src/view/dashboard/index.tsx
vendored
@ -29,15 +29,19 @@ export default function Dashboard() {
|
||||
if (!json) return;
|
||||
const categories = new Map();
|
||||
|
||||
json?.forEach((i) => {
|
||||
if (!i.enable) return;
|
||||
if (!categories.has(i.category)) {
|
||||
categories.set(i.category, []);
|
||||
}
|
||||
categories.get(i?.category).push(i);
|
||||
});
|
||||
setList(Array.from(categories));
|
||||
}, [json?.length]);
|
||||
if (Array.isArray(json)) {
|
||||
json?.forEach((i) => {
|
||||
if (!i.enable) return;
|
||||
if (!categories.has(i.category)) {
|
||||
categories.set(i.category, []);
|
||||
}
|
||||
categories.get(i?.category).push(i);
|
||||
});
|
||||
setList(Array.from(categories) || []);
|
||||
} else {
|
||||
setList([]);
|
||||
}
|
||||
}, [JSON.stringify(json)]);
|
||||
|
||||
const handleLink = async (item: Record<string, any>) => {
|
||||
await invoke('wa_window', {
|
||||
|
Loading…
Reference in New Issue
Block a user