feat: add conversation request-response

This commit is contained in:
2025-09-24 12:45:34 +02:00
parent 97a5506e15
commit 64f2aa449d
4 changed files with 223 additions and 14 deletions

View File

@@ -0,0 +1,18 @@
async function* streamingFetch(fetchcall: () => Promise<Response>) {
const response = await fetchcall();
// Attach Reader
if (!response || !response.body) {
throw new Error("Empty response");
}
const reader = response.body.getReader();
while (true) {
// wait for next encoded chunk
const { done, value } = await reader.read();
// check if stream is done
if (done) break;
// Decodes data chunk and yields it
yield new TextDecoder().decode(value);
}
}
export { streamingFetch };

View File

@@ -0,0 +1,19 @@
/* A nice to have VScode autocompletion feature
Make sure you have the Tailwind CSS IntelliSense extension installed in VSCode
https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss
Open the settings (json) file via CMD + SHIFT + P (macOS) or CTRL + SHIFT + P (Windows)
Add the below entry to the json file
{
...
"tailwindCSS.experimental.classRegex": ["tw`([^`]*)"],
}
Allows you to have tailwind auto complete while typing outside of the className attribute
By using the prefix tw`YOUR_CLASS_NAME_HERE`
Without the extension and settings adjustment, it'll still be interpreted as a string literal (backward compatible)
*/
export const tw = (strings: TemplateStringsArray, ...substitution: unknown[]) =>
String.raw({ raw: strings }, ...substitution);