diff --git a/.github/workflows/multi-persona-awakening.yml b/.github/workflows/multi-persona-awakening.yml index 8a0ff54b..d8331586 100644 --- a/.github/workflows/multi-persona-awakening.yml +++ b/.github/workflows/multi-persona-awakening.yml @@ -74,7 +74,7 @@ jobs: INPUT_PERSONAS: ${{ github.event.inputs.personas }} run: | DATE=$(date +%Y-%m-%d) - SESSION_ID="MULTI-WAKE-$(date +%Y%m%d)-001" + SESSION_ID="MULTI-WAKE-$(date +%Y%m%d-%H%M%S)" mkdir -p grid-db/multi-wake-sessions SESSION_FILE="grid-db/multi-wake-sessions/${SESSION_ID}.json" @@ -241,7 +241,7 @@ jobs: if not questions: continue for q in questions: - h = int(hashlib.md5(q.encode()).hexdigest(), 16) % 10000 + h = int(hashlib.md5((p['persona_id'] + q + datetime.now().isoformat()).encode()).hexdigest(), 16) % 10000 msg = { 'id': f"MSG-{datetime.now().strftime('%Y%m%d')}-{h:04d}", 'channel': 'general', diff --git a/.github/workflows/persona-thinking-window.yml b/.github/workflows/persona-thinking-window.yml index 902206d7..c05d9073 100644 --- a/.github/workflows/persona-thinking-window.yml +++ b/.github/workflows/persona-thinking-window.yml @@ -236,7 +236,7 @@ jobs: export LOG_FILE python3 << 'PYEOF' - import json, os + import json, os, hashlib from datetime import datetime log_file = os.environ["LOG_FILE"] persona_id = os.environ["PERSONA_ID"] @@ -257,7 +257,7 @@ jobs: with open(general, "a") as f: for m in msgs: msg = { - "id": f"MSG-{datetime.now().strftime('%Y%m%d')}-{int(__import__('hashlib').md5(m.get('message','').encode()).hexdigest(), 16) % 10000:04d}", + "id": f"MSG-{datetime.now().strftime('%Y%m%d')}-{int(hashlib.md5((persona_id + m.get('message','') + datetime.now().isoformat()).encode()).hexdigest(), 16) % 10000:04d}", "channel": "general", "from": persona_id, "from_name": persona_name, diff --git a/scripts/chatroom-post.js b/scripts/chatroom-post.js index ed3990da..1953f27a 100644 --- a/scripts/chatroom-post.js +++ b/scripts/chatroom-post.js @@ -35,7 +35,7 @@ fs.mkdirSync(path.dirname(channelFile), { recursive: true }); const now = new Date(); const dateStr = now.toISOString().slice(0, 10).replace(/-/g, ''); const hash = crypto.createHash('md5').update(content + now.toISOString()).digest('hex'); -const msgId = `MSG-${dateStr}-${parseInt(hash.slice(0, 8), 16) % 10000}`.replace(/-(\d)$/, '-000$1').replace(/-(\d{2})$/, '-00$1').replace(/-(\d{3})$/, '-0$1'); +const msgId = `MSG-${dateStr}-${String(parseInt(hash.slice(0, 8), 16) % 10000).padStart(4, '0')}`; const message = { id: msgId,