Skip to content

Commit

Permalink
hotfix create experiment from prompt just created in ui (#3349)
Browse files Browse the repository at this point in the history
  • Loading branch information
kavinvalli authored Mar 1, 2025
1 parent 1a74b55 commit c9fdab6
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions valhalla/jawn/src/managers/prompt/PromptManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,17 @@ export class PromptManager extends BaseManager {
);
}

const createPromptInputKeysResult = await this.createPromptInputKeys(
insertVersionResult.data[0].id,
JSON.stringify(params.prompt)
);

if (createPromptInputKeysResult.error) {
return err(
`Failed to create prompt input keys: ${createPromptInputKeysResult.error}`
);
}

return ok({
id: promptId,
prompt_version_id: insertVersionResult.data[0].id,
Expand Down Expand Up @@ -848,11 +859,16 @@ export class PromptManager extends BaseManager {

// Helper function to find keys in a string
const findKeys = (str: string): string[] => {
const regex = /<helicone-prompt-input key="([^"]+)"\s*\/>/g;
const regex = /<helicone-prompt-input key=\\?"([^"]+)\\?"\s*\/>/g;
const matches = str.match(regex);
return matches
? matches.map((match) =>
match.replace(/<helicone-prompt-input key="|"\s*\/>/g, "")
match
.replace(
/<helicone-prompt-input key=\\?"(.*?)\\?"\s*\/>/g,
"$1"
)
.replace(/\\/g, "")
)
: [];
};
Expand Down

0 comments on commit c9fdab6

Please sign in to comment.