Skip to content

Commit

Permalink
templates list pulled from constants
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodacus committed Nov 14, 2024
1 parent 2a684b4 commit e635984
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 20 deletions.
4 changes: 1 addition & 3 deletions app/components/chat/ToolManager.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { IconButton } from '../ui/IconButton';
import { Popover, PopoverContent, PopoverTrigger } from '../ui/Popover';
import { ToggleSwitch } from '../ui/ToggleSwitch';
import type { IToolsConfig } from '~/utils/types';

Expand All @@ -17,7 +15,7 @@ export function ToolManager({ toolConfig, onConfigChange }: ToolManagerProps) {
<label className="text-sm text-bolt-elements-textSecondary">Tool Calling</label>
<ToggleSwitch
checked={toolConfig.enabled}
onCheckedChange={(e) => {
onCheckedChange={(e: boolean) => {
onConfigChange?.({
enabled: e,
config: toolConfig.config,
Expand Down
14 changes: 4 additions & 10 deletions app/lib/.server/llm/tools.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { z } from 'zod';
import { tool } from 'ai';
import { TEMPLATE_LIST } from '~/utils/constants';
let templates = TEMPLATE_LIST.map(x => x.name) as [string, ...string[]];
export default {
SelectCodeTemplate: tool({
description: `Use this to select one single code template best suited for the user query,
Expand All @@ -8,18 +10,10 @@ export default {
* START FROM SCRATCH IF User Says 'No'
* ONLY SELECT ONE TEMPLATE.
* ONLY Call this tool once.
* DO NOT CALL THIS TOOL IF there is no matching templates found
`,
parameters: z.object({
template: z.enum([
'blank',
'vite-react-js',
'vite-react-ts',
'vite-svelte',
'vite-vue',
'nextjs',
'vite-react-tailwind',
'vite-react-shadcn',
'python']),
template: z.enum([...templates]),
}),
// execute: async ({ template }) => template,
}),
Expand Down
7 changes: 0 additions & 7 deletions app/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,6 @@ const staticModels: ModelInfo[] = [

const codeTemplates: TemplateInfo[] = [
{ name: 'vite-react-js', label: 'Vite React JS', githubRepo: 'thecodacus/vite-react-ts-template' },
{ name: 'vite-react-ts', label: 'Vite React TS', githubRepo: 'thecodacus/vite-react-ts-template' },
{ name: 'vite-svelte', label: 'Vite Svelte', githubRepo: 'thecodacus/vite-react-ts-template' },
{ name: 'vite-vue', label: 'Vite Vue', githubRepo: 'thecodacus/vite-react-ts-template' },
{ name: 'nextjs', label: 'NextJS', githubRepo: 'thecodacus/vite-react-ts-template' },
{ name: 'vite-react-tailwind', label: 'Vite React Tailwind', githubRepo: 'thecodacus/vite-react-ts-template' },
{ name: 'vite-react-shadcn', label: 'Vite React Shadcn', githubRepo: 'thecodacus/vite-react-ts-template' },
{ name: 'python', label: 'Python', githubRepo: 'thecodacus/vite-react-ts-template' },
];

export let MODEL_LIST: ModelInfo[] = [...staticModels];
Expand Down

0 comments on commit e635984

Please sign in to comment.