Author: oopus

  • Parassis 上線~

    Parassis 上線~

    經過一個月做做停停,Parassis https://pa.oopus.info 初始版本終於上線啦~~~

    Parassis 是 paragraph assistant 的縮寫。它會使用 LLM 對文本(主要是故事型文本)進行分析,以便閱讀。

    登錄網站的時候需要輸入 LLM token, 暫時用的都是最省錢的模型,效果也不錯。

    輸入 token 之後,可以通過 下圖的(1)按鈕上傳文檔,文檔必須是 markdown 格式。

    在使用上圖(3)或者(4)翻頁的時候,下方 Assistant 區域會自動根據當前文本和前文對文本中自動梳理故事線索。

    (5)是目錄,它會根據 markdown 文件中的 headings(標題)自動生成文本目錄。要注意,跳轉到某頁,或者剛剛上傳文本的之後不會自動觸發任何 AI 功能,如果需要在跳轉和上傳後梳理當前頁的線索,可以使用(2)圖標,手動生成當前頁的線索梳理。

    (6)可以重新打開設置按鈕來選擇其他 LLM,或者改變輸出文本的語言。

    初始設計的時候還有一些其他功能,包括根據特定主題來分析當前頁,與當前頁對話,基於某些原則修改當前頁的內容等等。未來慢慢再加。因為最近想要開一個新 project, 而且和 parassis 有關係。所以就愉快把開發了一半的 parassis 上線吧~ 一方面便於自己使用,以及積累後續開發和修改思路。另一方面,也把開發重心轉向新 project.

    Parassis 項目中大量使用 cline 和 Github copliot來實現功能以及修問題。大大增加開發進度,以及解決問題的效率。會學到很多。在開發後期,用 copliot 協助自定義的細節的頻率遠遠多於初期。在部署到 vercel 的時候,把 vite.config.ts proxy 轉寫成 vercel.json 完全是讓 cline 寫,非常舒適。不過確認要用 vercel.json 解決 vercel proxy 問題還是手動搜索解決方案,cline 並沒有發現這個問題的解決方案。

  • 與一位失業者的對話

    今天和一位七十年代的本科生進行了一次工作談話。對方在美國獲得博士學位,去年自己的公司參加了一起收購案,被收購後,員工被裁員,輸得乾乾淨淨。今年從零開始找工作。

    思考並學到(更確認)的有:

    • 一旦參加博弈,輸了只是自己蠢。不依賴、責怪任何人分享經驗或者建議。
    • 不在不熟悉的情況下僅憑利益做決定。
    • 不要僅憑興趣沉溺在某個領域。
    • 確保足夠的自己的時間思考過去、當下、未來。
    • 命運(已經、並將)決定在自己的手裡,而不是任何人,任何集體,任何國家。
    • 工作的專業性是把活和需求在規定時間內高質量做好。其他一切負面的情緒都是需要解決掉的問題。
    • 時間只有在(無論是憑理性還是憑感性)規劃/衝動下才有。否則,永遠不會有時間。
  • Using mkvtoolnix to extract subtitles from MKV files

    Download mkvtoolnix

    https://mkvtoolnix.download/downloads.html#windows

    Finding your subtitle id

    • Open mkvtoolnix-gui from the mkvtoolnix folder;
    • (See the screenshot below)Add your MKV file to (1). If (2) is .sub or other subtitle format that you are familiar with, you can extract it by clicking Start multiplexing. That’s it! If not, go to (3) and then remember the TRACK_ID

    Extract the subtitle

    • Use command line or terminal tool to get into your mkvtoolnix folder. For me, it is: cd C:\Users\{user}\Downloads\mkvtoolnix
    • Run the following command: (replace it by your own path and the TRACK_ID which is a number that you got from the previous step)
    mkvextract tracks "C:\Users\{your path and file name}.mkv" {TRACK_ID}:"C:\Users\{your path and file name}subtitle.ass"

    After getting the ass file

    You can use any text editing tool to open this .ass file, then you will see all the subtitles. You can also use ffmpeg, ChatGPT or other tools to convert it into .srt file.

  • 【宜言飲酒 20240113】熱帶水果不可以苦 藍色 Putin 勝利

    Buck Buck juice – 左一。來自一間叫做 Zero Gravity 的 Vermont 酒廠。Logo 是一隻紅色拽拽的鹿,讓人不忍不多看它兩眼。這樣拽拽的表情,大概你也能猜出來它是一罐比較烈的酒。作為 Double IPA 一定是苦味的底色,酒精度是 9 度,麥汁比重(OG)15.1°P. 酒罐上寫著:”The tropical, juicy palate is balanced by bold and hoppy aromas.”(熱帶多汁的口感由濃郁而啤酒花香氣平衡)Emmm… 買來的時候就好奇,熱帶水果和 IPA, 而且是 double IPA 的苦味,怎麼能平衡?有家酒評說這款酒:”Bursting with juicy pineapple, zesty citrus, and ripe mango flavors.”(充滿多汁的鳳梨、清新的柑橘和熟透的芒果風味) 從實際的口感來說,在有趣的啤酒花和清新的苦味外,確實有些微妙的氣味,但很難說捕捉到熱帶水果的一絲一毫。IPA 起源於新英格蘭地區,而熱帶水果和這裡八竿子打不著。讚美釀酒師有趣的想象力~ 但 Double IPA 往熱帶水果上調,萌萌噠勉強,也很有趣呢~

  • nextjs SSG + rust web server

    Create components for specific hooks

    If there are some special hooks were used, for example useSearchParams(), wrap it as a component, using suspense to load it. Ex:

    import { Suspense } from 'react';
    import ChatComponent from './ChatComponent';
    
    export default function Page() {
     return (
      <div className="font-sans max-w-3xl mx-auto p-5">
        <h1 className="text-2xl font-bold mb-4 text-center">Yidam Chat</h1>
        <Suspense fallback={<div>Loading chat...</div>}>
         <ChatComponent />
        </Suspense>
      </div>
     );
    }

    Set next.config.ts

    import type { NextConfig } from "next";
    
    const nextConfig: NextConfig = {
     /* config options here */
     reactStrictMode: true,
     output: 'export',
     basePath: '/web',
    };
    
    export default nextConfig;

    Notes

    • Set output: 'export' for npm run build
    • Set basePath: '/web' for the sub-directory of the web root

    Set package.json

     "scripts": {
      "dev": "next dev",
      "build": "next build",
      "start": "next start",
      "lint": "next lint"
     },

    Notes: just keep as it was

    Run command to generate files

    npm run build

    (Optional) Rust web server setting

    use axum::{
      routing::{get, get_service},
      Router,
    };
    
    async fn main() {
      let state = Arc::new(AppState {
        context: Mutex::new(Vec::new()),
      });
    
      let app = Router::new()
      .route("/ws", get(websocket_handler))
      .nest_service("/web", get_service(ServeDir::new("./src/web")))
      .with_state(state);
      const PORT: u16 = 3001;
      // get lan ip
      let listener = tokio::net::TcpListener::bind(format!("0.0.0.0:{}", PORT)).await.unwrap();
      println!("Please open http://{}:{}/web", get_local_ip().unwrap(), PORT);
      axum::serve(listener, app).await.unwrap();
    }
  • 有張力的好奇心永不在安全邊界之內

    有張力的好奇心永不在安全邊界之內

    Source: 地。-关于地球的运动-(チ。-地球の運動について-) Ep10 11:11

    忽然意識到,我一定做不了教授或者家長的原因是,終究最感興趣去探索和分享的是最危險和最「暗」的「知」。如果「知」在人類知識和價值觀的邊界之內,那多無聊吖~「知」不正是認知黑暗和不穩定中的「未知」麼

  • Sautoyrs: Erotic literature generation platfrom

    Sautoyrs: Erotic literature generation platfrom

    After one month work, today is the first day that I opened my erotic literature generation platform to the public: https://github.com/sudoghut/Sautoyrs

    It is a web application that generates romantic and explicit sexual stories automatically using a large language model. It creates interactive narratives between two characters with customizable settings. It can only work on Chrome /Firefox on desktop or laptop.

    Sautoyrs came from satyr:

    In Greek mythology, a satyr[a] (Ancient Greek: σάτυρος, romanized: sátyros, pronounced [sátyros]), also known as a silenus[b] or silenos (Ancient Greek: σειληνός, romanized: seilēnós [seːlɛːnós]), and sileni (plural), is a male nature spirit with ears and a tail resembling those of a horse, as well as a permanent, exaggerated erection. Early artistic representations sometimes include horse-like legs, but, by the sixth century BC, they were more often represented with human legs.[4] Comically hideous, they have mane-like hair, bestial faces, and snub noses and they always are shown naked. Satyrs were characterized by their ribaldry and were known as lovers of wine, music, dancing, and women. They were companions of the god Dionysus and were believed to inhabit remote locales, such as woodlands, mountains, and pastures. They often attempted to seduce or rape nymphs and mortal women alike, usually with little success. They are sometimes shown masturbating or engaging in bestiality.

    Since that it can generate conversations automatically, I added auto into satyrs. It became sautoyrs.

    This is the web traffic statistics for the first day. Not as good as I expected:

    Anyway, I have done my best.

  • Debugging Pitfalls: Async forEach and Slice Memory Sharing in JavaScript

    From last Thursday until just now (Saturday), two issues confused me a lot:

    forEach is synchronous, not asynchronous

    This is a fundamental concept, but problems can arise when you assume a block of code will execute synchronously while using forEach. For some reason, if that block of code becomes asynchronous, it could lead to unexpected issues.

    slice creates a shallow copy

    shortConversation = […systemPrompt, …chatThread.current.slice(-(memoryLength + 2 - 1))];

    The slice method causes shortConversation and chatThread to share part of the memory, which led to unexpected behaviors.

    The corrected code is as follows:

    shortConversation = [...systemPrompt, ...structuredClone(chatThread.current.slice(-(memoryLength + 2 - 1)))];

    Using structuredClone ensures that shortConversation and chatThread are completely independent.

  • 【Imghorce】Shopping and gift 背後的故事

    【Imghorce】Shopping and gift 背後的故事

    最近忙著做戀愛腦 AI 自動談戀愛的 project, 好久沒更新圖片了。年底有一個巨大的大眾主題~ 它就是購物和禮物。那麼做一期購物和禮物叭~

    https://imghorce.oopus.info/shopping-and-gift-20241111

    這次用到的 LORA 模型是:

    巧克力咖啡:https://civitai.com/models/197998/chocolate-coffee-style-lora-15sdxl?modelVersionId=890785

    瓷器:https://civitai.com/models/209773/porcelain-style-fluxsdxl?modelVersionId=908818

    沙:https://civitai.com/models/208699/sand-style-fluxsdxl?modelVersionId=908805

    有了之前風格化的經驗,這回輕車熟路。但在第一輪實驗時發現,場景裡面有大量的人物,出圖特別崩。第二輪正式做的時候,決定完全擯棄人物。效果不錯。本來還想做一隻貓貓在電腦前購物,它頭上有一個巨大的幻象。幻象是張牙舞爪的貓貓靈四處出擊(前段時間巨大動物靈在 reddit 上特別流行)。但考慮到這個項目的商業屬性,當前還是盡量少些個人化整活啦~ 另外,關於購物和禮物主題的文案可以寫蠻多,不過年底還有其他的機會。打算留給之後寫,所以這期的文案就幾乎為零了。圖片也純糖水~

    今天也測試了自動化 markdown 生成,暨自動化圖片重命名工具 https://github.com/sudoghut/bookworm-light-astro/tree/main/generate_data,大大增加了部署的效率。

    週末的時候約一位之前很好的朋友月底看演唱會,得知對方剛剛有了男朋友,要和男朋友去。寂し, 挺難過的。