From 0b739e652cfff11a644432e43bc432cabc1718c9 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 16 Aug 2024 22:56:20 +0000 Subject: [PATCH] passing parameters from vscode to server --- packages/core/src/parameters.ts | 5 +++++ packages/vscode/src/state.ts | 2 ++ 2 files changed, 7 insertions(+) diff --git a/packages/core/src/parameters.ts b/packages/core/src/parameters.ts index 48ba8b5c1a..5d607786ad 100644 --- a/packages/core/src/parameters.ts +++ b/packages/core/src/parameters.ts @@ -123,3 +123,8 @@ export function parsePromptParameters( } return Object.freeze(res) } + +export function parametersToVars(parameters: PromptParameters): string[] { + if (!parameters) return undefined + return Object.keys(parameters).map((k) => `${k}=${parameters[k]}`) +} diff --git a/packages/vscode/src/state.ts b/packages/vscode/src/state.ts index 95c5d1feac..37473112f6 100644 --- a/packages/vscode/src/state.ts +++ b/packages/vscode/src/state.ts @@ -34,6 +34,7 @@ import { } from "../../core/src/util" import { CORE_VERSION } from "../../core/src/version" import { Fragment, GenerationResult } from "../../core/src/generation" +import { parametersToVars } from "../../core/src/parameters" export const FRAGMENTS_CHANGE = "fragmentsChange" export const AI_REQUEST_CHANGE = "aiRequestChange" @@ -331,6 +332,7 @@ tests/ partialCb, label, cache: cache && template.cache, + vars: parametersToVars(options.parameters), } ) r.runId = runId