From 27900406835918b523665c5778c61b35dbe7062f Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 8 Feb 2024 19:13:30 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=92=9A=20Update=20package.json=20vers?= =?UTF-8?q?ion=20[skip=20ci]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extensions/vscode/package-lock.json | 4 ++-- extensions/vscode/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 2387fdb70..f7f7e44f6 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.58", + "version": "0.9.59", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.58", + "version": "0.9.59", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 92b8db6bd..8ab744bb8 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -1,7 +1,7 @@ { "name": "continue", "icon": "media/icon.png", - "version": "0.9.58", + "version": "0.9.59", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" From 42c07c8e74f67f392b22452bf130f88066fe60ef Mon Sep 17 00:00:00 2001 From: Jason Jacobs Date: Fri, 9 Feb 2024 00:24:16 -0800 Subject: [PATCH 2/3] Enhancement/send keyboard shortcuts to gui page (#836) * On a keyboard shortcut done on the help page switches to main gui page and it receives the keyboard shortcut. * update comment * seperate logic into listner hook so that all navigation buttons work on all screens.. [New Session, Toggle Full Screen, View History] * useEffect was moved to NavigationListener --- gui/src/hooks/useNavigationListener.tsx | 42 +++++++++++++++++++++++++ gui/src/pages/help.tsx | 4 +++ gui/src/pages/history.tsx | 3 ++ gui/src/pages/modelconfig.tsx | 2 ++ gui/src/pages/models.tsx | 2 ++ 5 files changed, 53 insertions(+) create mode 100644 gui/src/hooks/useNavigationListener.tsx diff --git a/gui/src/hooks/useNavigationListener.tsx b/gui/src/hooks/useNavigationListener.tsx new file mode 100644 index 000000000..cd5e1ffb1 --- /dev/null +++ b/gui/src/hooks/useNavigationListener.tsx @@ -0,0 +1,42 @@ +import { useEffect } from 'react'; +import { useNavigate, useLocation } from 'react-router-dom'; + +const openGUITypes = [ + "highlightedCode", + "newSessionWithPrompt", + "focusContinueInput", + "focusContinueInputWithoutClear", + "newSession", +]; + +export const useNavigationListener = () => { + const navigate = useNavigate(); + const location = useLocation(); + + useEffect(() => { + const listener = (e) => { + if(openGUITypes.includes(e.data.type)) { + + navigate("/"); + setTimeout(() => { + window.postMessage(e.data, "*"); + }, 200); + } + + if(e.data.type === "viewHistory") { + // Toggle the history page / main page + if (location.pathname === "/history") { + navigate("/"); + } else { + navigate("/history"); + } + } + }; + + window.addEventListener("message", listener); + + return () => { + window.removeEventListener("message", listener); + }; + }, [navigate]); +} diff --git a/gui/src/pages/help.tsx b/gui/src/pages/help.tsx index 3beb2c715..0c8dfe845 100644 --- a/gui/src/pages/help.tsx +++ b/gui/src/pages/help.tsx @@ -4,6 +4,9 @@ import { useNavigate } from "react-router-dom"; import styled from "styled-components"; import { Button, lightGray, vscBackground, vscForeground } from "../components"; import KeyboardShortcutsDialog from "../components/dialogs/KeyboardShortcuts"; +import { useNavigationListener } from "../hooks/useNavigationListener"; + + const IconDiv = styled.div<{ backgroundColor?: string }>` display: flex; @@ -32,6 +35,7 @@ const TutorialButton = styled(Button)` `; function HelpPage() { + useNavigationListener(); const navigate = useNavigate(); return ( diff --git a/gui/src/pages/history.tsx b/gui/src/pages/history.tsx index 9dc2dbabc..57ed49bda 100644 --- a/gui/src/pages/history.tsx +++ b/gui/src/pages/history.tsx @@ -9,6 +9,7 @@ import HeaderButtonWithText from "../components/HeaderButtonWithText"; import useHistory from "../hooks/useHistory"; import { newSession } from "../redux/slices/stateSlice"; import { getFontSize } from "../util"; +import { useNavigationListener } from "../hooks/useNavigationListener"; const Tr = styled.tr` &:hover { @@ -125,7 +126,9 @@ function lastPartOfPath(path: string): string { } function History() { + useNavigationListener(); const navigate = useNavigate(); + const [sessions, setSessions] = useState([]); const [filteredAndSortedSessions, setFilteredAndSortedSessions] = useState< SessionInfo[] diff --git a/gui/src/pages/modelconfig.tsx b/gui/src/pages/modelconfig.tsx index 40c9d3961..af44a4aa1 100644 --- a/gui/src/pages/modelconfig.tsx +++ b/gui/src/pages/modelconfig.tsx @@ -22,6 +22,7 @@ import { PROVIDER_INFO, updatedObj, } from "../util/modelData"; +import { useNavigationListener } from "../hooks/useNavigationListener"; const GridDiv = styled.div` display: grid; @@ -57,6 +58,7 @@ export const CustomModelButton = styled.div<{ disabled: boolean }>` `; function ModelConfig() { + useNavigationListener(); const formMethods = useForm(); const { modelName } = useParams(); diff --git a/gui/src/pages/models.tsx b/gui/src/pages/models.tsx index cf79e4fda..782a42984 100644 --- a/gui/src/pages/models.tsx +++ b/gui/src/pages/models.tsx @@ -13,6 +13,7 @@ import { setDefaultModel } from "../redux/slices/stateSlice"; import { addModel } from "../util/ide"; import { MODEL_INFO, PROVIDER_INFO } from "../util/modelData"; import { CustomModelButton } from "./modelconfig"; +import { useNavigationListener } from "../hooks/useNavigationListener"; const IntroDiv = styled.div` padding: 8px 12px; @@ -33,6 +34,7 @@ const GridDiv = styled.div` function Models() { const navigate = useNavigate(); const dispatch = useDispatch(); + useNavigationListener(); const [providersSelected, setProvidersSelected] = React.useState(true); From e9cebb481064abfb24210a58adf04547542a3e77 Mon Sep 17 00:00:00 2001 From: Collin <69058468+CollinCashio@users.noreply.github.com> Date: Fri, 9 Feb 2024 13:25:29 -0600 Subject: [PATCH 3/3] Ollama-JS Request Headers Fix (#830) * add basic auth to ollama llm * revert btoa api-key change in favor of request headers * remove unnecessary async --------- Co-authored-by: Collin Cashio --- core/llm/llms/Ollama.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/llm/llms/Ollama.ts b/core/llm/llms/Ollama.ts index d54e0d8fd..1e2fa32aa 100644 --- a/core/llm/llms/Ollama.ts +++ b/core/llm/llms/Ollama.ts @@ -24,6 +24,7 @@ class Ollama extends BaseLLM { } this.fetch(`${this.apiBase}/api/show`, { method: "POST", + headers: {}, body: JSON.stringify({ name: this._getModel() }), }).then(async (response) => { if (response.status !== 200) { @@ -177,6 +178,16 @@ class Ollama extends BaseLLM { ): AsyncGenerator { const client = new ollama.Ollama({ host: this.apiBase, + + fetch: (input, config) => { + return fetch(input, { + ...config, + headers: { + ...(config?.headers || {}), + ...(this.requestOptions?.headers || {}) + } + }); + } }); const response = await client.chat({ ...this._convertArgs(options, messages),