Compare commits

..

10 Commits

Author SHA1 Message Date
lencx
f0ff062b21 v0.10.1 2023-01-25 19:21:10 +08:00
lencx
ad722b09cf readme 2023-01-25 19:20:47 +08:00
lencx
d78f23d7e2 action 2023-01-25 19:19:13 +08:00
lencx
0c68599d35 fix: zoom level (#202) 2023-01-25 19:09:22 +08:00
lencx
ca171b7c1b fix: program exception when Awesome data is empty (#248) 2023-01-25 16:49:20 +08:00
lencx
7aa70c83de Merge branch 'main' into dev 2023-01-25 11:46:08 +08:00
lencx
585582244d readme 2023-01-25 10:32:19 +08:00
lencx
1c3b3c1f22 readme 2023-01-25 10:26:53 +08:00
lencx
db7a4f0b01 chore: fmt 2023-01-25 10:20:50 +08:00
lencx
655dda8efb Merge pull request #246 from lencx/dev 2023-01-25 03:08:32 +08:00
14 changed files with 176 additions and 74 deletions

View File

@@ -90,13 +90,13 @@ jobs:
publish_dir: ./updater
force_orphan: true
publish-winget:
# Action can only be run on windows
runs-on: windows-latest
needs: [create-release, build-tauri]
steps:
- uses: vedantmgoyal2009/winget-releaser@v1
with:
identifier: lencx.ChatGPT
token: ${{ secrets.WINGET_TOKEN }}
version: ${{ env.version }}
# publish-winget:
# # Action can only be run on windows
# runs-on: windows-latest
# needs: [create-release, build-tauri]
# steps:
# - uses: vedantmgoyal2009/winget-releaser@v1
# with:
# identifier: lencx.ChatGPT
# token: ${{ secrets.WINGET_TOKEN }}
# version: ${{ env.version }}

View File

@@ -24,7 +24,7 @@
### Windows
- [ChatGPT_0.10.0_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.10.0/ChatGPT_0.10.0_x64_en-US.msi):
- [ChatGPT_0.10.1_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.10.1/ChatGPT_0.10.1_x64_en-US.msi):
- 使用 [winget](https://winstall.app/apps/lencx.ChatGPT):
```bash
@@ -32,15 +32,15 @@
winget install --id=lencx.ChatGPT -e
# install the specified version
winget install --id=lencx.ChatGPT -e --version 0.9.0
winget install --id=lencx.ChatGPT -e --version 0.10.0
```
**注意:如果安装路径和应用名称相同,会导致冲突 ([#142](https://github.com/lencx/ChatGPT/issues/142#issuecomment-0.10.0))**
**注意:如果安装路径和应用名称相同,会导致冲突 ([#142](https://github.com/lencx/ChatGPT/issues/142#issuecomment-0.10.1))**
### Mac
- [ChatGPT_0.10.0_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.10.0/ChatGPT_0.10.0_x64.dmg)
- [ChatGPT.app.tar.gz](https://github.com/lencx/ChatGPT/releases/download/v0.10.0/ChatGPT.app.tar.gz)
- [ChatGPT_0.10.1_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.10.1/ChatGPT_0.10.1_x64.dmg)
- [ChatGPT.app.tar.gz](https://github.com/lencx/ChatGPT/releases/download/v0.10.1/ChatGPT.app.tar.gz)
- Homebrew \
_[Homebrew 快捷安装](https://brew.sh) ([Cask](https://docs.brew.sh/Cask-Cookbook)):_
```sh
@@ -56,8 +56,8 @@
### Linux
- [chat-gpt_0.10.0_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.10.0/chat-gpt_0.10.0_amd64.deb)
- [chat-gpt_0.10.0_amd64.AppImage](https://github.com/lencx/ChatGPT/releases/download/v0.10.0/chat-gpt_0.10.0_amd64.AppImage): **工作可靠,`.deb` 运行失败时可以尝试它**
- [chat-gpt_0.10.1_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.10.1/chat-gpt_0.10.1_amd64.deb)
- [chat-gpt_0.10.1_amd64.AppImage](https://github.com/lencx/ChatGPT/releases/download/v0.10.1/chat-gpt_0.10.1_amd64.AppImage): **工作可靠,`.deb` 运行失败时可以尝试它**
- 使用 [AUR](https://aur.archlinux.org/packages/chatgpt-desktop-bin):
```bash
yay -S chatgpt-desktop-bin
@@ -87,6 +87,7 @@
- 跨平台: `macOS` `Linux` `Windows`
- 导出 ChatGPT 聊天记录 (支持 PNG, PDF 和生成分享链接)
- 主窗口和系统托盘支持自定义 URL将任意网站包装成一个桌面应用
- 应用自动升级通知
- 丰富的快捷键
- 系统托盘悬浮窗
@@ -129,6 +130,7 @@
- `[.chatgpt]` - 应用配置根路径
- `chat.conf.json` - 应用喜好配置
- `chat.awesome.json` - 自定义 URL 列表,类似于浏览器书签。可以将任意 URL 作为主窗口或托盘窗口 (**Control Conter -> Awesome**)
- `chat.model.json` - ChatGPT 输入提示,通过斜杠命令来快速完成输入,主要包含三部分:
- `user_custom` - 需要手动录入 (**Control Conter -> Language Model -> User Custom**)
- `sync_prompts` - 从 [f/awesome-chatgpt-prompts](https://github.com/f/awesome-chatgpt-prompts) 同步数据 (**Control Conter -> Language Model -> Sync Prompts**)

View File

@@ -26,7 +26,7 @@
### Windows
- [ChatGPT_0.10.0_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.10.0/ChatGPT_0.10.0_x64_en-US.msi): Direct download installer
- [ChatGPT_0.10.1_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.10.1/ChatGPT_0.10.1_x64_en-US.msi): Direct download installer
- Use [winget](https://winstall.app/apps/lencx.ChatGPT):
```bash
@@ -34,15 +34,15 @@
winget install --id=lencx.ChatGPT -e
# install the specified version
winget install --id=lencx.ChatGPT -e --version 0.9.0
winget install --id=lencx.ChatGPT -e --version 0.10.0
```
**Note: If the installation path and application name are the same, it will lead to conflict ([#142](https://github.com/lencx/ChatGPT/issues/142#issuecomment-0.10.0))**
**Note: If the installation path and application name are the same, it will lead to conflict ([#142](https://github.com/lencx/ChatGPT/issues/142#issuecomment-0.10.1))**
### Mac
- [ChatGPT_0.10.0_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.10.0/ChatGPT_0.10.0_x64.dmg): Direct download installer
- [ChatGPT.app.tar.gz](https://github.com/lencx/ChatGPT/releases/download/v0.10.0/ChatGPT.app.tar.gz): Download the `.app` installer
- [ChatGPT_0.10.1_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.10.1/ChatGPT_0.10.1_x64.dmg): Direct download installer
- [ChatGPT.app.tar.gz](https://github.com/lencx/ChatGPT/releases/download/v0.10.1/ChatGPT.app.tar.gz): Download the `.app` installer
- Homebrew \
Or you can install with _[Homebrew](https://brew.sh) ([Cask](https://docs.brew.sh/Cask-Cookbook)):_
```sh
@@ -58,8 +58,8 @@
### Linux
- [chat-gpt_0.10.0_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.10.0/chat-gpt_0.10.0_amd64.deb): Download `.deb` installer, advantage small size, disadvantage poor compatibility
- [chat-gpt_0.10.0_amd64.AppImage](https://github.com/lencx/ChatGPT/releases/download/v0.10.0/chat-gpt_0.10.0_amd64.AppImage): Works reliably, you can try it if `.deb` fails to run
- [chat-gpt_0.10.1_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.10.1/chat-gpt_0.10.1_amd64.deb): Download `.deb` installer, advantage small size, disadvantage poor compatibility
- [chat-gpt_0.10.1_amd64.AppImage](https://github.com/lencx/ChatGPT/releases/download/v0.10.1/chat-gpt_0.10.1_amd64.AppImage): Works reliably, you can try it if `.deb` fails to run
- Available on [AUR](https://aur.archlinux.org/packages/chatgpt-desktop-bin) with the package name `chatgpt-desktop-bin`, and you can use your favourite AUR package manager to install it.
<!-- download end -->
@@ -90,6 +90,7 @@ You can look at **[awesome-chatgpt-prompts](https://github.com/f/awesome-chatgpt
- Multi-platform: `macOS` `Linux` `Windows`
- Export ChatGPT history (PNG, PDF and Markdown)
- The main window and system tray support custom URLs to wrap any website into a desktop application
- Automatic application upgrade notification
- Common shortcut keys
- System tray hover window
@@ -132,6 +133,7 @@ You can look at **[awesome-chatgpt-prompts](https://github.com/f/awesome-chatgpt
- `[.chatgpt]` - application configuration root folder
- `chat.conf.json` - preferences configuration
- `chat.awesome.json` - Custom URL lists, similar to browser bookmarks. Any URL can be used as the main window or tray window (**Control Conter -> Awesome**)
- `chat.model.json` - prompts configurationcontains three parts:
- `user_custom` - Requires manual data entry (**Control Conter -> Language Model -> User Custom**)
- `sync_prompts` - Synchronizing data from [f/awesome-chatgpt-prompts](https://github.com/f/awesome-chatgpt-prompts) (**Control Conter -> Language Model -> Sync Prompts**)

View File

@@ -1,5 +1,17 @@
# UPDATE LOG
## v0.10.1
Fix:
- Program exception when `Awesome` data is empty (https://github.com/lencx/ChatGPT/issues/248)
Feat:
- New shortcut key to change zoom level (30% - 200%), `+` or `-` 10% each time, `0` will be reset to 100% (https://github.com/lencx/ChatGPT/issues/202)
- Windows: `Ctrl +`, `Ctrl -`, `Ctrl 0`
- MacOS: `Cmd +`, `Cmd -`, `Cmd 0`
## v0.10.0
Fix:

View File

@@ -175,6 +175,12 @@ pub fn init() -> Menu {
.accelerator("CmdOrCtrl+Down"),
)
.add_native_item(MenuItem::Separator)
.add_item(
CustomMenuItem::new("zoom_0".to_string(), "Zoom to Actual Size").accelerator("CmdOrCtrl+0"),
)
.add_item(CustomMenuItem::new("zoom_out".to_string(), "Zoom Out").accelerator("CmdOrCtrl+-"))
.add_item(CustomMenuItem::new("zoom_in".to_string(), "Zoom In").accelerator("CmdOrCtrl+Plus"))
.add_native_item(MenuItem::Separator)
.add_item(
CustomMenuItem::new("reload".to_string(), "Refresh the Screen").accelerator("CmdOrCtrl+R"),
),
@@ -337,6 +343,9 @@ pub fn menu_handler(event: WindowMenuEvent<tauri::Wry>) {
// Window
"dalle2" => window::dalle2_window(&app, None, None, Some(false)),
// View
"zoom_0" => win.eval("window.__zoom0 && window.__zoom0()").unwrap(),
"zoom_out" => win.eval("window.__zoomOut && window.__zoomOut()").unwrap(),
"zoom_in" => win.eval("window.__zoomIn && window.__zoomIn()").unwrap(),
"reload" => win.eval("window.location.reload()").unwrap(),
"go_back" => win.eval("window.history.go(-1)").unwrap(),
"go_forward" => win.eval("window.history.go(1)").unwrap(),

View File

@@ -45,8 +45,6 @@ async function init() {
document.getElementsByTagName('html')[0].style['font-size'] = '70%';
}
if (__TAURI_METADATA__.__currentWindow.label !== 'core') return;
async function platform() {
return invoke('platform', {
__tauriModule: 'Os',
@@ -54,29 +52,31 @@ async function init() {
});
}
const _platform = await platform();
const chatConf = await invoke('get_chat_conf') || {};
if (/darwin/.test(_platform) && !chatConf.titlebar) {
const topStyleDom = document.createElement("style");
topStyleDom.innerHTML = `#chatgpt-app-window-top{position:fixed;top:0;z-index:999999999;width:100%;height:24px;background:transparent;cursor:grab;cursor:-webkit-grab;user-select:none;-webkit-user-select:none;}#chatgpt-app-window-top:active {cursor:grabbing;cursor:-webkit-grabbing;}`;
document.head.appendChild(topStyleDom);
const topDom = document.createElement("div");
topDom.id = "chatgpt-app-window-top";
document.body.appendChild(topDom);
if (__TAURI_METADATA__.__currentWindow.label !== 'tray') {
const _platform = await platform();
const chatConf = await invoke('get_chat_conf') || {};
if (/darwin/.test(_platform) && !chatConf.titlebar) {
const topStyleDom = document.createElement("style");
topStyleDom.innerHTML = `#chatgpt-app-window-top{position:fixed;top:0;z-index:999999999;width:100%;height:24px;background:transparent;cursor:grab;cursor:-webkit-grab;user-select:none;-webkit-user-select:none;}#chatgpt-app-window-top:active {cursor:grabbing;cursor:-webkit-grabbing;}`;
document.head.appendChild(topStyleDom);
const topDom = document.createElement("div");
topDom.id = "chatgpt-app-window-top";
document.body.appendChild(topDom);
if (window.location.host === 'chat.openai.com') {
const nav = document.body.querySelector('nav');
if (nav) {
const currentPaddingTop = parseInt(window.getComputedStyle(document.querySelector('nav'), null).getPropertyValue('padding-top').replace('px', ''), 10);
const navStyleDom = document.createElement("style");
navStyleDom.innerHTML = `nav{padding-top:${currentPaddingTop + topDom.clientHeight}px !important}`;
document.head.appendChild(navStyleDom);
if (window.location.host === 'chat.openai.com') {
const nav = document.body.querySelector('nav');
if (nav) {
const currentPaddingTop = parseInt(window.getComputedStyle(document.querySelector('nav'), null).getPropertyValue('padding-top').replace('px', ''), 10);
const navStyleDom = document.createElement("style");
navStyleDom.innerHTML = `nav{padding-top:${currentPaddingTop + topDom.clientHeight}px !important}`;
document.head.appendChild(navStyleDom);
}
}
}
topDom.addEventListener("mousedown", () => invoke("drag_window"));
topDom.addEventListener("touchstart", () => invoke("drag_window"));
topDom.addEventListener("dblclick", () => invoke("fullscreen"));
topDom.addEventListener("mousedown", () => invoke("drag_window"));
topDom.addEventListener("touchstart", () => invoke("drag_window"));
topDom.addEventListener("dblclick", () => invoke("fullscreen"));
}
}
document.addEventListener("click", (e) => {
@@ -98,9 +98,76 @@ async function init() {
}
});
window.__sync_prompts = async function() {
await invoke('sync_prompts', { time: Date.now() });
if (window.location.host === 'chat.openai.com') {
window.__sync_prompts = async function() {
await invoke('sync_prompts', { time: Date.now() });
}
}
coreZoom();
}
function coreZoom() {
const styleDom = document.createElement('style');
styleDom.innerHTML = `
#ZoomTopTip {
display: none;
position: fixed;
top: 0;
right: 20px;
background: #2a2a2a;
color: #fafafa;
padding: 20px 15px;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
font-size: 16px;
font-weight: bold;
z-index: 999999;
box-shadow: 0 2px 2px 2px #d8d8d8;
}
.ZoomTopTipAni {
transition: opacity 200ms, display 200ms;
display: none;
opacity: 0;
}
`;
document.head.append(styleDom);
const zoomTipDom = document.createElement('div');
zoomTipDom.id = 'ZoomTopTip';
document.body.appendChild(zoomTipDom);
function zoom(callback) {
if (window.zoomSetTimeout) clearTimeout(window.zoomSetTimeout);
const htmlZoom = window.localStorage.getItem("htmlZoom") || "100%";
const html = document.getElementsByTagName("html")[0];
const zoom = callback(htmlZoom);
html.style.zoom = zoom;
window.localStorage.setItem("htmlZoom", zoom);
zoomTipDom.innerHTML = zoom;
zoomTipDom.style.display = 'block';
zoomTipDom.classList.remove('ZoomTopTipAni');
window.zoomSetTimeout = setTimeout(() => {
zoomTipDom.classList.add('ZoomTopTipAni');
}, 2500);
}
function zoomDefault() {
const htmlZoom = window.localStorage.getItem("htmlZoom");
if (htmlZoom) {
document.getElementsByTagName("html")[0].style.zoom = htmlZoom;
}
}
function zoomIn() {
zoom((htmlZoom) => `${Math.min(parseInt(htmlZoom) + 10, 200)}%`);
}
function zoomOut() {
zoom((htmlZoom) => `${Math.max(parseInt(htmlZoom) - 10, 30)}%`);
}
function zoom0() {
zoom(() => `100%`);
}
zoomDefault();
window.__zoomIn = zoomIn;
window.__zoomOut = zoomOut;
window.__zoom0 = zoom0;
}
if (

View File

@@ -7,7 +7,7 @@
},
"package": {
"productName": "ChatGPT",
"version": "0.10.0"
"version": "0.10.1"
},
"tauri": {
"allowlist": {

View File

@@ -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>
</>

View File

@@ -7,6 +7,10 @@
}
}
.markdown-body {
background-color: unset;
}
.about-tab {
.imgs {
img {

View File

@@ -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', {

View File

@@ -12,7 +12,7 @@ import { chatRoot, fmtDate } from '@/utils';
import { modelColumns } from './config';
import UserCustomForm from './Form';
export default function LanguageModel() {
export default function UserCustom() {
const { rowSelection, selectedRowIDs } = useTableRowSelection();
const [isVisible, setVisible] = useState(false);
const [jsonPath, setJsonPath] = useState('');

View File

@@ -67,6 +67,5 @@ const RenderPath = ({ row }: any) => {
};
export const getPath = async (row: any) => {
const isImg = ['png'].includes(row?.ext);
return (await path.join(await chatRoot(), 'notes', row.id)) + `.${row.ext}`;
};

View File

@@ -30,7 +30,7 @@ const PopupSearchLabel = () => {
);
};
export default function General() {
export default function MainWindow() {
return (
<>
<Form.Item label={<PopupSearchLabel />} name="popup_search" valuePropName="checked">

View File

@@ -17,7 +17,7 @@ const UALabel = () => {
);
};
export default function General() {
export default function TrayWindow() {
return (
<>
<Form.Item label="Enable SystemTray" name="tray" valuePropName="checked">