1
0
mirror of https://github.com/lencx/ChatGPT.git synced 2024-10-01 01:06:13 -04:00

fix: unable to synchronize

This commit is contained in:
lencx 2022-12-24 21:05:51 +08:00
parent 413d3354c7
commit 05057d06ad
6 changed files with 31 additions and 8 deletions

View File

@ -1,6 +1,6 @@
# UPDATE LOG # UPDATE LOG
## v0.6.5 ## v0.6.6
fix: unable to synchronize fix: unable to synchronize

View File

@ -1,4 +1,4 @@
use crate::{conf::ChatConfJson, utils}; use crate::{conf::ChatConfJson, utils::{self, exists}};
use std::{collections::HashMap, fs, path::PathBuf}; use std::{collections::HashMap, fs, path::PathBuf};
use tauri::{api, command, AppHandle, Manager}; use tauri::{api, command, AppHandle, Manager};
@ -151,6 +151,13 @@ pub fn sync_prompts(app: AppHandle, data: String, time: u64) {
let model_cmd = chat_root().join("chat.model.cmd.json"); let model_cmd = chat_root().join("chat.model.cmd.json");
let chatgpt_prompts = chat_root().join("cache_model").join("chatgpt_prompts.json"); let chatgpt_prompts = chat_root().join("cache_model").join("chatgpt_prompts.json");
if !exists(&model) {
fs::write(&model, serde_json::json!({
"name": "ChatGPT Model",
"link": "https://github.com/lencx/ChatGPT"
}).to_string()).unwrap();
}
// chatgpt_prompts.json // chatgpt_prompts.json
fs::write( fs::write(
chatgpt_prompts, chatgpt_prompts,

View File

@ -5,11 +5,11 @@ pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>
let chat_conf = ChatConfJson::get_chat_conf(); let chat_conf = ChatConfJson::get_chat_conf();
let url = chat_conf.origin.to_string(); let url = chat_conf.origin.to_string();
let theme = ChatConfJson::theme(); let theme = ChatConfJson::theme();
// let handle = app.app_handle(); let handle = app.app_handle();
// std::thread::spawn(move || { std::thread::spawn(move || {
// window::tray_window(&handle); window::tray_window(&handle);
// }); });
if chat_conf.hide_dock_icon { if chat_conf.hide_dock_icon {
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]

View File

@ -34,7 +34,7 @@ pub fn control_window(handle: &tauri::AppHandle) {
std::thread::spawn(move || { std::thread::spawn(move || {
WindowBuilder::new(&app, "main", WindowUrl::App("index.html".into())) WindowBuilder::new(&app, "main", WindowUrl::App("index.html".into()))
.title("ChatGPT") .title("ChatGPT")
.resizable(false) .resizable(true)
.fullscreen(false) .fullscreen(false)
.inner_size(800.0, 600.0) .inner_size(800.0, 600.0)
.min_inner_size(800.0, 600.0) .min_inner_size(800.0, 600.0)

View File

@ -22,7 +22,9 @@
"fs": { "fs": {
"all": true, "all": true,
"scope": [ "scope": [
"*" "*",
"$HOME/.chatgpt/*",
"$HOME/.chatgpt/cache_sync/*"
] ]
} }
}, },

14
src/main.scss vendored
View File

@ -45,6 +45,12 @@ html, body {
} }
} }
.chat-table-tip {
> span {
line-height: 16px;
}
}
.chat-sync-path { .chat-sync-path {
font-size: 12px; font-size: 12px;
font-weight: 500; font-weight: 500;
@ -52,6 +58,14 @@ html, body {
margin-bottom: 5px; margin-bottom: 5px;
line-height: 16px; line-height: 16px;
> div {
max-width: 400px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: #2a2a2a;
}
span { span {
display: inline-block; display: inline-block;
// background-color: #d8d8d8; // background-color: #d8d8d8;