Skip to content

Commit

Permalink
fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
RomneyDa committed Jan 29, 2025
2 parents aaff75e + dc11f26 commit a7f2a02
Show file tree
Hide file tree
Showing 69 changed files with 1,134 additions and 521 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ If you find a bug, please [create an issue](https://github.com/continuedev/conti

## ✨ Suggest Enhancements

Continue is quickly adding features, and we'd love to hear which are the most important to you. The best ways to suggest an enhancement are
Continue is quickly adding features, and we'd love to hear which are the most important to you. The best ways to suggest an enhancement are:

- Create an issue

Expand Down Expand Up @@ -192,7 +192,7 @@ Continue has support for more than a dozen different LLM "providers", making it

1. Create a new file in the `core/llm/llms` directory. The name of the file should be the name of the provider, and it should export a class that extends `BaseLLM`. This class should contain the following minimal implementation. We recommend viewing pre-existing providers for more details. The [LlamaCpp Provider](./core/llm/llms/LlamaCpp.ts) is a good simple example.

- `providerName` - the identifier for your provider
- `providerName` - the identifier for your provider.
- At least one of `_streamComplete` or `_streamChat` - This is the function that makes the request to the API and returns the streamed response. You only need to implement one because Continue can automatically convert between "chat" and "raw completion".

2. Add your provider to the `LLMs` array in [core/llm/llms/index.ts](./core/llm/llms/index.ts).
Expand Down
10 changes: 7 additions & 3 deletions core/config/ConfigHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ import Ollama from "../llm/llms/Ollama.js";
import { GlobalContext } from "../util/GlobalContext.js";
import { getConfigJsonPath, getConfigYamlPath } from "../util/paths.js";

import { ConfigResult, ConfigYaml, FullSlug } from "@continuedev/config-yaml";
import {
AssistantUnrolled,
ConfigResult,
FullSlug,
} from "@continuedev/config-yaml";
import * as YAML from "yaml";
import { getControlPlaneEnv, useHub } from "../control-plane/env.js";
import { localPathToUri } from "../util/pathToUri.js";
Expand Down Expand Up @@ -107,7 +111,7 @@ export class ConfigHandler {
}
} else {
const env = await getControlPlaneEnv(this.ide.getIdeSettings());
await this.ide.openUrl(`${env.APP_URL}${openProfileId}`);
await this.ide.openUrl(`${env.APP_URL}platform/${openProfileId}`);
}
}

