Merge branch 'preview' of https://github.com/continuedev/continue into preview
This commit is contained in:
commit
524974fb18
8 changed files with 67 additions and 3 deletions
|
|
@ -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<ChatMessage> {
|
||||
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),
|
||||
|
|
|
|||
4
extensions/vscode/package-lock.json
generated
4
extensions/vscode/package-lock.json
generated
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
42
gui/src/hooks/useNavigationListener.tsx
Normal file
42
gui/src/hooks/useNavigationListener.tsx
Normal file
|
|
@ -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]);
|
||||
}
|
||||
|
|
@ -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 (
|
||||
|
|
|
|||
|
|
@ -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<SessionInfo[]>([]);
|
||||
const [filteredAndSortedSessions, setFilteredAndSortedSessions] = useState<
|
||||
SessionInfo[]
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue