Skip to content

Commit

Permalink
Additonal debugging messages to be removed
Browse files Browse the repository at this point in the history
  • Loading branch information
andychase committed Sep 23, 2024
1 parent 325b39e commit ee63c28
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 24 deletions.
6 changes: 3 additions & 3 deletions pages/api/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ const handler = async (req: Request): Promise<Response> => {
tokenCount += tokens.length;
messagesToSend = [message, ...messagesToSend];
}
console.log("!!!HEADERS!!!");
console.log(req.headers);
// console.log("!!!HEADERS!!!");
// console.log(req.headers);
var principalName:string|null = req.headers.get("x-ms-client-principal-name");
var bearer:string|null =req.headers.get("x-ms-token-aad-access-token")? req.headers.get("x-ms-token-aad-access-token") : req.headers.get("x-ms-client-principal");
var bearerAuth: string|null = req.headers.get("x-ms-client-principal-id");
const userName = req.headers.get("x-ms-client-principal-name")
console.log("principalName:" + principalName);
console.log("bearer:" + bearer);
// console.log("bearer:" + bearer);
encoding.free();


Expand Down
8 changes: 0 additions & 8 deletions pages/api/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,7 @@ const handler = async (req: Request): Promise<Response> => {
url = `${OPENAI_API_HOST}/openai/deployments?api-version=${OPENAI_API_VERSION}`;
}

console.log("models.ts - about to get the model credentials");
//to test we are always getting the token we need to change this
//const credential = getAzureCredential();
let token = await getAuthToken();
//console.log("auth token:"+to);

console.log("load the models: " + url) ;
console.log("model headers");
console.log(req.headers);

const response = await fetch(url, {
method: 'post',
Expand Down
13 changes: 0 additions & 13 deletions utils/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,8 @@ export const OpenAIStream = async (
let url = `${OPENAI_API_HOST}/v1/chat/completions`;
if (OPENAI_API_TYPE === 'azure') {
url = `${OPENAI_API_HOST}/openai/deployments/${AZURE_DEPLOYMENT_ID}/chat/completions?api-version=${OPENAI_API_VERSION}`;
console.log(url);
}
console.log("about to get credential");
//let token = getCache("cachedToken");
//console.log("auth token:",token);
//let token = process.env.AUTH_TOKEN ? JSON.parse(process.env.AUTH_TOKEN) : '';
let token = await getAuthToken();
console.log("auth token:",token);

const header = {
'Content-Type': 'application/json',
Expand Down Expand Up @@ -89,18 +83,12 @@ export const OpenAIStream = async (
stream: true,
};

//console.log("!!!Sending to APIM!!!")
console.log("URL: " + url);
//console.log("Header: " + JSON.stringify(header));
console.log("Messages: " +JSON.stringify(body));
const res = await fetch(url, {
headers: header,
method: 'post',
body: JSON.stringify(body),
});



const encoder = new TextEncoder();
const decoder = new TextDecoder();
const loggingObjectTempResult:string[] = [];
Expand All @@ -110,7 +98,6 @@ export const OpenAIStream = async (
result: ""
};

console.debug("get Chat");
if (res.status !== 200) {
const result = await res.json();
if (result.error) {
Expand Down

0 comments on commit ee63c28

Please sign in to comment.