Skip to content

Commit

Permalink
better handling of starting the prmpt
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Apr 29, 2024
1 parent 7412363 commit 47782ab
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 13 deletions.
14 changes: 12 additions & 2 deletions packages/core/src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,23 @@ export function generatePromptFooConfiguration(
text: {
id: "azureopenai:chat:gpt-4",
config: {
apiHost: testProvider,
apiHost: testProvider
.replace(/^https:\/\//i, "")
.replace(
/\/openai\/deployments$/i,
""
),
},
},
embedding: {
id: "azureopenai:embeddings:text-embedding-ada-002",
config: {
apiHost: testProvider,
apiHost: testProvider
.replace(/^https:\/\//i, "")
.replace(
/\/openai\/deployments$/i,
""
),
},
},
}
Expand Down
28 changes: 17 additions & 11 deletions packages/vscode/src/fragmentcommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,23 @@ async function showPromptParametersQuickPicks(
}

async function startTestViewer() {
// show results
const url = "http://localhost:15500"
const terminal = vscode.window.createTerminal({
name: "Promptfoo viewer",
isTransient: true,
env: {
PROMPTFOO_DISABLE_TELEMETRY: "1",
PROMPTFOO_DISABLE_UPDATE: "1",
},
})
terminal.sendText(`npx --yes promptfoo@latest view -y`)
const name = "Promptfoo View"
if (vscode.window.terminals.find((t) => t.name === name)) {
await vscode.env.openExternal(
vscode.Uri.parse("http://localhost:15500")
)
} else {
// show results
const terminal = vscode.window.createTerminal({
name,
isTransient: true,
env: {
PROMPTFOO_DISABLE_TELEMETRY: "1",
PROMPTFOO_DISABLE_UPDATE: "1",
},
})
terminal.sendText(`npx --yes promptfoo@latest view -y`)
}
}

export function activateFragmentCommands(state: ExtensionState) {
Expand Down

0 comments on commit 47782ab

Please sign in to comment.