mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 13:04:23 +00:00
Add a basic news view page.
This commit is contained in:
parent
4b7934552c
commit
f34da9f5c1
9 changed files with 90 additions and 25 deletions
|
@ -4,9 +4,9 @@ import sql from "~/server/components/postgres";
|
|||
const groq = new Groq();
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const host = getRequestHost(event);
|
||||
const protocol = getRequestProtocol(event);
|
||||
const hears = getRequestHeaders(event);
|
||||
const host = getRequestHost(event);
|
||||
const protocol = getRequestProtocol(event);
|
||||
const hears = getRequestHeaders(event);
|
||||
const slug = getRouterParam(event, "slug");
|
||||
const body = await readBody(event);
|
||||
if (!slug) {
|
||||
|
|
|
@ -4,8 +4,8 @@ import sql from "~/server/components/postgres";
|
|||
const groq = new Groq();
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const host = getRequestHost(event);
|
||||
const protocol = getRequestProtocol(event);
|
||||
const host = getRequestHost(event);
|
||||
const protocol = getRequestProtocol(event);
|
||||
const slug = getRouterParam(event, "slug");
|
||||
const buildURL = protocol + "://" + host + "/api/news/get/lt/" + slug;
|
||||
const data = await fetch(buildURL);
|
||||
|
@ -29,7 +29,7 @@ export default defineEventHandler(async (event) => {
|
|||
stop: null,
|
||||
});
|
||||
|
||||
const stream = new ReadableStream({
|
||||
const stream = new ReadableStream({
|
||||
async start(controller) {
|
||||
try {
|
||||
for await (const chunk of chatCompletion) {
|
||||
|
@ -46,5 +46,4 @@ export default defineEventHandler(async (event) => {
|
|||
},
|
||||
});
|
||||
return sendStream(event, stream);
|
||||
|
||||
});
|
||||
|
|
3
server/api/cached/tabs.ts
Normal file
3
server/api/cached/tabs.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
export default defineEventHandler(async (event) => {
|
||||
return "cool";
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue