clean up URLs

This commit is contained in:
Nate 2024-10-15 12:00:05 -07:00
parent 860e26bdac
commit 2eba3825fb
12 changed files with 98 additions and 22 deletions

View file

@ -1,4 +1,4 @@
import { constants } from "../../deploy/constants.js";
import { TRIAL_PROXY_URL } from "../../control-plane/client.js";
import { ChatMessageRole, FetchFunction, SlashCommand } from "../../index.js";
import { pruneStringFromBottom } from "../../llm/countTokens.js";
import { stripImages } from "../../llm/images.js";
@ -15,7 +15,7 @@ async function getResults(q: string, fetch: FetchFunction): Promise<any> {
q: `${q} site:stackoverflow.com`,
});
const resp = await fetch(new URL("/search", constants.a), {
const resp = await fetch(new URL("/search", TRIAL_PROXY_URL), {
method: "POST",
headers: {
"Content-Type": "application/json",

View file

@ -5,10 +5,10 @@ import {
ContextProviderExtras,
} from "../..";
import { getHeaders } from "../../continueServer/stubs/headers";
import { constants } from "../../deploy/constants";
import { TRIAL_PROXY_URL } from "../../control-plane/client";
export default class WebContextProvider extends BaseContextProvider {
private static ENDPOINT = new URL("web", constants.a);
private static ENDPOINT = new URL("web", TRIAL_PROXY_URL);
private static DEFAULT_N = 6;
static description: ContextProviderDescription = {

View file

@ -1,6 +1,6 @@
import fetch from "node-fetch";
import { getHeaders } from "../../continueServer/stubs/headers.js";
import { constants } from "../../deploy/constants.js";
import { TRIAL_PROXY_URL } from "../../control-plane/client.js";
import { Chunk, Reranker } from "../../index.js";
export class FreeTrialReranker implements Reranker {
@ -10,7 +10,7 @@ export class FreeTrialReranker implements Reranker {
if (chunks.length === 0) {
return [];
}
const resp = await fetch(new URL("rerank", constants.a), {
const resp = await fetch(new URL("rerank", TRIAL_PROXY_URL), {
method: "POST",
headers: {
"Content-Type": "application/json",

View file

@ -18,6 +18,9 @@ export interface ControlPlaneWorkspace {
export interface ControlPlaneModelDescription extends ModelDescription {}
export const TRIAL_PROXY_URL =
"https://proxy-server-blue-l6vsfbzhba-uw.a.run.app";
export const DEFAULT_CONTROL_PLANE_PROXY_URL =
process.env.CONTROL_PLANE_ENV === "local"
? "http://localhost:3001/"

View file

@ -1,6 +1,4 @@
export const constants = {
a: "https://proxy-server-blue-l6vsfbzhba-uw.a.run.app",
// a: "http://localhost:3000",
b: "1710787199603",
c: "NfZFVegMpdyT3P5UmAggr7T7Hb6PlcbB",
};

View file

@ -1,6 +1,6 @@
import { Response } from "node-fetch";
import { getHeaders } from "../../continueServer/stubs/headers.js";
import { constants } from "../../deploy/constants.js";
import { TRIAL_PROXY_URL } from "../../control-plane/client.js";
import {
EmbeddingsProviderName,
EmbedOptions,
@ -33,7 +33,7 @@ class FreeTrialEmbeddingsProvider extends BaseEmbeddingsProvider {
}
const fetchWithBackoff = () =>
withExponentialBackoff<Response>(async () =>
this.fetch(new URL("embeddings", constants.a), {
this.fetch(new URL("embeddings", TRIAL_PROXY_URL), {
method: "POST",
body: JSON.stringify({
input: batch,

View file

@ -1,6 +1,6 @@
import { TRIAL_FIM_MODEL } from "../../config/onboarding.js";
import { getHeaders } from "../../continueServer/stubs/headers.js";
import { constants } from "../../deploy/constants.js";
import { TRIAL_PROXY_URL } from "../../control-plane/client.js";
import { ChatMessage, CompletionOptions, ModelProvider } from "../../index.js";
import { BaseLLM } from "../index.js";
import { streamResponse } from "../stream.js";
@ -66,7 +66,7 @@ class FreeTrial extends BaseLLM {
await this._countTokens(prompt, args.model, true);
const response = await this.fetch(`${constants.a}/stream_complete`, {
const response = await this.fetch(`${TRIAL_PROXY_URL}/stream_complete`, {
method: "POST",
headers: await this._getHeaders(),
body: JSON.stringify({
@ -113,7 +113,7 @@ class FreeTrial extends BaseLLM {
true,
);
const response = await this.fetch(`${constants.a}/stream_chat`, {
const response = await this.fetch(`${TRIAL_PROXY_URL}/stream_chat`, {
method: "POST",
headers: await this._getHeaders(),
body: JSON.stringify({
@ -143,7 +143,7 @@ class FreeTrial extends BaseLLM {
options: CompletionOptions,
): AsyncGenerator<string> {
const args = this._convertArgs(this.collectArgs(options));
const resp = await this.fetch(`${constants.a}/stream_fim`, {
const resp = await this.fetch(`${TRIAL_PROXY_URL}/stream_fim`, {
method: "POST",
headers: await this._getHeaders(),
body: JSON.stringify({

View file

@ -1609,7 +1609,8 @@
"database",
"os",
"repo-map",
"greptile"
"greptile",
"web"
],
"markdownEnumDescriptions": [
"Reference the contents of the current changes as given by `git diff`",
@ -1634,7 +1635,8 @@
"Reference table schemas",
"Operating system and CPU Information",
"Map of files in the repository with important code highlights",
"Query your greptile index of the current repo"
"Query your greptile index of the current repo",
"Search the web for sources related to your question"
],
"type": "string"
},
@ -1739,6 +1741,24 @@
"required": ["params"]
}
},
{
"if": { "properties": { "name": { "enum": ["web"] } } },
"then": {
"properties": {
"params": {
"properties": {
"n": {
"title": "N",
"description": "The number of results to return",
"default": 6,
"type": "integer"
}
}
}
},
"required": ["params"]
}
},
{
"if": {
"properties": {

View file

@ -1609,7 +1609,8 @@
"database",
"os",
"repo-map",
"greptile"
"greptile",
"web"
],
"markdownEnumDescriptions": [
"Reference the contents of the current changes as given by `git diff`",
@ -1634,7 +1635,8 @@
"Reference table schemas",
"Operating system and CPU Information",
"Map of files in the repository with important code highlights",
"Query your greptile index of the current repo"
"Query your greptile index of the current repo",
"Search the web for sources related to your question"
],
"type": "string"
},
@ -1739,6 +1741,24 @@
"required": ["params"]
}
},
{
"if": { "properties": { "name": { "enum": ["web"] } } },
"then": {
"properties": {
"params": {
"properties": {
"n": {
"title": "N",
"description": "The number of results to return",
"default": 6,
"type": "integer"
}
}
}
},
"required": ["params"]
}
},
{
"if": {
"properties": {

View file

@ -1789,7 +1789,8 @@
"database",
"os",
"repo-map",
"greptile"
"greptile",
"web"
],
"markdownEnumDescriptions": [
"Reference the contents of the current changes as given by `git diff`",
@ -1814,7 +1815,8 @@
"Reference table schemas",
"Operating system and CPU Information",
"Map of files in the repository with important code highlights",
"Query your greptile index of the current repo"
"Query your greptile index of the current repo",
"Search the web for sources related to your question"
],
"type": "string"
},
@ -1935,6 +1937,34 @@
]
}
},
{
"if": {
"properties": {
"name": {
"enum": [
"web"
]
}
}
},
"then": {
"properties": {
"params": {
"properties": {
"n": {
"title": "N",
"description": "The number of results to return",
"default": 6,
"type": "integer"
}
}
}
},
"required": [
"params"
]
}
},
{
"if": {
"properties": {

View file

@ -1,12 +1,12 @@
{
"name": "continue",
"version": "0.9.215",
"version": "0.9.216",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "continue",
"version": "0.9.215",
"version": "0.9.216",
"license": "Apache-2.0",
"dependencies": {
"@electron/rebuild": "^3.2.10",

View file

@ -18,4 +18,9 @@ export const VoyageLlms = llms("voyage", [
displayName: "Rerank 2 Lite",
contextLength: 8096,
},
{
model: "rerank-lite-1",
displayName: "Rerank Lite 1",
contextLength: 8096,
},
]);