diff --git a/.changeset/khaki-cobras-heal.md b/.changeset/khaki-cobras-heal.md new file mode 100644 index 0000000000000000000000000000000000000000..43b94a7570b51821aa176820ea6ff97f12fe7ce7 --- /dev/null +++ b/.changeset/khaki-cobras-heal.md @@ -0,0 +1,5 @@ +--- +"create-llama": patch +--- + +Deactive duckduckgo tool for TS diff --git a/.changeset/strange-icons-walk.md b/.changeset/strange-icons-walk.md new file mode 100644 index 0000000000000000000000000000000000000000..4e877a4346763f5ab1b8605527fc578fbd1bd2af --- /dev/null +++ b/.changeset/strange-icons-walk.md @@ -0,0 +1,5 @@ +--- +"create-llama": patch +--- + +Replace DuckDuckGo by Wikipedia tool for agentic template diff --git a/create-app.ts b/create-app.ts index c90c8c5d0319f319e51a4f819742654427818667..8849c0fb9cda6ce274612355e2fcd0a35f59ff97 100644 --- a/create-app.ts +++ b/create-app.ts @@ -10,9 +10,9 @@ import { makeDir } from "./helpers/make-dir"; import terminalLink from "terminal-link"; import type { InstallTemplateArgs, TemplateObservability } from "./helpers"; import { installTemplate } from "./helpers"; -import { writeDevcontainer } from "./helpers/devcontainer"; import { templatesDir } from "./helpers/dir"; import { toolsRequireConfig } from "./helpers/tools"; +import { configVSCode } from "./helpers/vscode"; export type InstallAppArgs = Omit< InstallTemplateArgs, @@ -105,7 +105,7 @@ export async function createApp({ }); } - await writeDevcontainer(root, templatesDir, framework, frontend); + await configVSCode(root, templatesDir, framework); process.chdir(root); if (tryGitInit(root)) { diff --git a/helpers/copy.ts b/helpers/copy.ts index 8543c692591d3da1a7f0be759be730bf4fc649e7..2568d836ef8b0a6003b944d7fb5a3db698587ae6 100644 --- a/helpers/copy.ts +++ b/helpers/copy.ts @@ -61,6 +61,9 @@ export const assetRelocator = (name: string) => { case "README-template.md": { return "README.md"; } + case "vscode_settings.json": { + return "settings.json"; + } default: { return name; } diff --git a/helpers/tools.ts b/helpers/tools.ts index 2be926369ae782071b1d3a83c856a3f92eecc28d..5d3ab929f25715c53eaffb690968e0ad9c835cd8 100644 --- a/helpers/tools.ts +++ b/helpers/tools.ts @@ -65,7 +65,7 @@ export const supportedTools: Tool[] = [ version: "^6.3.5", }, ], - supportedFrameworks: ["fastapi", "nextjs", "express"], + supportedFrameworks: ["fastapi"], // TODO: Re-enable this tool once the duck-duck-scrape TypeScript library works again type: ToolType.LOCAL, envVars: [ { diff --git a/helpers/devcontainer.ts b/helpers/vscode.ts similarity index 69% rename from helpers/devcontainer.ts rename to helpers/vscode.ts index 153add212e482898aafb0c9e3d5f230e467abdaa..e986a55be21453f25b0efd29fd2a422a0d81283f 100644 --- a/helpers/devcontainer.ts +++ b/helpers/vscode.ts @@ -1,5 +1,6 @@ import fs from "fs"; import path from "path"; +import { assetRelocator, copy } from "./copy"; import { TemplateFramework } from "./types"; function renderDevcontainerContent( @@ -29,7 +30,6 @@ export const writeDevcontainer = async ( root: string, templatesDir: string, framework: TemplateFramework, - frontend: boolean, ) => { const devcontainerDir = path.join(root, ".devcontainer"); if (fs.existsSync(devcontainerDir)) { @@ -46,3 +46,25 @@ export const writeDevcontainer = async ( devcontainerContent, ); }; + +export const copyVSCodeSettings = async ( + root: string, + templatesDir: string, +) => { + const vscodeDir = path.join(root, ".vscode"); + await copy("vscode_settings.json", vscodeDir, { + cwd: templatesDir, + rename: assetRelocator, + }); +}; + +export const configVSCode = async ( + root: string, + templatesDir: string, + framework: TemplateFramework, +) => { + await writeDevcontainer(root, templatesDir, framework); + if (framework === "fastapi") { + await copyVSCodeSettings(root, templatesDir); + } +}; diff --git a/questions/simple.ts b/questions/simple.ts index 16052b39ce5db3dcb3e2922d465d04c57f4cfc83..8571021fc5ff2bf535f32e0ebbfd97e3c3ca8a8c 100644 --- a/questions/simple.ts +++ b/questions/simple.ts @@ -131,7 +131,7 @@ const convertAnswers = async ( > = { rag: { template: "streaming", - tools: getTools(["duckduckgo"]), + tools: getTools(["wikipedia.WikipediaToolSpec"]), frontend: true, dataSources: [EXAMPLE_FILE], }, diff --git a/templates/components/services/python/suggestion.py b/templates/components/services/python/suggestion.py index 7959088ed3edf877088bb73cb8dcb37b0c7827a9..015065fea3306248c6d16e0c57b938f8696edcb8 100644 --- a/templates/components/services/python/suggestion.py +++ b/templates/components/services/python/suggestion.py @@ -60,10 +60,12 @@ class NextQuestionSuggestion: return None @classmethod - def _extract_questions(cls, text: str) -> List[str]: + def _extract_questions(cls, text: str) -> List[str] | None: content_match = re.search(r"```(.*?)```", text, re.DOTALL) - content = content_match.group(1) if content_match else "" - return content.strip().split("\n") + content = content_match.group(1) if content_match else None + if not content: + return None + return [q.strip() for q in content.split("\n") if q.strip()] @classmethod async def suggest_next_questions( diff --git a/templates/vscode_settings.json b/templates/vscode_settings.json new file mode 100644 index 0000000000000000000000000000000000000000..5be766aaaa2b7e140777ece27b834fe4c70ebea0 --- /dev/null +++ b/templates/vscode_settings.json @@ -0,0 +1,3 @@ +{ + "python.envFile": "" +}