* JetBrains status bar spinner for autocomplete

* Remove unused images

* partial accept jetbrains

* fix double-rendering of jetbrains completions

* fix offset of multi-line jetbrains completions

* enable/disable actions

* upgrade to version 0.0.54

* llm-info package

* small profile switching improvements

* instruct cmd+I not to leave placeholders

* @ files in context-providers docs

* onboarding fix
This commit is contained in:
Nate Sesti 2024-07-15 11:08:47 -07:00 • committed by GitHub
parent e2d78c8a21
commit c3f26cc08f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
47 changed files with 694 additions and 224 deletions

View file

@ -188,6 +188,13 @@ export class ConfigHandler {
this.selectedProfileId = profileId;
const newConfig = await this.loadConfig();
this.notifyConfigListerners(newConfig);
const selectedProfiles =
this.globalContext.get("lastSelectedProfileForWorkspace") ?? {};
selectedProfiles[await this.getWorkspaceId()] = profileId;
this.globalContext.update(
"lastSelectedProfileForWorkspace",
selectedProfiles,
);
}
// A unique ID for the current workspace, built from folder names

View file

@ -10,11 +10,6 @@ export function setupApiKeysMode(
return {
...config,
models: config.models.filter((model) => model.provider !== "free-trial"),
tabAutocompleteModel: {
title: "Tab Autocomplete",
provider: "free-trial",
model: TRIAL_FIM_MODEL,
},
embeddingsProvider: {
provider: "free-trial",
},

View file

@ -1,3 +1,4 @@
import { findLlmInfo } from "@continuedev/llm-info";
import Handlebars from "handlebars";
import {
ChatMessage,
@ -114,14 +115,17 @@ export abstract class BaseLLM implements ILLM {
..._options,
};
this.model = options.model;
const llmInfo = findLlmInfo(this.model);
const templateType =
options.template ?? autodetectTemplateType(options.model);
this.title = options.title;
this.uniqueId = options.uniqueId ?? "None";
this.model = options.model;
this.systemMessage = options.systemMessage;
this.contextLength = options.contextLength ?? DEFAULT_CONTEXT_LENGTH;
this.contextLength =
options.contextLength ?? llmInfo?.contextLength ?? DEFAULT_CONTEXT_LENGTH;
this.completionOptions = {
...options.completionOptions,
model: options.model || "gpt-4",

View file

@ -95,7 +95,7 @@ ${otherData.codeToEdit}
${suffixTag}
\`\`\`
Please rewrite the entire code block above in order to satisfy the following request: "${otherData.userInput}".${suffixExplanation}`,
Please rewrite the entire code block above in order to satisfy the following request: "${otherData.userInput}". You should rewrite the entire code block without leaving placeholders, even if the code is the same as before.${suffixExplanation}`,
},
{
role: "assistant",
@ -115,7 +115,7 @@ ${otherData.codeToEdit}
${suffixTag}
\`\`\`
Please rewrite the entire code block above, editing the portion below "${START_TAG}" in order to satisfy the following request: "${otherData.userInput}".${suffixExplanation}
Please rewrite the entire code block above, editing the portion below "${START_TAG}" in order to satisfy the following request: "${otherData.userInput}". You should rewrite the entire code block without leaving placeholders, even if the code is the same as before.${suffixExplanation}
`,
},
{

View file

@ -12,6 +12,7 @@
"@aws-sdk/client-bedrock-runtime": "^3.574.0",
"@aws-sdk/credential-providers": "^3.596.0",
"@continuedev/config-types": "^1.0.6",
"@continuedev/llm-info": "^1.0.1",
"@mozilla/readability": "^0.5.0",
"@octokit/rest": "^20.0.2",
"@types/jsdom": "^21.1.6",
@ -3937,6 +3938,11 @@
"zod": "^3.23.8"
}
},
"node_modules/@continuedev/llm-info": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@continuedev/llm-info/-/llm-info-1.0.1.tgz",
"integrity": "sha512-fmRXuOSwJ9ogBPSDduoedHF3WVg1rge3o8SRRg1hkUagRnxwZqtQj1sS5SjQyAqjQv6VPMGPDEtD77Za/hc4Jg=="
},
"node_modules/@esbuild/android-arm": {
"version": "0.17.19",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.19.tgz",

View file

@ -32,6 +32,7 @@
"@aws-sdk/client-bedrock-runtime": "^3.574.0",
"@aws-sdk/credential-providers": "^3.596.0",
"@continuedev/config-types": "^1.0.6",
"@continuedev/llm-info": "^1.0.1",
"@mozilla/readability": "^0.5.0",
"@octokit/rest": "^20.0.2",
"@types/jsdom": "^21.1.6",

View file

@ -195,16 +195,17 @@ function getMigrationsFolderPath(): string {
return migrationsPath;
}
export function migrate(
export async function migrate(
id: string,
callback: () => void,
callback: () => void | Promise<void>,
onAlreadyComplete?: () => void,
) {
const migrationsPath = getMigrationsFolderPath();
const migrationPath = path.join(migrationsPath, id);
if (!fs.existsSync(migrationPath)) {
try {
callback();
await Promise.resolve(callback());
fs.writeFileSync(migrationPath, "");
} catch (e) {
console.error(`Migration ${id} failed`, e);

View file

@ -16,6 +16,14 @@ As an example, say you are working on solving a new GitHub Issue. You type '@iss
To use any of the built-in context providers, open `~/.continue/config.json` and add it to the `contextProviders` list.
### Files
Type '@file' to reference any file in your current workspace.
```json
{ "name": "file" }
```
### Code
Type '@code' to reference specific functions or classes from throughout your project.
@ -498,9 +506,7 @@ Continue exposes an API for registering context providers from a 3rd party VSCod
```json
{
"extensionDependencies": [
"continue.continue"
],
"extensionDependencies": ["continue.continue"]
}
```
@ -513,7 +519,6 @@ Here is an example:
import * as vscode from "vscode";
class MyCustomProvider implements IContextProvider {
get description(): ContextProviderDescription {
return {
title: "custom",
@ -525,7 +530,7 @@ class MyCustomProvider implements IContextProvider {
async getContextItems(
query: string,
extras: ContextProviderExtras
extras: ContextProviderExtras,
): Promise<ContextItem[]> {
return [
{
@ -537,7 +542,7 @@ class MyCustomProvider implements IContextProvider {
}
async loadSubmenuItems(
args: LoadSubmenuItemsArgs
args: LoadSubmenuItemsArgs,
): Promise<ContextSubmenuItem[]> {
return [];
}
@ -554,5 +559,4 @@ const continueApi = continueExt?.exports;
// register your custom provider
continueApi?.registerCustomContextProvider(customProvider);
```
```

View file

@ -4,7 +4,7 @@ pluginGroup = com.github.continuedev.continueintellijextension
pluginName = continue-intellij-extension
pluginRepositoryUrl = https://github.com/continuedev/continue
# SemVer format -> https://semver.org
pluginVersion = 0.0.53
pluginVersion = 0.0.54
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 223

View file

@ -0,0 +1,29 @@
package com.github.continuedev.continueintellijextension.autocomplete
import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.DefaultActionGroup
import com.intellij.openapi.components.service
class AutocompleteActionGroup : DefaultActionGroup() {
override fun getActionUpdateThread(): ActionUpdateThread {
return ActionUpdateThread.EDT
}
override fun update(e: AnActionEvent) {
super.update(e)
removeAll()
val continueSettingsService = service<ContinueExtensionSettings>()
if (continueSettingsService.continueState.enableTabAutocomplete) {
addAll(
DisableTabAutocompleteAction(),
)
} else {
addAll(
EnableTabAutocompleteAction(),
)
}
}
}

View file

@ -12,10 +12,15 @@ import com.intellij.openapi.util.TextRange
class AutocompleteCaretListener: CaretListener {
override fun caretPositionChanged(event: CaretEvent) {
val caret = event.caret ?: return
val oldPosition = event.oldPosition
val offset = caret.offset
val editor = caret.editor
val autocompleteService = editor.project?.service<AutocompleteService>() ?: return
if (autocompleteService.lastChangeWasPartialAccept) {
autocompleteService.lastChangeWasPartialAccept = false
return
}
val pending = autocompleteService.pendingCompletion;
if (pending != null && pending.editor == editor && pending.offset == offset) {
return
@ -29,10 +34,16 @@ class AutocompleteDocumentListener(private val editorManager: FileEditorManager,
if (editor != editorManager.selectedTextEditor) {
return
}
val service = editor.project?.service<AutocompleteService>() ?: return
if (service.lastChangeWasPartialAccept) {
return
}
// Invoke later is important, otherwise the completion will be triggered before the document is updated
// causing the old caret offset to be used
invokeLater {
editor.project?.service<AutocompleteService>()?.triggerCompletion(editor)
service.triggerCompletion(editor)
}
}
}

View file

@ -14,18 +14,29 @@ import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.InlayProperties
import com.intellij.openapi.fileEditor.FileDocumentManager
import com.intellij.openapi.project.Project
import com.intellij.openapi.wm.WindowManager
data class PendingCompletion (
val editor: Editor,
val offset: Int,
val completionId: String,
val text: String?
val editor: Editor,
var offset: Int,
val completionId: String,
var text: String?
)
@Service(Service.Level.PROJECT)
class AutocompleteService(private val project: Project) {
var pendingCompletion: PendingCompletion? = null;
private val autocompleteLookupListener = project.service<AutocompleteLookupListener>()
private var widget: AutocompleteSpinnerWidget? = null
// To avoid triggering another completion on partial acceptance,
// we need to keep track of whether the last change was a partial accept
var lastChangeWasPartialAccept = false
init {
val statusBar = WindowManager.getInstance().getStatusBar(project)
widget = statusBar.getWidget("AutocompleteSpinnerWidget") as? AutocompleteSpinnerWidget
}
fun triggerCompletion(editor: Editor) {
val settings =
@ -42,6 +53,7 @@ class AutocompleteService(private val project: Project) {
val completionId = uuid()
val offset = editor.caretModel.primaryCaret.offset
pendingCompletion = PendingCompletion(editor, offset, completionId, null)
widget?.setLoading(true)
// Request a completion from the core
val virtualFile = FileDocumentManager.getInstance().getFile(editor.document)
@ -63,11 +75,13 @@ class AutocompleteService(private val project: Project) {
val lineLength = lineEnd - lineStart
project.service<ContinuePluginService>().coreMessenger?.request("autocomplete/complete", input, null, ({ response ->
widget?.setLoading(false)
val completions = response as List<*>
if (completions.isNotEmpty()) {
val completion = completions[0].toString()
if (completion.lines().size === 1 || column >= lineLength) {
if (completion.isNotEmpty() && (completion.lines().size === 1 || column >= lineLength)) {
// Do not render if completion is multi-line and caret is in middle of line
renderCompletion(editor, offset, completion)
pendingCompletion = pendingCompletion?.copy(text = completion)
@ -80,12 +94,18 @@ class AutocompleteService(private val project: Project) {
}
private fun renderCompletion(editor: Editor, offset: Int, text: String) {
if (text.isEmpty()) {
return
}
// Don't render completions when code completion dropdown is visible
if (!autocompleteLookupListener.isLookupEmpty()) {
return
}
ApplicationManager.getApplication().invokeLater {
WriteAction.run<Throwable> {
// Clear existing completions
hideCompletions(editor)
val properties = InlayProperties()
properties.relatesToPrecedingText(true)
properties.disableSoftWrapping(true)
@ -120,8 +140,57 @@ class AutocompleteService(private val project: Project) {
}
}
private fun splitKeepingDelimiters(input: String, delimiterPattern: String = "\\s+"): List<String> {
val initialSplit = input.split("(?<=$delimiterPattern)|(?=$delimiterPattern)".toRegex())
.filter { it.isNotEmpty() }
val result = mutableListOf<String>()
var currentDelimiter = ""
for (part in initialSplit) {
if (part.matches(delimiterPattern.toRegex())) {
currentDelimiter += part
} else {
if (currentDelimiter.isNotEmpty()) {
result.add(currentDelimiter)
currentDelimiter = ""
}
result.add(part)
}
}
if (currentDelimiter.isNotEmpty()) {
result.add(currentDelimiter)
}
return result
}
fun partialAccept() {
val completion = pendingCompletion ?: return
val text = completion.text ?: return
val editor = completion.editor
val offset = completion.offset
lastChangeWasPartialAccept = true
// Split the text into words, keeping delimiters
val words = splitKeepingDelimiters(text)
println(words)
val word = words[0]
editor.document.insertString(offset, word)
editor.caretModel.moveToOffset(offset + word.length)
// Remove the completion and re-display it
hideCompletions(editor)
completion.text = text.substring(word.length)
completion.offset += word.length
renderCompletion(editor, completion.offset, completion.text!!)
}
private fun cancelCompletion(completion: PendingCompletion) {
// Send cancellation message to core
widget?.setLoading(false)
project.service<ContinuePluginService>().coreMessenger?.request("autocomplete/cancel", null,null, ({}))
}

View file

@ -0,0 +1,111 @@
package com.github.continuedev.continueintellijextension.autocomplete
import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings
import com.intellij.openapi.Disposable
import com.intellij.openapi.components.service
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.wm.StatusBar
import com.intellij.openapi.wm.StatusBarWidget
import com.intellij.openapi.util.IconLoader
import com.intellij.openapi.wm.StatusBarWidgetFactory
import com.intellij.openapi.wm.WindowManager
import com.intellij.openapi.wm.impl.status.EditorBasedWidget
import com.intellij.ui.AnimatedIcon
import com.intellij.util.Consumer
import java.awt.event.MouseEvent
import javax.swing.Icon
import javax.swing.JLabel
class AutocompleteSpinnerWidget(project: Project): EditorBasedWidget(project), StatusBarWidget.IconPresentation, Disposable {
private val iconLabel = JLabel()
private var isLoading = false
private val animatedIcon = AnimatedIcon(
100,
IconLoader.getIcon("/icons/AnimationLoadingIcon/AnimationLoading1(RiderLight).svg", javaClass),
IconLoader.getIcon("/icons/AnimationLoadingIcon/AnimationLoading2(RiderLight).svg", javaClass),
IconLoader.getIcon("/icons/AnimationLoadingIcon/AnimationLoading3(RiderLight).svg", javaClass),
IconLoader.getIcon("/icons/AnimationLoadingIcon/AnimationLoading4(RiderLight).svg", javaClass),
IconLoader.getIcon("/icons/AnimationLoadingIcon/AnimationLoading5(RiderLight).svg", javaClass),
IconLoader.getIcon("/icons/AnimationLoadingIcon/AnimationLoading6(RiderLight).svg", javaClass),
IconLoader.getIcon("/icons/AnimationLoadingIcon/AnimationLoading7(RiderLight).svg", javaClass),
IconLoader.getIcon("/icons/AnimationLoadingIcon/AnimationLoading8(RiderLight).svg", javaClass),
)
init {
updateIcon()
}
fun show() {
println("Showing autocomplete spinner widget")
}
override fun dispose() {}
override fun ID(): String {
return "AutocompleteSpinnerWidget"
}
override fun getTooltipText(): String? {
val enabled = service<ContinueExtensionSettings>().state.enableTabAutocomplete
return if (enabled) "Continue Autocomplete Enabled" else "Continue Autocomplete Disabled"
}
override fun getClickConsumer(): Consumer<MouseEvent>? {
return null
}
override fun getIcon(): Icon = if (isLoading) animatedIcon else
IconLoader.getIcon("/icons/continue.svg", javaClass)
fun setLoading(loading: Boolean) {
isLoading = loading
updateIcon()
}
private fun updateIcon() {
iconLabel.icon = getIcon()
// Update the widget
val statusBar = WindowManager.getInstance().getStatusBar(project)
statusBar.updateWidget(ID())
}
override fun install(statusBar: StatusBar) {
updateIcon()
}
override fun getPresentation(): StatusBarWidget.WidgetPresentation? {
return this
}
}
class AutocompleteSpinnerWidgetFactory: StatusBarWidgetFactory {
fun create(project: Project): AutocompleteSpinnerWidget {
return AutocompleteSpinnerWidget(project)
}
override fun getId(): String {
return "AutocompleteSpinnerWidget"
}
override fun getDisplayName(): String {
return "Continue Autocomplete"
}
override fun isAvailable(p0: Project): Boolean {
return true
}
override fun createWidget(project: Project): StatusBarWidget {
return AutocompleteSpinnerWidget(project)
}
override fun disposeWidget(p0: StatusBarWidget) {
Disposer.dispose(p0)
}
override fun canBeEnabledOn(p0: StatusBar): Boolean = true
}

View file

@ -19,7 +19,8 @@ class ContinueCustomElementRenderer (
val text: String,
) : EditorCustomElementRenderer {
override fun calcWidthInPixels(inlay: Inlay<*>): Int {
return (inlay.editor as EditorImpl).getFontMetrics(Font.PLAIN).stringWidth(this.text)
val width = (inlay.editor as EditorImpl).getFontMetrics(Font.PLAIN).stringWidth(this.text)
return width
}
private fun font(editor: Editor): Font {

View file

@ -7,9 +7,8 @@ import com.intellij.openapi.editor.colors.EditorFontType
import com.intellij.openapi.editor.impl.EditorImpl
import com.intellij.openapi.editor.impl.FontInfo
import com.intellij.openapi.editor.markup.TextAttributes
import com.intellij.ui.Gray
import com.intellij.ui.JBColor
import java.awt.Color
import com.intellij.util.ui.UIUtil
import java.awt.Font
import java.awt.Graphics
import java.awt.Rectangle
@ -39,7 +38,7 @@ class ContinueMultilineCustomElementRenderer (
protected val font: Font
get() {
val editorFont = editor.colorsScheme.getFont(EditorFontType.PLAIN)
return editorFont.deriveFont(Font.PLAIN) ?: editorFont
return UIUtil.getFontWithFallbackIfNeeded(editorFont, text).deriveFont(editor.colorsScheme.editorFontSize)
}
private fun offsetY(): Int {
@ -58,7 +57,9 @@ class ContinueMultilineCustomElementRenderer (
FontInfo.getFontMetrics(font, FontInfo.getFontRenderContext(editor.contentComponent))
val fontWidth =
font.createGlyphVector(metrics.fontRenderContext, text).visualBounds.width
val widthBeforeCaret = (editor as EditorImpl).getFontMetrics(Font.PLAIN).stringWidth(text.substring(0, currentColumn))
val widthBeforeCaret = (editor as EditorImpl).getFontMetrics(Font.PLAIN).stringWidth(
text.substring(0, minOf(currentColumn, text.length))
)
return max(0, widthBeforeCaret - (editor as EditorImpl).scrollingModel.horizontalScrollOffset)
}
@ -68,7 +69,7 @@ class ContinueMultilineCustomElementRenderer (
var additionalYOffset = -editor.lineHeight;
var isFirstLine = true
for (line in text.lines()) {
g.drawString(line, if (isFirstLine) targetRegion.x + offsetX() else targetRegion.x, targetRegion.y + offsetY() + additionalYOffset)
g.drawString(line, if (isFirstLine) targetRegion.x + offsetX() else targetRegion.x, targetRegion.y + inlay.editor.ascent + additionalYOffset)
additionalYOffset += editor.lineHeight
isFirstLine = false
}

View file

@ -0,0 +1,12 @@
package com.github.continuedev.continueintellijextension.autocomplete
import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.components.service
class DisableTabAutocompleteAction : AnAction() {
override fun actionPerformed(e: AnActionEvent) {
val continueSettingsService = service<ContinueExtensionSettings>()
continueSettingsService.continueState.enableTabAutocomplete = true
}
}

View file

@ -0,0 +1,12 @@
package com.github.continuedev.continueintellijextension.autocomplete
import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.components.service
class EnableTabAutocompleteAction : AnAction() {
override fun actionPerformed(e: AnActionEvent) {
val continueSettingsService = service<ContinueExtensionSettings>()
continueSettingsService.continueState.enableTabAutocomplete = true
}
}

View file

@ -11,8 +11,7 @@ import com.intellij.openapi.editor.actionSystem.EditorActionHandler
class PartialAcceptAutocompleteAction: EditorAction(object : EditorActionHandler() {
override fun doExecute(editor: Editor, caret: Caret?, dataContext: DataContext?) {
ApplicationManager.getApplication().runWriteAction {
// TODO
// editor.project?.service<AutocompleteService>()?.accept()
editor.project?.service<AutocompleteService>()?.partialAccept()
}
}

View file

@ -66,7 +66,7 @@ class InlineEditAction : AnAction(), DumbAware {
val modelTitles = mutableListOf<String>()
continuePluginService.coreMessenger?.request("config/getSerializedProfileInfo", null, null) { response ->
val config = response as Map<String, Any>
val models = config["models"] as List<Map<String, Any>>
val models = (config["config"] as Map<String, Any>)["models"] as List<Map<String, Any>>
modelTitles.addAll(models.map { it["title"] as String })
}
val maxWaitTime = 200

View file

@ -22,6 +22,8 @@
<projectService
id="AutocompleteLookupListener"
serviceImplementation="com.github.continuedev.continueintellijextension.autocomplete.AutocompleteLookupListener"/>
<statusBarWidgetFactory implementation="com.github.continuedev.continueintellijextension.autocomplete.AutocompleteSpinnerWidgetFactory"
id="AutocompleteSpinnerWidget"/>
</extensions>
<resource-bundle>messages.MyBundle</resource-bundle>
@ -108,10 +110,6 @@
text="Start New Continue Session"
icon="AllIcons.General.Add"
description="Start New Continue Session">
<keyboard-shortcut keymap="$default"
first-keystroke="alt ctrl N"/>
<keyboard-shortcut keymap="Mac OS X"
first-keystroke="alt meta N"/>
</action>
<action id="continue.viewHistory"
@ -147,6 +145,13 @@
text="Cancel Autocomplete Suggestion" description="Cancel Autocomplete Suggestion">
<keyboard-shortcut keymap="$default" first-keystroke="ESCAPE"/>
</action>
<action id="com.github.continuedev.continueintellijextension.autocomplete.PartialAcceptAutocompleteAction"
class="com.github.continuedev.continueintellijextension.autocomplete.PartialAcceptAutocompleteAction"
text="Partial Accept Autocomplete Suggestion"
description="Partial Accept Autocomplete Suggestion">
<keyboard-shortcut first-keystroke="control alt RIGHT" keymap="$default"/>
<keyboard-shortcut first-keystroke="alt meta RIGHT" keymap="Mac OS X"/>
</action>
</actions>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1,017 B

View file

@ -1,12 +1,12 @@
{
"name": "continue",
"version": "0.9.181",
"version": "0.9.182",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "continue",
"version": "0.9.181",
"version": "0.9.182",
"license": "Apache-2.0",
"dependencies": {
"@electron/rebuild": "^3.2.10",
@ -98,6 +98,7 @@
"@aws-sdk/client-bedrock-runtime": "^3.574.0",
"@aws-sdk/credential-providers": "^3.596.0",
"@continuedev/config-types": "^1.0.6",
"@continuedev/llm-info": "^1.0.1",
"@mozilla/readability": "^0.5.0",
"@octokit/rest": "^20.0.2",
"@types/jsdom": "^21.1.6",

1
gui/package-lock.json generated
View file

@ -90,6 +90,7 @@
"@aws-sdk/client-bedrock-runtime": "^3.574.0",
"@aws-sdk/credential-providers": "^3.596.0",
"@continuedev/config-types": "^1.0.6",
"@continuedev/llm-info": "^1.0.1",
"@mozilla/readability": "^0.5.0",
"@octokit/rest": "^20.0.2",
"@types/jsdom": "^21.1.6",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1,017 B

View file

@ -11,6 +11,14 @@ const GridDiv = styled.div`
grid-template-columns: 1fr 1fr;
grid-gap: 8px;
align-items: center;
> * {
grid-column: 2;
}
> :nth-last-child(2):first-child {
grid-column: 1;
}
`;
interface ConfirmationDialogProps {
@ -18,6 +26,8 @@ interface ConfirmationDialogProps {
onCancel?: () => void;
text: string;
title?: string;
hideCancelButton?: boolean;
confirmText?: string;
}
function ConfirmationDialog(props: ConfirmationDialogProps) {
@ -29,15 +39,17 @@ function ConfirmationDialog(props: ConfirmationDialogProps) {
<p>{props.text}</p>
<GridDiv>
<SecondaryButton
onClick={() => {
props.onCancel?.();
dispatch(setShowDialog(false));
dispatch(setDialogMessage(undefined));
}}
>
Cancel
</SecondaryButton>
{!!props.hideCancelButton || (
<SecondaryButton
onClick={() => {
props.onCancel?.();
dispatch(setShowDialog(false));
dispatch(setDialogMessage(undefined));
}}
>
Cancel
</SecondaryButton>
)}
<Button
onClick={() => {
props.onConfirm();
@ -45,7 +57,7 @@ function ConfirmationDialog(props: ConfirmationDialogProps) {
dispatch(setDialogMessage(undefined));
}}
>
Confirm
{props.confirmText ?? "Confirm"}
</Button>
</GridDiv>
</div>

View file

@ -4,9 +4,9 @@ import styled from "styled-components";
import {
VSC_BACKGROUND_VAR,
defaultBorderRadius,
lightGray,
parseColorForHex,
vscBackground,
vscFocusBorder,
vscForeground,
} from "..";
@ -32,7 +32,7 @@ const Dialog = styled.div`
border-radius: ${defaultBorderRadius};
display: flex;
flex-direction: column;
border: 1px solid ${vscFocusBorder};
border: 1px solid ${lightGray};
margin: auto;
word-wrap: break-word;
// overflow: hidden;

View file

@ -15,15 +15,16 @@ import FileIcon from "../FileIcon";
const ContextItemDiv = styled.div`
cursor: pointer;
padding-left: 6px;
padding-right: 10px;
padding-top: 6px;
padding-bottom: 6px;
padding: 6px 10px 6px 6px;
margin-left: 4px;
display: flex;
align-items: center;
border-radius: ${defaultBorderRadius};
width: fit-content;
font-size: ${getFontSize()};
max-width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
&:hover {
background-color: #fff1;

View file

@ -170,6 +170,10 @@ function ModelSelect() {
const [options, setOptions] = useState<Option[]>([]);
const selectedProfileId = useSelector(
(store: RootState) => store.state.selectedProfileId,
);
useEffect(() => {
setOptions(
allModels.map((model) => {
@ -227,22 +231,26 @@ function ModelSelect() {
/>
))}
<Divider />
{selectedProfileId === "local" && (
<>
<Divider />
<StyledListboxOption
key={options.length}
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
navigate("/addModel");
}}
value={"addModel" as any}
>
<div className="flex items-center">
<PlusIcon className="w-4 h-4 mr-2" />
Add Model
</div>
</StyledListboxOption>
<StyledListboxOption
key={options.length}
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
navigate("/addModel");
}}
value={"addModel" as any}
>
<div className="flex items-center">
<PlusIcon className="w-4 h-4 mr-2" />
Add Model
</div>
</StyledListboxOption>
</>
)}
<Divider />

View file

@ -4,6 +4,7 @@ import { useDispatch } from "react-redux";
import ConfirmationDialog from "../components/dialogs/ConfirmationDialog";
import { IdeMessengerContext } from "../context/IdeMessenger";
import { setDialogMessage, setShowDialog } from "../redux/slices/uiStateSlice";
import { getLocalStorage, setLocalStorage } from "../util/localStorage";
import { useWebviewListener } from "./useWebviewListener";
export function useAuth(): {
@ -31,7 +32,27 @@ export function useAuth(): {
console.log("login");
ideMessenger
.request("getControlPlaneSessionInfo", { silent: false })
.then(setSession);
.then((session) => {
setSession(session);
// If this is the first time the user has logged in, explain how profiles work
if (!getLocalStorage("shownProfilesIntroduction")) {
dispatch(setShowDialog(true));
dispatch(
setDialogMessage(
<ConfirmationDialog
text={
"Welcome to Continue for teams! Using the toggle in the bottom right, you can switch between your local profile (defined by config.json) and team profiles (defined in the Continue for Teams web app). Each profile defines a set of models, slash commands, context providers, and other settings to customize Continue."
}
hideCancelButton={true}
confirmText="Ok"
onConfirm={() => {}}
/>,
),
);
setLocalStorage("shownProfilesIntroduction", true);
}
});
};
const logout = () => {
@ -39,6 +60,8 @@ export function useAuth(): {
dispatch(
setDialogMessage(
<ConfirmationDialog
hideCancelButton={true}
confirmText="Ok"
text={"Click the user icon in the bottom left of VS Code to log out."}
onConfirm={() => {}}
/>,

View file

@ -26,10 +26,12 @@ import {
vscBackground,
vscForeground,
} from "../components";
import { ChatScrollAnchor } from "../components/ChatScrollAnchor";
import StepContainer from "../components/gui/StepContainer";
import TimelineItem from "../components/gui/TimelineItem";
import ContinueInputBox from "../components/mainInput/ContinueInputBox";
import { defaultInputModifiers } from "../components/mainInput/inputModifiers";
import { TutorialCard } from "../components/mainInput/TutorialCard";
import { IdeMessengerContext } from "../context/IdeMessenger";
import useChatHandler from "../hooks/useChatHandler";
import useHistory from "../hooks/useHistory";
@ -52,10 +54,8 @@ import {
isJetBrains,
isMetaEquivalentKeyPressed,
} from "../util";
import { getLocalStorage, setLocalStorage } from "../util/localStorage";
import { FREE_TRIAL_LIMIT_REQUESTS } from "../util/freeTrial";
import { ChatScrollAnchor } from "../components/ChatScrollAnchor";
import { TutorialCard } from "../components/mainInput/TutorialCard";
import { getLocalStorage, setLocalStorage } from "../util/localStorage";
const TopGuiDiv = styled.div`
overflow-y: scroll;

View file

@ -15,6 +15,7 @@ type LocalStorageTypes = {
signedInToGh: boolean;
isOnboardingInProgress: boolean;
showTutorialCard: boolean;
shownProfilesIntroduction: boolean;
};
export function getLocalStorage<T extends keyof LocalStorageTypes>(

View file

@ -1,29 +0,0 @@
{
"name": "control-plane-types",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "control-plane-types",
"version": "1.0.0",
"license": "Apache-2.0",
"devDependencies": {
"typescript": "^5.5.2"
}
},
"node_modules/typescript": {
"version": "5.5.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.2.tgz",
"integrity": "sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
}
}
}

View file

@ -1,4 +0,0 @@
export interface Test {
a: string;
b: number;
}

View file

@ -1,108 +0,0 @@
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */
/* Projects */
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
/* Language and Environment */
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
/* Modules */
"module": "commonjs", /* Specify what module code is generated. */
// "rootDir": "./", /* Specify the root folder within your source files. */
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
// "resolveJsonModule": true, /* Enable importing .json files. */
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
/* JavaScript Support */
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
/* Emit */
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
// "outDir": "./", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
// "newLine": "crlf", /* Set the newline character for emitting files. */
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
/* Interop Constraints */
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
// "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
/* Type Checking */
"strict": true, /* Enable all strict type-checking options. */
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
}

View file

@ -0,0 +1,3 @@
# @continuedev/llm-info
A lightweight package providing information about various Large Language Models (LLMs).

View file

@ -1,15 +1,18 @@
{
"name": "control-plane-types",
"version": "1.0.0",
"name": "@continuedev/llm-info",
"version": "1.0.1",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc"
},
"author": "Nate Sesti and Ty Dunn",
"license": "Apache-2.0",
"devDependencies": {
"typescript": "^5.5.2"
}
},
"dependencies": {}
}

View file

@ -0,0 +1,18 @@
import { AnthropicLlms } from "./models/anthropic.js";
import { GoogleLlms } from "./models/google.js";
import { MistralLlms } from "./models/mistral.js";
import { OpenAiLlms } from "./models/openai.js";
import { LlmInfo } from "./types.js";
export const allLlms: LlmInfo[] = [
...OpenAiLlms,
...GoogleLlms,
...AnthropicLlms,
...MistralLlms,
];
export function findLlmInfo(model: string): LlmInfo | undefined {
return allLlms.find((llm) =>
llm.regex ? llm.regex.test(model) : llm.model === model,
);
}

View file

@ -0,0 +1,60 @@
import { LlmInfo } from "../types.js";
export const AnthropicLlms: LlmInfo[] = [
{
model: "claude-3-5-sonnet-20240620",
displayName: "Claude 3.5 Sonnet",
contextLength: 200_000,
description:
"Most intelligent model with the highest level of intelligence and capability.",
regex: /claude-3\.5-sonnet/i,
},
{
model: "claude-3-opus-20240229",
displayName: "Claude 3 Opus",
contextLength: 200_000,
description:
"Powerful model for highly complex tasks with top-level performance, intelligence, fluency, and understanding.",
regex: /claude-3-opus/i,
},
{
model: "claude-3-sonnet-20240229",
displayName: "Claude 3 Sonnet",
contextLength: 200_000,
description:
"Balance of intelligence and speed with strong utility, balanced for scaled deployments.",
regex: /claude-3-sonnet/i,
},
{
model: "claude-3-haiku-20240307",
displayName: "Claude 3 Haiku",
contextLength: 200_000,
description:
"Fastest and most compact model for near-instant responsiveness with quick and accurate targeted performance.",
regex: /claude-3-haiku/i,
},
{
model: "claude-2.1",
displayName: "Claude 2.1",
contextLength: 200_000,
description:
"Updated version of Claude 2 with improved accuracy and consistency.",
regex: /claude-2\.1/i,
},
{
model: "claude-2.0",
displayName: "Claude 2",
contextLength: 100_000,
description:
"Predecessor to Claude 3, offering strong all-round performance.",
regex: /claude-2\.0/i,
},
{
model: "claude-instant-1.2",
displayName: "Claude Instant 1.2",
contextLength: 100_000,
description:
"Our cheapest small and fast model, a predecessor of Claude Haiku.",
regex: /claude-instant-1\.2/i,
},
];

View file

@ -0,0 +1,22 @@
import { AllMediaTypes, LlmInfo } from "../types.js";
export const GoogleLlms: LlmInfo[] = [
{
model: "gemini-1.5-flash",
displayName: "Gemini 1.5 Flash",
contextLength: 1_048_576,
mediaTypes: AllMediaTypes,
regex: /gemini-1\.5-flash/i,
},
{
model: "gemini-1.5-pro",
displayName: "Gemini 1.5 Pro",
contextLength: 2_097_152,
regex: /gemini-1\.5-pro/i,
},
{
model: "gemini-1.0-pro",
displayName: "Gemini 1.0 Pro",
regex: /gemini-1\.0-pro/i,
},
];

View file

@ -0,0 +1,68 @@
import { LlmInfo } from "../types.js";
export const MistralLlms: LlmInfo[] = [
{
model: "mistral-large-latest",
displayName: "Mistral Large",
contextLength: 32768,
description:
"Flagship model ideal for complex tasks requiring large reasoning capabilities or highly specialized tasks like synthetic text generation, code generation, RAG, or agents.",
regex: /mistral-large/i,
},
{
model: "mistral-medium-latest",
displayName: "Mistral Medium",
contextLength: 32768,
description:
"Ideal for intermediate tasks requiring moderate reasoning such as data extraction, document summarization, email writing, job descriptions, or product descriptions. (Note: Will be deprecated in the coming months)",
regex: /mistral-medium/i,
},
{
model: "mistral-small-latest",
displayName: "Mistral Small",
contextLength: 32768,
description:
"Suitable for simple tasks that can be done in bulk like classification, customer support, or text generation.",
regex: /mistral-small/i,
},
{
model: "open-mistral-7b",
displayName: "Mistral 7B",
contextLength: 32768,
description:
"First dense model released by Mistral AI, perfect for experimentation, customization, and quick iteration. Matches capabilities of models up to 30B parameters at release time.",
regex: /open-mistral-7b/i,
},
{
model: "open-mixtral-8x7b",
displayName: "Mixtral 8x7B",
contextLength: 32768,
description:
"Sparse mixture of experts model leveraging up to 45B parameters but using about 12B during inference, offering better inference throughput at the cost of more vRAM.",
regex: /open-mixtral-8x7b/i,
},
{
model: "open-mixtral-8x22b",
displayName: "Mixtral 8x22B",
contextLength: 65536,
description:
"Larger sparse mixture of experts model leveraging up to 141B parameters but using about 39B during inference, providing better inference throughput at the cost of more vRAM.",
regex: /open-mixtral-8x22b/i,
},
{
model: "mistral-embed",
displayName: "Mistral Embeddings",
contextLength: 8192,
description:
"Model that converts text into numerical vectors of embeddings in 1024 dimensions. Enables retrieval and retrieval-augmented generation applications with a retrieval score of 55.26 on MTEB.",
regex: /mistral-embed/i,
},
{
model: "codestral-latest",
displayName: "Codestral",
contextLength: 32768,
description:
"Cutting-edge generative model specifically designed and optimized for code generation tasks, including fill-in-the-middle and code completion.",
regex: /codestral/i,
},
];

View file

@ -0,0 +1,69 @@
import { LlmInfo } from "../types.js";
export const OpenAiLlms: LlmInfo[] = [
{
model: "gpt-3.5-turbo",
displayName: "GPT-3.5 Turbo",
contextLength: 4096,
},
{
model: "gpt-3.5-turbo-0613",
displayName: "GPT-3.5 Turbo (0613)",
contextLength: 4096,
},
{
model: "gpt-3.5-turbo-16k",
displayName: "GPT-3.5 Turbo 16K",
contextLength: 16384,
},
{
model: "gpt-35-turbo-16k",
displayName: "GPT-3.5 Turbo 16K",
contextLength: 16384,
},
{
model: "gpt-35-turbo-0613",
displayName: "GPT-3.5 Turbo (0613)",
contextLength: 4096,
},
{
model: "gpt-35-turbo",
displayName: "GPT-3.5 Turbo",
contextLength: 4096,
},
{
model: "gpt-4",
displayName: "GPT-4",
contextLength: 4096,
},
{
model: "gpt-4-32k",
displayName: "GPT-4 32K",
contextLength: 4096,
},
{
model: "gpt-4-turbo-preview",
displayName: "GPT-4 Turbo Preview",
contextLength: 4096,
},
{
model: "gpt-4o",
displayName: "GPT-4o",
contextLength: 4096,
},
{
model: "gpt-4-vision",
displayName: "GPT-4 Vision",
contextLength: 4096,
},
{
model: "gpt-4-0125-preview",
displayName: "GPT-4 (0125 Preview)",
contextLength: 4096,
},
{
model: "gpt-4-1106-preview",
displayName: "GPT-4 (1106 Preview)",
contextLength: 4096,
},
];

View file

@ -0,0 +1,30 @@
export interface LlmInfo {
model: string;
displayName?: string;
description?: string;
contextLength?: number;
regex?: RegExp;
/** If not set, assumes "text" only */
mediaTypes?: MediaType[];
}
export enum MediaType {
Text = "text",
Image = "image",
Audio = "audio",
Video = "video",
}
export const AllMediaTypes = [
MediaType.Text,
MediaType.Image,
MediaType.Audio,
MediaType.Video,
];
export interface ApiProviderInfo {
displayName: string;
supportsStreaming: boolean;
handlesTemplating: boolean;
}

View file

@ -0,0 +1,23 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "NodeNext",
"useDefineForClassFields": true,
"lib": ["DOM", "ESNext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "NodeNext",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmitOnError": false,
"types": ["node"],
"outDir": "dist",
"declaration": true
// "sourceMap": true
},
"include": ["src/**/*"]
}