Skip to content

Commit

Permalink
curl escape (#534)
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan authored Jun 11, 2024
1 parent 5483560 commit 2f19b60
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion docs/src/content/docs/guides/pull-request-reviewer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ The reviewer can also suggest changes to the code, documentation, or other files

The output of the LLM is inserted as a comment in the pull request conversation
(and updated as needed to avoid duplicates).
Here is an [example](https://github.com/microsoft/genaiscript/pull/504#issuecomment-2145273728) in the GenAIScript repository.

Here is an [pull request](https://github.com/microsoft/genaiscript/pull/534) in the GenAIScript repository
with genai-generated description, comments and reviews.

## Step 1: The script

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ export const OpenAIChatCompletion: ChatCompletionHandler = async (

trace.detailsFenced(
`✉️ fetch`,
`curl ${url} \\
`curl -X POST ${url} \\
-H "Content-Type: application/json" \\
${Object.entries(cfg.curlHeaders || {})
.map(([k, v]) => `-H "${k}: ${v}" \\`)
.join("\n")}
-d '${JSON.stringify(postReq, null, 2)}'
-d '${JSON.stringify(postReq).replace(/'/g, "'\\''")}'
`,
"bash"
)
Expand Down
3 changes: 3 additions & 0 deletions packages/vscode/src/vshost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@ export class VSCodeHost extends EventTarget implements Host {
})
if (!azureToken) throw new Error("Azure token not available")
tok.token = "Bearer " + azureToken
tok.curlHeaders = {
Authorization: "Bearer ***",
}
}
return tok
}
Expand Down

0 comments on commit 2f19b60

Please sign in to comment.