mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
refactor: update API options and remove unused type definitions
This commit is contained in:
86
src/types/vscode.d.ts
vendored
86
src/types/vscode.d.ts
vendored
@@ -1,86 +0,0 @@
|
|||||||
declare namespace vscode {
|
|
||||||
enum LanguageModelChatMessageRole {
|
|
||||||
User = 1,
|
|
||||||
Assistant = 2
|
|
||||||
}
|
|
||||||
|
|
||||||
enum LanguageModelChatToolMode {
|
|
||||||
Auto = 1,
|
|
||||||
Required = 2
|
|
||||||
}
|
|
||||||
|
|
||||||
interface LanguageModelChatSelector {
|
|
||||||
vendor?: string;
|
|
||||||
family?: string;
|
|
||||||
version?: string;
|
|
||||||
id?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface LanguageModelChatTool {
|
|
||||||
name: string;
|
|
||||||
description: string;
|
|
||||||
inputSchema?: object;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface LanguageModelChatRequestOptions {
|
|
||||||
justification?: string;
|
|
||||||
modelOptions?: { [name: string]: any; };
|
|
||||||
tools?: LanguageModelChatTool[];
|
|
||||||
toolMode?: LanguageModelChatToolMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
class LanguageModelTextPart {
|
|
||||||
value: string;
|
|
||||||
constructor(value: string);
|
|
||||||
}
|
|
||||||
|
|
||||||
class LanguageModelToolCallPart {
|
|
||||||
callId: string;
|
|
||||||
name: string;
|
|
||||||
input: object;
|
|
||||||
constructor(callId: string, name: string, input: object);
|
|
||||||
}
|
|
||||||
|
|
||||||
interface LanguageModelChatResponse {
|
|
||||||
stream: AsyncIterable<LanguageModelTextPart | LanguageModelToolCallPart | unknown>;
|
|
||||||
text: AsyncIterable<string>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface LanguageModelChat {
|
|
||||||
readonly name: string;
|
|
||||||
readonly id: string;
|
|
||||||
readonly vendor: string;
|
|
||||||
readonly family: string;
|
|
||||||
readonly version: string;
|
|
||||||
readonly maxInputTokens: number;
|
|
||||||
|
|
||||||
sendRequest(messages: LanguageModelChatMessage[], options?: LanguageModelChatRequestOptions, token?: CancellationToken): Thenable<LanguageModelChatResponse>;
|
|
||||||
countTokens(text: string | LanguageModelChatMessage, token?: CancellationToken): Thenable<number>;
|
|
||||||
}
|
|
||||||
|
|
||||||
class LanguageModelPromptTsxPart {
|
|
||||||
value: unknown;
|
|
||||||
constructor(value: unknown);
|
|
||||||
}
|
|
||||||
|
|
||||||
class LanguageModelToolResultPart {
|
|
||||||
callId: string;
|
|
||||||
content: Array<LanguageModelTextPart | LanguageModelPromptTsxPart | unknown>;
|
|
||||||
constructor(callId: string, content: Array<LanguageModelTextPart | LanguageModelPromptTsxPart | unknown>);
|
|
||||||
}
|
|
||||||
|
|
||||||
class LanguageModelChatMessage {
|
|
||||||
static User(content: string | Array<LanguageModelTextPart | LanguageModelToolResultPart>, name?: string): LanguageModelChatMessage;
|
|
||||||
static Assistant(content: string | Array<LanguageModelTextPart | LanguageModelToolCallPart>, name?: string): LanguageModelChatMessage;
|
|
||||||
|
|
||||||
role: LanguageModelChatMessageRole;
|
|
||||||
content: Array<LanguageModelTextPart | LanguageModelToolResultPart | LanguageModelToolCallPart>;
|
|
||||||
name: string | undefined;
|
|
||||||
|
|
||||||
constructor(role: LanguageModelChatMessageRole, content: string | Array<LanguageModelTextPart | LanguageModelToolResultPart | LanguageModelToolCallPart>, name?: string);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace lm {
|
|
||||||
function selectChatModels(selector?: LanguageModelChatSelector): Thenable<LanguageModelChat[]>;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -34,6 +34,7 @@ import {
|
|||||||
import { ExtensionMessage } from "../../../../src/shared/ExtensionMessage"
|
import { ExtensionMessage } from "../../../../src/shared/ExtensionMessage"
|
||||||
import { useExtensionState } from "../../context/ExtensionStateContext"
|
import { useExtensionState } from "../../context/ExtensionStateContext"
|
||||||
import { vscode } from "../../utils/vscode"
|
import { vscode } from "../../utils/vscode"
|
||||||
|
import * as vscodemodels from "vscode"
|
||||||
import VSCodeButtonLink from "../common/VSCodeButtonLink"
|
import VSCodeButtonLink from "../common/VSCodeButtonLink"
|
||||||
import OpenRouterModelPicker, {
|
import OpenRouterModelPicker, {
|
||||||
ModelDescriptionMarkdown,
|
ModelDescriptionMarkdown,
|
||||||
@@ -52,7 +53,7 @@ const ApiOptions = ({ showModelOptions, apiErrorMessage, modelIdErrorMessage }:
|
|||||||
const { apiConfiguration, setApiConfiguration, uriScheme } = useExtensionState()
|
const { apiConfiguration, setApiConfiguration, uriScheme } = useExtensionState()
|
||||||
const [ollamaModels, setOllamaModels] = useState<string[]>([])
|
const [ollamaModels, setOllamaModels] = useState<string[]>([])
|
||||||
const [lmStudioModels, setLmStudioModels] = useState<string[]>([])
|
const [lmStudioModels, setLmStudioModels] = useState<string[]>([])
|
||||||
const [vsCodeLmModels, setVsCodeLmModels] = useState<vscode.LanguageModelChatSelector[]>([])
|
const [vsCodeLmModels, setVsCodeLmModels] = useState<vscodemodels.LanguageModelChatSelector[]>([])
|
||||||
const [anthropicBaseUrlSelected, setAnthropicBaseUrlSelected] = useState(!!apiConfiguration?.anthropicBaseUrl)
|
const [anthropicBaseUrlSelected, setAnthropicBaseUrlSelected] = useState(!!apiConfiguration?.anthropicBaseUrl)
|
||||||
const [azureApiVersionSelected, setAzureApiVersionSelected] = useState(!!apiConfiguration?.azureApiVersion)
|
const [azureApiVersionSelected, setAzureApiVersionSelected] = useState(!!apiConfiguration?.azureApiVersion)
|
||||||
const [isDescriptionExpanded, setIsDescriptionExpanded] = useState(false)
|
const [isDescriptionExpanded, setIsDescriptionExpanded] = useState(false)
|
||||||
|
|||||||
8
webview-ui/src/types/vscode.d.ts
vendored
8
webview-ui/src/types/vscode.d.ts
vendored
@@ -1,8 +0,0 @@
|
|||||||
declare namespace vscode {
|
|
||||||
interface LanguageModelChatSelector {
|
|
||||||
vendor?: string;
|
|
||||||
family?: string;
|
|
||||||
version?: string;
|
|
||||||
id?: string;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user