From a6bd84268fb05ae5f72441c9850443aa19fc45e1 Mon Sep 17 00:00:00 2001 From: Sam Willis Date: Wed, 31 Jan 2024 22:49:58 +0000 Subject: [PATCH 1/3] Links open default browser --- examples/tauri-postgres/src-tauri/Cargo.lock | 74 +++++++++++++++++++ examples/tauri-postgres/src-tauri/Cargo.toml | 2 +- .../tauri-postgres/src-tauri/tauri.conf.json | 3 +- .../src/components/LeftMenu.tsx | 6 +- .../src/components/ProfileMenu.tsx | 5 +- 5 files changed, 86 insertions(+), 4 deletions(-) diff --git a/examples/tauri-postgres/src-tauri/Cargo.lock b/examples/tauri-postgres/src-tauri/Cargo.lock index 76a0b74b8b..4fa71787e8 100644 --- a/examples/tauri-postgres/src-tauri/Cargo.lock +++ b/examples/tauri-postgres/src-tauri/Cargo.lock @@ -2743,6 +2743,16 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "open" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2078c0039e6a54a0c42c28faa984e115fb4c2d5bf2208f77d1961002df8576f8" +dependencies = [ + "pathdiff", + "windows-sys 0.42.0", +] + [[package]] name = "openssl" version = "0.10.62" @@ -2920,6 +2930,12 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +[[package]] +name = "pathdiff" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + [[package]] name = "pbkdf2" version = "0.11.0" @@ -4757,6 +4773,7 @@ dependencies = [ "ignore", "objc", "once_cell", + "open", "os_pipe", "percent-encoding", "rand 0.8.5", @@ -5837,6 +5854,21 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ee5e275231f07c6e240d14f34e1b635bf1faa1c76c57cfd59a5cdb9848e4278" +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -5900,6 +5932,12 @@ dependencies = [ "windows-targets 0.52.0", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -5918,6 +5956,12 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec7711666096bd4096ffa835238905bb33fb87267910e154b18b44eaabb340f2" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -5936,6 +5980,12 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "763fc57100a5f7042e3057e7e8d9bdd7860d330070251a73d003563a3bb49e1b" +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -5954,6 +6004,12 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7bc7cbfe58828921e10a9f446fcaaf649204dcfe6c1ddd712c5eebae6bda1106" +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -5972,6 +6028,12 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6868c165637d653ae1e8dc4d82c25d4f97dd6605eaa8d784b5c6e0ab2a252b65" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -5984,6 +6046,12 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -6002,6 +6070,12 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e4d40883ae9cae962787ca76ba76390ffa29214667a111db9e0a1ad8377e809" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" diff --git a/examples/tauri-postgres/src-tauri/Cargo.toml b/examples/tauri-postgres/src-tauri/Cargo.toml index 619c9fd81b..9a09dc0f79 100644 --- a/examples/tauri-postgres/src-tauri/Cargo.toml +++ b/examples/tauri-postgres/src-tauri/Cargo.toml @@ -17,7 +17,7 @@ tauri-build = { version = "1.4.0", features = [] } [dependencies] serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } -tauri = { version = "1.4.0", features = [ "shell-sidecar", "devtools"] } +tauri = { version = "1.4.0", features = [ "shell-open", "shell-sidecar", "devtools"] } sqlx = { version = "0.7.0", features = ["runtime-tokio", "postgres"] } tokio = { version = "1.29.1", features = ["full"] } log = "0.4.19" diff --git a/examples/tauri-postgres/src-tauri/tauri.conf.json b/examples/tauri-postgres/src-tauri/tauri.conf.json index 6819e1f7aa..6c0a85e698 100644 --- a/examples/tauri-postgres/src-tauri/tauri.conf.json +++ b/examples/tauri-postgres/src-tauri/tauri.conf.json @@ -17,7 +17,8 @@ "scope": [ { "name": "ollama", "sidecar": true } ], - "sidecar": true + "sidecar": true, + "open": true } }, "bundle": { diff --git a/examples/tauri-postgres/src/components/LeftMenu.tsx b/examples/tauri-postgres/src/components/LeftMenu.tsx index b5a40987ce..d77bd616e1 100644 --- a/examples/tauri-postgres/src/components/LeftMenu.tsx +++ b/examples/tauri-postgres/src/components/LeftMenu.tsx @@ -149,7 +149,11 @@ function LeftMenu() { {/* bottom group */}
- + {' '} ElectricSQL diff --git a/examples/tauri-postgres/src/components/ProfileMenu.tsx b/examples/tauri-postgres/src/components/ProfileMenu.tsx index 01c79a8394..5244beb53c 100644 --- a/examples/tauri-postgres/src/components/ProfileMenu.tsx +++ b/examples/tauri-postgres/src/components/ProfileMenu.tsx @@ -60,18 +60,21 @@ export default function ProfileMenu({ Visit ElectricSQL Documentation GitHub From 918da00554803bda827a153ab8e6e07facb27c36 Mon Sep 17 00:00:00 2001 From: Sam Willis Date: Wed, 31 Jan 2024 23:09:04 +0000 Subject: [PATCH 2/3] Fix sort --- examples/tauri-postgres/src/pages/List/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tauri-postgres/src/pages/List/index.tsx b/examples/tauri-postgres/src/pages/List/index.tsx index e1b012da00..785260e6a0 100644 --- a/examples/tauri-postgres/src/pages/List/index.tsx +++ b/examples/tauri-postgres/src/pages/List/index.tsx @@ -24,7 +24,7 @@ function List({ showSearch = false }) { kanbanorder: true, username: true, }, - ...(filterState.searchType !== "vector" + ...(!useVectorSearch ? { orderBy: { [filterState.orderBy]: filterState.orderDirection }, } From 046289bfff0dfafa53c8f73440407ccb1987e7b2 Mon Sep 17 00:00:00 2001 From: Sam Willis Date: Wed, 31 Jan 2024 23:36:11 +0000 Subject: [PATCH 3/3] Add 'Referenced Issues' to chat --- .../tauri-postgres/src/pages/Chat/index.tsx | 56 +++++++++++++++---- 1 file changed, 44 insertions(+), 12 deletions(-) diff --git a/examples/tauri-postgres/src/pages/Chat/index.tsx b/examples/tauri-postgres/src/pages/Chat/index.tsx index f312eda5be..fb6b2a007c 100644 --- a/examples/tauri-postgres/src/pages/Chat/index.tsx +++ b/examples/tauri-postgres/src/pages/Chat/index.tsx @@ -13,6 +13,7 @@ function Chat() { const [question, setQuestion] = useState(""); const [answer, setAnswer] = useState([]); const [working, setWorking] = useState(false); + const [issues, setIssues] = useState([]); const scrollRef = useRef(null); const { db } = useElectric()!; const navigate = useNavigate(); @@ -29,6 +30,7 @@ function Chat() { LIMIT 50; `, }); + setIssues(issues as Issue[]); const context = issues .map( (issue: any) => @@ -115,19 +117,49 @@ function Chat() {
-
-
- {working && answer.length === 0 ? ( -
- -
- ) : ( - {answerText} - )} +
+
+
+ {working && answer.length === 0 ? ( +
+ +
+ ) : ( + {answerText} + )} +
+ {issues?.length && ( +
+

+ Referenced Issues +

+
+ {issues.map((issue, i) => ( +
+ navigate(`/issue/${issue.id}`)} + className="cursor-pointer no-wrap overflow-hidden font-medium line-clamp-1 overflow-ellipsis" + > + {i + 1}. {issue.title} + +
+ ))} +
+
+ )}