Skip to content

Commit

Permalink
chore: remove old comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyrxng committed Oct 25, 2023
1 parent 3da8f6f commit 4134d3f
Showing 1 changed file with 0 additions and 91 deletions.
91 changes: 0 additions & 91 deletions src/handlers/comment/handlers/ask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,97 +143,6 @@ export const ask = async (body: string) => {
const gptAnswer = typeof gptDecidedContext === "string" ? gptDecidedContext : gptDecidedContext.answer || "";
const contextTokens = encodee(cleanText(gptAnswer));

// console.log("gptDecidedContext", gptDecidedContext);
// console.log("contextTokens", contextTokens);

// const commentBeforeQuestion = streamlined[streamlined.length - 2];
// const secondLast = streamlined[streamlined.length - 3];

// const latestComments = [commentBeforeQuestion, secondLast];

// const fmLatestComments = formatChat(latestComments);

// const fmStreamlined = formatChat(streamlined);

// const formats = [
// {
// quarter: "1st",
// content: `IssueSpec: + ${issue.body} \n LastTwoComments: ${fmLatestComments} \n Question: ${body}`,
// current: contextTokens,
// },
// {
// quarter: "2nd",
// content: `IssueSpec: + ${issue.body} \n LinkedIssueContext: ${formatChat(
// linkedIssueStreamlined
// )}\n LastTwoComments: ${fmLatestComments} \n Question: ${body}`,
// current: contextTokens,
// },
// {
// quarter: "3rd",
// content: `IssueSpec: + ${issue.body} \n LinkedIssueContext: ${formatChat(linkedIssueStreamlined)}\n LinkedPRContext: ${formatChat(
// linkedPRStreamlined
// )} LastTwoComments: ${latestComments} \n Question: ${body}`,
// current: contextTokens,
// },
// {
// quarter: "4th",
// content: `IssueSpec: + ${issue.body} \n LinkedIssueContext: ${formatChat(linkedIssueStreamlined)}\n LinkedPRContext: ${formatChat(
// linkedPRStreamlined
// )} CurrentIssueComments: ${fmStreamlined} \n Question: ${body}`,
// current: contextTokens,
// },
// ];

// const remainingTokens = (s: string) => {
// const max = 4096;
// const tokens = encodee(s).length;
// let nextActiveFourth = "";

// if (tokens < max / 4) {
// nextActiveFourth = "1st";
// } else if (tokens < max / 2) {
// nextActiveFourth = "2nd";
// } else if (tokens < (max / 4) * 3) {
// nextActiveFourth = "3rd";
// } else if (tokens < max) {
// nextActiveFourth = "4th";
// } else {
// nextActiveFourth = "Max";
// }

// const remaining = {
// content: s,
// current: tokens + formats[0].current,
// quarter: nextActiveFourth,
// };

// return remaining;
// };

// let selectedFormat = "";
// let closestTokenCount = 0;

// for (const format of formats) {
// const tokenCount = remainingTokens(cleanText(format.content)).current;
// if (tokenCount > closestTokenCount && tokenCount < 4096) {
// closestTokenCount = tokenCount;
// selectedFormat = format.content;
// }
// }

// if (selectedFormat === "") {
// return "Format selection failed.";
// }

// console.log("========================");
// console.log("=== selectedFormat ===", selectedFormat);

// const { quarter, current } = remainingTokens(cleanText(selectedFormat));

// if (current >= 4096) {
// return "Format selection failed.";
// }

chatHistory = [];

const tokenSize = contextTokens.length + encodee(body).length;
Expand Down

0 comments on commit 4134d3f

Please sign in to comment.