👉 Click here to view the live site

chmod +x setup.sh
./setup.sh- Make sure Node.js is installed.
- In the project root, run:
npm install
- Copy
.env.exampleto.env.localand fill in your own API keys.
Refer to .env.example and fill in your credentials in .env.local.
- 🟢 Supabase: supabase.com
- 🤖 OpenAI: openai.com
- 🗣️ Azure AI Speech: azure.microsoft.com
- 📰 Alpha Vantage: alphavantage.co
- Get familiar with Supabase.
- Enable the
pgvectorextension:
Supabase vector columns guide - Run the following script in the Supabase SQL editor:
-- Enable pgvector if not already enabled
CREATE EXTENSION IF NOT EXISTS vector;
-- Drop old function if exists
DROP FUNCTION IF EXISTS match_documents(vector, integer, jsonb);
-- Create documents table
CREATE TABLE IF NOT EXISTS documents (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
content text,
embedding vector(1536),
created_at timestamp DEFAULT now(),
metadata jsonb
);
-- Optional: create index for jsonb metadata tag search
CREATE INDEX IF NOT EXISTS idx_metadata_tags ON documents USING gin ((metadata->'tags'));
-- Create match_documents function
CREATE OR REPLACE FUNCTION match_documents (
query_embedding vector(1536),
match_count int,
filter jsonb DEFAULT '{}'::jsonb
)
RETURNS TABLE (
id uuid,
title text,
content text,
metadata jsonb,
similarity float
)
LANGUAGE plpgsql
AS $$
BEGIN
RETURN QUERY
SELECT
docs.id,
docs.metadata->>'title' AS title,
docs.content,
docs.metadata,
1 - (docs.embedding <=> query_embedding) AS similarity
FROM documents AS docs
WHERE
(
((filter - 'tags') = '{}'::jsonb) OR (docs.metadata @> (filter - 'tags'))
)
AND
(
NOT (filter ? 'tags') OR
(
(docs.metadata ? 'tags') AND
(jsonb_typeof(docs.metadata->'tags') = 'array') AND
(docs.metadata->'tags' ?| ARRAY(SELECT jsonb_array_elements_text(filter->'tags')))
)
)
ORDER BY docs.embedding <=> query_embedding
LIMIT match_count;
END;
$$;- Configure the news topics you want to fetch in
script/process-indexing.ts. - For valid parameters, see: Alpha Vantage News Sentiment docs
- Podcast parameters (e.g., account, topic) are preset and cannot be changed.
- To fetch and index data, run:
npm run test ./script/process-indexing.ts
npm run dev- Check
types/supabase.tsfor the current schema types. - After changing the database schema, regenerate types with:
npm run supabase:generate-types
