From ecc1dd6474deaf25b91ea2fb7503f6f030342d93 Mon Sep 17 00:00:00 2001 From: jasongwq Date: Sun, 23 Jun 2024 12:47:13 +0800 Subject: [PATCH 1/2] Support using slash ("/") anywhere in UserInput; previously only supported at the beginning of UserInput --- app/components/chat.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/components/chat.tsx b/app/components/chat.tsx index 061192504..fbca15718 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -671,6 +671,8 @@ function _Chat() { const config = useAppConfig(); const fontSize = config.fontSize; + const slashOffsetRef = useRef(0); + const [showExport, setShowExport] = useState(false); const inputRef = useRef(null); @@ -751,10 +753,13 @@ function _Chat() { setPromptHints([]); } else if (text.startsWith(ChatCommandPrefix)) { setPromptHints(chatCommands.search(text)); - } else if (!config.disablePromptHint && n < SEARCH_TEXT_LIMIT) { + } else if ( + !config.disablePromptHint && + text.length < slashOffsetRef.current + SEARCH_TEXT_LIMIT + ) { // check if need to trigger auto completion - if (text.startsWith("/")) { - let searchText = text.slice(1); + if (text.slice(slashOffsetRef.current).startsWith("/")) { + let searchText = text.slice(slashOffsetRef.current + 1); onSearch(searchText); } } @@ -792,7 +797,7 @@ function _Chat() { setUserInput(""); } else { // or fill the prompt - setUserInput(prompt.content); + setUserInput(prompt.content + userInput.slice(0, slashOffsetRef.current)); } inputRef.current?.focus(); }, 30); @@ -843,6 +848,8 @@ function _Chat() { setUserInput(localStorage.getItem(LAST_INPUT_KEY) ?? ""); e.preventDefault(); return; + } else if (e.key === "/") { + slashOffsetRef.current = userInput.length; } if (shouldSubmit(e) && promptHints.length === 0) { doSubmit(userInput); From fc6ddce88cd26bb7e50ef5925a74e26d41934f90 Mon Sep 17 00:00:00 2001 From: jasongwq Date: Mon, 24 Jun 2024 11:41:26 +0800 Subject: [PATCH 2/2] Update app.yml --- .github/workflows/app.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.github/workflows/app.yml b/.github/workflows/app.yml index 7e74cf045..594092dc4 100644 --- a/.github/workflows/app.yml +++ b/.github/workflows/app.yml @@ -40,12 +40,6 @@ jobs: fail-fast: false matrix: config: - - os: ubuntu-latest - arch: x86_64 - rust_target: x86_64-unknown-linux-gnu - - os: macos-latest - arch: aarch64 - rust_target: x86_64-apple-darwin,aarch64-apple-darwin - os: windows-latest arch: x86_64 rust_target: x86_64-pc-windows-msvc @@ -77,12 +71,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} - APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} - APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} - APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }} - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} with: releaseId: ${{ needs.create-release.outputs.release_id }} args: ${{ matrix.config.os == 'macos-latest' && '--target universal-apple-darwin' || '' }}