Expand All @@ -118,7 +122,7 @@ export class ConfigHandler {
.then(async (assistants) => {
const hubProfiles = await Promise.all(
assistants.map(async (assistant) => {
let renderedConfig: ConfigYaml | undefined = undefined;
let renderedConfig: AssistantUnrolled | undefined = undefined;
if (assistant.configResult.config) {
renderedConfig = await clientRenderHelper(
YAML.stringify(assistant.configResult.config),
Expand Down
4 changes: 2 additions & 2 deletions core/config/profile/PlatformProfileLoader.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ConfigYaml } from "@continuedev/config-yaml/dist/schemas/index.js";
import { AssistantUnrolled } from "@continuedev/config-yaml/dist/schemas/index.js";

import { ControlPlaneClient } from "../../control-plane/client.js";
import { ContinueConfig, IDE, IdeSettings } from "../../index.js";
Expand All @@ -24,7 +24,7 @@ export default class PlatformProfileLoader implements IProfileLoader {
description: ProfileDescription;

constructor(
private configResult: ConfigResult<ConfigYaml>,
private configResult: ConfigResult<AssistantUnrolled>,
private readonly ownerSlug: string,
private readonly packageSlug: string,
versionSlug: string,
Expand Down
4 changes: 2 additions & 2 deletions core/config/profile/doLoadConfig.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import fs from "fs";

import {
AssistantUnrolled,
ConfigResult,
ConfigValidationError,
ConfigYaml,
} from "@continuedev/config-yaml";
import {
ContinueConfig,
Expand Down Expand Up @@ -31,7 +31,7 @@ export default async function doLoadConfig(
controlPlaneClient: ControlPlaneClient,
writeLog: (message: string) => Promise<void>,
overrideConfigJson: SerializedContinueConfig | undefined,
overrideConfigYaml: ConfigYaml | undefined,
overrideConfigYaml: AssistantUnrolled | undefined,
platformConfigMetadata: PlatformConfigMetadata | undefined,
workspaceId?: string,
): Promise<ConfigResult<ContinueConfig>> {
Expand Down
8 changes: 4 additions & 4 deletions core/config/yaml/convertFromJson.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ModelConfig } from "@continuedev/config-yaml";
import { ConfigYaml } from "@continuedev/config-yaml/dist/schemas";
import { AssistantUnrolled } from "@continuedev/config-yaml/dist/schemas";

import { SerializedContinueConfig } from "../..";

export function convertConfigJsonToConfigYaml(
configJson: SerializedContinueConfig,
): ConfigYaml {
): AssistantUnrolled {
return {
name: "Local Config",
version: "1.0.0",
Expand All @@ -24,8 +24,8 @@ export function convertConfigJsonToConfigYaml(
// rerankModels
],
context: configJson.contextProviders?.map((provider) => ({
uses: provider.name,
with: provider.params,
provider: provider.name,
params: provider.params,
})),
};
}
6 changes: 3 additions & 3 deletions core/config/yaml/default.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { ConfigYaml } from "@continuedev/config-yaml/dist/schemas";
import { AssistantUnrolled } from "@continuedev/config-yaml/dist/schemas";

// TODO
export const defaultConfigYaml: ConfigYaml = {
export const defaultConfigYaml: AssistantUnrolled = {
models: [],
context: [],
name: "Local Config",
version: "1.0.0",
};

export const defaultConfigYamlJetBrains: ConfigYaml = {
export const defaultConfigYamlJetBrains: AssistantUnrolled = {
models: [],
context: [],
name: "Local Config",
Expand Down
21 changes: 11 additions & 10 deletions core/config/yaml/loadYaml.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import fs from "node:fs";

import {
AssistantUnrolled,
ConfigResult,
ConfigYaml,
validateConfigYaml,
} from "@continuedev/config-yaml";
import { fetchwithRequestOptions } from "@continuedev/fetch";
Expand Down Expand Up @@ -42,10 +42,10 @@ import { modifyContinueConfigWithSharedConfig } from "../sharedConfig";
async function loadConfigYaml(
workspaceConfigs: string[],
rawYaml: string,
overrideConfigYaml: ConfigYaml | undefined,
overrideConfigYaml: AssistantUnrolled | undefined,
ide: IDE,
controlPlaneClient: ControlPlaneClient,
): Promise<ConfigResult<ConfigYaml>> {
): Promise<ConfigResult<AssistantUnrolled>> {
let config =
overrideConfigYaml ??
(await clientRenderHelper(rawYaml, ide, controlPlaneClient));
Expand Down Expand Up @@ -88,7 +88,7 @@ async function slashCommandsFromV1PromptFiles(
}

async function configYamlToContinueConfig(
config: ConfigYaml,
config: AssistantUnrolled,
ide: IDE,
ideSettings: IdeSettings,
uniqueId: string,
Expand Down Expand Up @@ -183,7 +183,8 @@ async function configYamlToContinueConfig(

// Context providers
const codebaseContextParams: IContextProvider[] =
(config.context || []).find((cp) => cp.uses === "codebase")?.with || {};
(config.context || []).find((cp) => cp.provider === "codebase")?.params ||
{};
const DEFAULT_CONTEXT_PROVIDERS = [
new FileContextProvider({}),
new CodebaseContextProvider(codebaseContextParams),
Expand All @@ -196,14 +197,14 @@ async function configYamlToContinueConfig(

continueConfig.contextProviders = (config.context
?.map((context) => {
const cls = contextProviderClassFromName(context.uses) as any;
const cls = contextProviderClassFromName(context.provider) as any;
if (!cls) {
if (!DEFAULT_CONTEXT_PROVIDERS_TITLES.includes(context.uses)) {
console.warn(`Unknown context provider ${context.uses}`);
if (!DEFAULT_CONTEXT_PROVIDERS_TITLES.includes(context.provider)) {
console.warn(`Unknown context provider ${context.provider}`);
}
return undefined;
}
const instance: IContextProvider = new cls(context.with ?? {});
const instance: IContextProvider = new cls(context.params ?? {});
return instance;
})
.filter((p) => !!p) ?? []) as IContextProvider[];
Expand Down Expand Up @@ -298,7 +299,7 @@ export async function loadContinueConfigFromYaml(
uniqueId: string,
writeLog: (log: string) => Promise<void>,
workOsAccessToken: string | undefined,
overrideConfigYaml: ConfigYaml | undefined,
overrideConfigYaml: AssistantUnrolled | undefined,
platformConfigMetadata: PlatformConfigMetadata | undefined,
controlPlaneClient: ControlPlaneClient,
): Promise<ConfigResult<ContinueConfig>> {
Expand Down
7 changes: 6 additions & 1 deletion core/context/providers/DocsContextProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ class DocsContextProvider extends BaseContextProvider {
displayTitle: "Docs",
description: "Type to search docs",
type: "submenu",
// Todo: consider a different renderInline so that when multiple docs are referenced in one message,
// Or the doc has an odd name unrelated to the content
// The name of the doc itself doesn't skew the embedding results
// renderInlineAs: "<docs-context-provider>",
};

constructor(options: any) {
Expand Down Expand Up @@ -82,6 +86,7 @@ class DocsContextProvider extends BaseContextProvider {
query: string,
extras: ContextProviderExtras,
): Promise<ContextItem[]> {
const nRetrieve = this.options?.nRetrieve ?? DocsContextProvider.nRetrieve;
const useReranking = this.options?.useReranking ?? true;

// Get docs service
Expand All @@ -96,7 +101,7 @@ class DocsContextProvider extends BaseContextProvider {
let chunks = await docsService.retrieveChunksFromQuery(
extras.fullInput, // confusing: fullInput = the query, query = startUrl in this case
query,
this.options?.nRetrieve ?? DocsContextProvider.nRetrieve,
nRetrieve,
);
if (!chunks?.length) {
return [];
Expand Down
2 changes: 1 addition & 1 deletion core/continueServer/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface IContinueServerClient {
connected: boolean;
url: URL | undefined;
getUserToken(): string | undefined;
getConfig(): Promise<{ configJson: string; configJs: string }>;
getConfig(): Promise<{ configJson: string }>;
getFromIndexCache<T extends ArtifactType>(
keys: string[],
artifactId: T,
Expand Down
2 changes: 1 addition & 1 deletion core/continueServer/stubs/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class ContinueServerClient implements IContinueServerClient {
return this.url !== undefined && this.userToken !== undefined;
}

public async getConfig(): Promise<{ configJson: string; configJs: string }> {
public async getConfig(): Promise<{ configJson: string }> {
const userToken = await this.userToken;
const response = await fetch(new URL("sync", this.url).href, {
method: "GET",
Expand Down
4 changes: 2 additions & 2 deletions core/control-plane/client.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ConfigJson } from "@continuedev/config-types";
import { ConfigYaml } from "@continuedev/config-yaml/dist/schemas/index.js";
import fetch, { RequestInit, Response } from "node-fetch";

import { IdeSettings, ModelDescription } from "../index.js";

import {
AssistantUnrolled,
ConfigResult,
FQSN,
FullSlug,
Expand Down Expand Up @@ -109,7 +109,7 @@ export class ControlPlaneClient {

public async listAssistants(): Promise<
{
configResult: ConfigResult<ConfigYaml>;
configResult: ConfigResult<AssistantUnrolled>;
ownerSlug: string;
packageSlug: string;
iconUrl: string;
Expand Down
3 changes: 3 additions & 0 deletions core/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,9 @@ export class Core {
on("docs/initStatuses", async (msg) => {
void this.docsService.initStatuses();
});
on("docs/getDetails", async (msg) => {
return await this.docsService.getDetails(msg.data.startUrl);
});
//

on("didChangeSelectedProfile", (msg) => {
Expand Down
8 changes: 8 additions & 0 deletions core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,14 @@ export interface SiteIndexingConfig {
rootUrl?: string; // Currently only used by preindexed docs
}

export interface DocsIndexingDetails {
startUrl: string;
config: SiteIndexingConfig;
indexingStatus: IndexingStatus | undefined;
chunks: Chunk[];
isPreIndexedDoc: boolean;
}

export interface IContextProvider {
get description(): ContextProviderDescription;

Expand Down
Loading

0 comments on commit a7f2a02

Please sign in to comment.