Codename_A
Codename_A
Explore posts from servers
CDCloudflare Developers
Created by Codename_A on 12/2/2024 in #general-help
Response from worker not streaming
Hey, I am attempting to get an OpenAI assistant response stream from my cloudflare worker. It seems to be working in my http client. The data is received in chunks. However, using a basic html page is showing that the response is coming in one massive chunk. I am very frustrated and I would appreciate some guidance. Here is my code with only the relevant stuff: https://paste.ofcode.org/wq6cTB2cYZE2GTstWH4uc8. When I receive content, the console is correctly filled with the openai response. The chunks in Insomnia (my http client) match this. However, my stream implementation is quite sketchy. Am I doing it correctly? Thanks.
1 replies
CDCloudflare Developers
Created by Codename_A on 12/2/2024 in #workers-help
Worker response not streaming
Hey, I am attempting to get an OpenAI assistant response stream from my cloudflare worker. It seems to be working in my http client. The data is received in chunks. However, using a basic html page is showing that the response is coming in one massive chunk. I am very frustrated and I would appreciate some guidance. Here is my code with only the relevant stuff: https://paste.ofcode.org/wq6cTB2cYZE2GTstWH4uc8. When I receive content, the console is correctly filled with the openai response. The chunks in Insomnia (my http client) match this. However, my stream implementation is quite sketchy. Am I doing it correctly? Thanks.
2 replies
CDCloudflare Developers
Created by Codename_A on 7/21/2024 in #pages-help
Sveltekit with pages giving errors
I have attached the log. This is with a sveltekit application. Please help
4 replies
CDCloudflare Developers
Created by Codename_A on 7/10/2024 in #workers-help
Cannot make D1 requests twice?
I am facing a strange issue where I am unable to make D1 queries multiple times. Here is the code I am using
let sqlQuery = `SELECT sura, aya, text FROM en_pickthall WHERE 1=1 `;
keywords.forEach((keyword, index) => {
sqlQuery += `AND (`;
sqlQuery += `text LIKE '% ${keyword} %' `;
sqlQuery += `OR text LIKE '% ${keyword}.' `;
sqlQuery += `OR text LIKE '% ${keyword},' `;
sqlQuery += `OR text LIKE '% ${keyword}?' `;
sqlQuery += `OR text LIKE '% ${keyword}!' `;
sqlQuery += `OR text LIKE '% ${keyword}%' `;
sqlQuery += `) `;
});
sqlQuery += `LIMIT ${limit};`;

// Execute the query
let { results } = await env.DB.prepare(sqlQuery).all();
console.log(results)
let { contextVerses } = await env.DB.prepare(sqlQuery).all();
console.log(contextVerses);
let sqlQuery = `SELECT sura, aya, text FROM en_pickthall WHERE 1=1 `;
keywords.forEach((keyword, index) => {
sqlQuery += `AND (`;
sqlQuery += `text LIKE '% ${keyword} %' `;
sqlQuery += `OR text LIKE '% ${keyword}.' `;
sqlQuery += `OR text LIKE '% ${keyword},' `;
sqlQuery += `OR text LIKE '% ${keyword}?' `;
sqlQuery += `OR text LIKE '% ${keyword}!' `;
sqlQuery += `OR text LIKE '% ${keyword}%' `;
sqlQuery += `) `;
});
sqlQuery += `LIMIT ${limit};`;

// Execute the query
let { results } = await env.DB.prepare(sqlQuery).all();
console.log(results)
let { contextVerses } = await env.DB.prepare(sqlQuery).all();
console.log(contextVerses);
If I run this code the console shows the first log is normal, but the second console.log returns undefined. What is going on here and how do I fix it?
7 replies
CDCloudflare Developers
Created by Codename_A on 4/30/2024 in #general-help
What is the best way to do this?
I'm unsure if using workers for this case would work: I want to make openai api requests in the back end without showing the user my api key. Something like an api proxy. Of course, then I would need to authenticate to make sure regular people couldn't just use that to make requests. Could workers be a use case for this? Or another product. How would I do this>
2 replies
VVALORANT
Created by Codename_A on 2/12/2023 in #community-help
Riot Client Closing Instantly
When I launch riot / valorant the program shows up in task manager then closes right away.
1 replies