Skip to content

Instantly share code, notes, and snippets.

View minpeter's full-sized avatar

minpeter minpeter

View GitHub Profile
@minpeter
minpeter / ai-sdk-tool-middleware.ts
Created November 9, 2024 17:29
Provides tool call support for models that do not support tool calls in ai-sdk.
import {
Experimental_LanguageModelV1Middleware,
LanguageModelV1StreamPart,
} from "ai";
import { HermesToolCallPrompt } from "./prompts";
export const customMiddleware: Experimental_LanguageModelV1Middleware = {
transformParams: async ({ params }) => {
console.log("transformParams called");
@minpeter
minpeter / client-only-ai-sdk-page.tsx
Created November 1, 2024 03:40
This is code that allows you to use Vercel AI SDK only with client components.
"use client";
import { useChat } from "ai/react";
import { createFriendliAI } from "@friendliai/ai-provider";
import { convertToCoreMessages, streamText } from "ai";
import { useState } from "react";
export default function Chat() {
const [token, setToken] = useState<string>("");
@minpeter
minpeter / global.css
Last active September 26, 2024 04:58
reactmarkdown + tailwindcss + sugar-high + math
@layer base {
:root {
/* Sugar-high theme */
--sh-class: #4d9ef6;
/* Brighter blue for class */
--sh-identifier: #6caedd;
/* Lighter blue for identifiers */
--sh-sign: #cdd3de;
/* Lighter gray to ensure signs are visible */
@minpeter
minpeter / gh-image-bp.yml
Last active March 13, 2024 04:54
깃허브 패키지 레지스터에 matrix를 이용해 arm64, amd64 공용 이미지를 빌드하고 푸시함
name: BUILD and PUSH to GHR
on:
workflow_dispatch:
push:
branches: ["main"]
env:
REGISTRY: ghcr.io
REGISTRY_IMAGE: ghcr.io/${{ github.repository }}
@minpeter
minpeter / blur-lisum.html
Created February 19, 2024 03:03
vercel style dark blur box test
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>lipsum</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link
@minpeter
minpeter / minpeter's GitHub Stats
Last active August 23, 2024 12:18
Github Stats ✨
⭐ Total Stars: 34
➕ Total Commits: 1,999
🔀 Total PRs: 76
🚩 Total Issues: 66
📦 Contributed to: 34
🌞 Morning 205 commits █████▌░░░░░░░░░░░░░░░ 26.2%
🌆 Daytime 345 commits █████████▎░░░░░░░░░░░ 44.1%
🌃 Evening 156 commits ████▏░░░░░░░░░░░░░░░░ 19.9%
🌙 Night 76 commits ██░░░░░░░░░░░░░░░░░░░ 9.7%
🗣 Commented on #2 in GGos3/blog
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
irm get.scoop.sh | iex
scoop bucket add extras
scoop install runcat
## without scoop
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
wsl --set-default-version 2
Invoke-WebRequest -URI https://github.com/yuk7/ArchWSL/releases/download/22.10.16.0/ArchWSL_Online-AppX_22.10.16.0_x64.cer -OutFile arch.cer
Invoke-WebRequest -URI https://github.com/yuk7/ArchWSL/releases/download/22.10.16.0/ArchWSL_Online-AppX_22.10.16.0_x64.appx -OutFile arch.appx
Import-Certificate -FilePath .\arch.cer -CertStoreLocation Cert:\LocalMachine\TrustedPeople