mirror of
https://github.com/FranP-code/ChatGPT.git
synced 2025-10-13 00:13:25 +00:00
fix: program exception when Awesome data is empty (#248)
This commit is contained in:
@@ -1,5 +1,11 @@
|
|||||||
# UPDATE LOG
|
# UPDATE LOG
|
||||||
|
|
||||||
|
## v0.10.1
|
||||||
|
|
||||||
|
Fix:
|
||||||
|
|
||||||
|
- Program exception when `Awesome` data is empty (https://github.com/lencx/ChatGPT/issues/248)
|
||||||
|
|
||||||
## v0.10.0
|
## v0.10.0
|
||||||
|
|
||||||
Fix:
|
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 originName = `${name}_origin`;
|
||||||
const isEnable = Form.useWatch(dashboardName, form);
|
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 (
|
return (
|
||||||
<>
|
<>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
@@ -74,18 +79,16 @@ const SwitchOrigin: FC<SwitchOriginProps> = ({ name }) => {
|
|||||||
name={originName}
|
name={originName}
|
||||||
>
|
>
|
||||||
<Select disabled={isEnable} showSearch {...DISABLE_AUTO_COMPLETE} optionLabelProp="url">
|
<Select disabled={isEnable} showSearch {...DISABLE_AUTO_COMPLETE} optionLabelProp="url">
|
||||||
{[{ title: 'ChatGPT', url: 'https://chat.openai.com', init: true }, ...list].map(
|
{urlList.map((i, idx) => (
|
||||||
(i, idx) => (
|
<Select.Option
|
||||||
<Select.Option
|
key={`${idx}_${i.url}`}
|
||||||
key={`${idx}_${i.url}`}
|
label={i.title}
|
||||||
label={i.title}
|
value={i.url}
|
||||||
value={i.url}
|
title={`${i.title}${i.init ? '(Built-in)' : ''}: ${i.url}`}
|
||||||
title={`${i.title}${i.init ? '(Built-in)' : ''}: ${i.url}`}
|
>
|
||||||
>
|
<Tag color={i.init ? 'orange' : 'geekblue'}>{i.title}</Tag> {i.url}
|
||||||
<Tag color={i.init ? 'orange' : 'geekblue'}>{i.title}</Tag> {i.url}
|
</Select.Option>
|
||||||
</Select.Option>
|
))}
|
||||||
),
|
|
||||||
)}
|
|
||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</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 {
|
.about-tab {
|
||||||
.imgs {
|
.imgs {
|
||||||
img {
|
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;
|
if (!json) return;
|
||||||
const categories = new Map();
|
const categories = new Map();
|
||||||
|
|
||||||
json?.forEach((i) => {
|
if (Array.isArray(json)) {
|
||||||
if (!i.enable) return;
|
json?.forEach((i) => {
|
||||||
if (!categories.has(i.category)) {
|
if (!i.enable) return;
|
||||||
categories.set(i.category, []);
|
if (!categories.has(i.category)) {
|
||||||
}
|
categories.set(i.category, []);
|
||||||
categories.get(i?.category).push(i);
|
}
|
||||||
});
|
categories.get(i?.category).push(i);
|
||||||
setList(Array.from(categories));
|
});
|
||||||
}, [json?.length]);
|
setList(Array.from(categories) || []);
|
||||||
|
} else {
|
||||||
|
setList([]);
|
||||||
|
}
|
||||||
|
}, [JSON.stringify(json)]);
|
||||||
|
|
||||||
const handleLink = async (item: Record<string, any>) => {
|
const handleLink = async (item: Record<string, any>) => {
|
||||||
await invoke('wa_window', {
|
await invoke('wa_window', {
|
||||||
|
|||||||
Reference in New Issue
Block a user