適用規模:檔案數十至數百個、單檔 500–2000 字(合計約 0.1–1 MB)。 主變數是檔案數,不是總 MB —— manifest 隨檔案數線性成長,單檔大小則由 §2.1 的字數上限管住。
架構決策:Agentic Retrieval,manifest 優先。不使用向量資料庫,不做執行時 chunking。 檔案系統即索引,front matter 即 metadata,模型自行決定讀什麼。
| [ | |
| { | |
| "word": "FALSE", | |
| "definition": "j. (形容詞) 錯誤的", | |
| "sentence": "Choose whether the statement is true or false.", | |
| "translation": "選擇這個陳述是真是假。" | |
| }, | |
| { | |
| "word": "TRUE", | |
| "definition": "j. (形容詞) 真的;真實的", |
| _script_path = os.path.dirname(os.path.abspath(__file__)) |
| import multiprocessing | |
| import threading | |
| import time | |
| class ServerConsole: | |
| def __init__(self): | |
| self.msg_queue = multiprocessing.Queue() | |
| self.console_process = threading.Thread(target=self.console, args=(self.msg_queue,)) |
| import bisect | |
| from typing import List | |
| def reversePairs(nums: List[int]) -> int: | |
| q = [] | |
| res = 0 | |
| for v in nums: | |
| i = bisect.bisect_left(q, -v) | |
| res += i |
| module = None | |
| try: | |
| if module is None: | |
| module = importlib.import_module(f'module_folder.module') | |
| else: | |
| module = importlib.reload(module) | |
| except Exception as e: | |
| raise e |
| import datetime | |
| import os | |
| import time | |
| from argparse import ArgumentParser | |
| from typing import List | |
| def send_server_command(command) -> None: | |
| os.system(f'screen -S rock-server -p 0 -X eval \'stuff "{command}"\\015\'') |
| name: deploy-blog | |
| on: | |
| schedule: | |
| - cron: '22 22 * * *' | |
| push: | |
| branches: | |
| - publish | |
| paths: | |
| - 'source/**/*.md' |
| import logging | |
| import threading | |
| import time | |
| import subprocess | |
| import platform | |
| def ping_ip(ip_address, results): | |
| """ | |
| 檢查 IP 是否可連線,如果可連線則將結果寫入 results 變數中。 |