From d993289c3569b2e94bbe55bda0516180af8ae30b Mon Sep 17 00:00:00 2001 From: rjmacarthy Date: Tue, 9 Apr 2024 20:27:09 +0100 Subject: [PATCH] clean up --- src/common/constants.ts | 9 --------- src/extension/fim-templates.ts | 14 ++------------ src/webview/providers.tsx | 4 ++-- 3 files changed, 4 insertions(+), 23 deletions(-) diff --git a/src/common/constants.ts b/src/common/constants.ts index 9bb5de57..07719a18 100644 --- a/src/common/constants.ts +++ b/src/common/constants.ts @@ -132,15 +132,6 @@ export const DEFAULT_PROVIDER_FORM_VALUES = { type: 'chat' } -export const FIM_TEMPLATE_TYPE = [ - 'automatic', - 'stable-code', - 'codellama', - 'deepseek', - 'starcoder', - 'custom-template' -] - export const WASM_LANGAUAGES: { [key: string]: string } = { cpp: 'cpp', hpp: 'cpp', diff --git a/src/extension/fim-templates.ts b/src/extension/fim-templates.ts index 45554974..ab3f4465 100644 --- a/src/extension/fim-templates.ts +++ b/src/extension/fim-templates.ts @@ -3,7 +3,7 @@ import { STOP_DEEPSEEK, STOP_LLAMA, STOP_STARCODER, - STOP_CODEGEMMA, + STOP_CODEGEMMA } from '../common/constants' import { supportedLanguages } from '../common/languages' import { FimPromptTemplate } from '../common/types' @@ -74,19 +74,9 @@ export const getFimPromptTemplateStableCode = ({ } export const getFimPromptTemplateCodegemma = ({ - context, - header, - useFileContext, - prefixSuffix, - language + prefixSuffix }: FimPromptTemplate) => { const { prefix, suffix } = prefixSuffix - const languageId = - supportedLanguages[language as keyof typeof supportedLanguages] - const fileContext = useFileContext - ? `${languageId?.syntaxComments?.start}${context}${languageId?.syntaxComments?.end}` - : '' - const heading = header ? header : '' return `<|fim_prefix|>${prefix}<|fim_suffix|>${suffix}<|fim_middle|>` } diff --git a/src/webview/providers.tsx b/src/webview/providers.tsx index c22c0653..2640bcc1 100644 --- a/src/webview/providers.tsx +++ b/src/webview/providers.tsx @@ -14,7 +14,7 @@ import styles from './providers.module.css' import { TwinnyProvider } from '../extension/provider-manager' import { DEFAULT_PROVIDER_FORM_VALUES, - FIM_TEMPLATE_TYPE + FIM_TEMPLATE_FORMAT, } from '../common/constants' export const Providers = () => { @@ -223,7 +223,7 @@ function ProviderForm({ onClose, provider }: ProviderFormProps) { onChange={handleChangeDropdown} value={formState.fimTemplate} > - {FIM_TEMPLATE_TYPE.map((type, index) => ( + {Object.values(FIM_TEMPLATE_FORMAT).map((type, index) => ( {type}