Coder Social home page Coder Social logo

avgvstvs96 / astrosite Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 6.37 MB

Built with Astro and TailwindCSS, this MPA portfolio & blog site is version 3 of my personal website, my first MPA.

Home Page: https://astrosite-aid.pages.dev/

License: GNU Affero General Public License v3.0

JavaScript 6.70% Astro 37.62% CSS 4.75% TypeScript 50.94%
astro blog cloudflare-workers openai react shadcn-ui tailwindcss

astrosite's Introduction

🤖 Hi, I'm Bassim, an IT Professional from New York

Interests

I have a wide range of interests and hobbies including 3D printing and design, drone building and flying, marketing, photography, investing, PC hardware, cars and racing, sim racing, and gaming, in addition to programming. I'm also an avid student of history, philosophy, and political science.

🔭 What I'm working on

I'm currently working on the third version of my personal blog/portfolio website built with Astro and TailwindCSS - astroSite. The second version of my personal website is deployed at bassimshahidy.com and is also built with Astro and TailwindCSS, although it's a much simpler single page site that I built when I started learning web development. I'm also experimenting with shadcn/ui and react in astro-shadcn.

🖥️ What I've built

FastGPT, a lightweight FastAPI based OpenAI GPT3.5/4 chat bot with features like streaming, system message customization, markdown, and syntax highlighting. I also have a Flask version called flaskGPT, and attempted a React version called reactGPT, although reactGPT has some bugs because I've only just started delving into the world of JavaScript frameworks.

⚙️ Skills and Technologies

javascript logo typescript logo html5 logo css3 logo tailwindcss logo astro logo react logo python logo flask logo fastapi logo cloudflare logo vscode logo github logo

astrosite's People

Contributors

astrobot-houston avatar avgvstvs96 avatar dependabot[bot] avatar

Watchers

 avatar

astrosite's Issues

Worker creates multiple branches of single stream

 [ERROR] Your worker created multiple branches of a single stream 
(for instance, by calling `response.clone()` or `request.clone()`) but 
did not read the body of both branches. This is wasteful, as it forces 
the system to buffer the entire stream of data in memory, rather than 
streaming it through. This may cause your worker to be unexpectedly 
terminated for going over the memory limit. If you only meant to copy 
the request or response headers and metadata (e.g. in order to be able 
to modify them), use the appropriate constructors instead (for instance, 
`new Response(response.body, response)`, `new Request(request)`, etc).
import { OpenAI } from 'openai';
 
interface Message {
  role: string;
  content: string;
}
 
interface ChatRequest {
  messages: Message[];
  model_type: string;
}
 
export async function onRequest(context) {
  const { request, env } = context;
 
  if (request.method !== 'POST') {
    return new Response('Method not allowed', { status: 405 });
  }
 
  let requestBody: ChatRequest;
  try {
    requestBody = await request.json();
  } catch (error) {
    return new Response('Invalid JSON', { status: 400 });
  }
 
  const { messages, model_type } = requestBody;
 
  const chatMessages = messages.map((msg) => ({
    role: msg.role as 'system' | 'user',
    content: msg.content,
  }));
 
  const openai = new OpenAI({
    apiKey: env.OPENAI_API_KEY,
  });
 
  try {
    const stream = await openai.chat.completions.create({
      model: model_type,
      messages: chatMessages,
      stream: true,
    });
 
    let { readable, writable } = new TransformStream();
    let writer = writable.getWriter();
    const textEncoder = new TextEncoder();
 
    (async () => {
      try {
        for await (const part of stream) {
          const content = part.choices[0]?.delta?.content || '';
          if (content) {
            await writer.write(textEncoder.encode(content));
          }
        }
      } catch (error) {
        await writer.write(
          textEncoder.encode(`Error processing stream: ${error.message}`)
        );
      } finally {
        writer.close();
      }
    })();
 
    return new Response(readable);
  } catch (error) {
    return new Response(`Error: ${error.message}`, { status: 500 });
  }
}
 

tocLinks are only marked when heading is visible in viewport

The .active class is removed when the sections heading is out of the viewport, even if the section is still within the viewport.

Update this to mark tocLinks active when the section itself is in the viewport.

Need remarkSectionize plugin to wrap each markdown section in section tags, allowing us to observe them when the section itself intersects the viewport.

Try prefetching in Astro

Astro supports 4 prefetch strategies for various use cases:

  • hover (default): Prefetch when you hover over or focus on the link.
  • tap: Prefetch just before you click on the link.
  • viewport: Prefetch as the links enter the viewport.
  • load: Prefetch all links on the page after the page is loaded.
import { defineConfig } from 'astro/config';

export default defineConfig({
  prefetch: {
    defaultStrategy: 'load',
    prefetchAll: true
  }
});

Update Font

Explore using different fonts and weights

Content on blog post cut off

Content is going under the NavBar component cutting off the content.

Remove fixed, add sticky to NavBar
Remove justify-content: center from global.css body
Add flex-direction: column to global.css body

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.