Template
feat: add Qdrant recording workflow
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import json, uuid, os
|
||||
|
||||
summary = open('/tmp/summary.txt').read()
|
||||
vector = json.load(open('/tmp/embed_response.json'))['embeddings'][0]
|
||||
point_id = str(uuid.uuid4())
|
||||
|
||||
payload = {
|
||||
"points": [{
|
||||
"id": point_id,
|
||||
"vector": vector,
|
||||
"payload": {
|
||||
"date": os.environ.get('TODAY', ''),
|
||||
"type": "gitea_daily_digest",
|
||||
"record_count": int(os.environ.get('COUNT', '0')),
|
||||
"timestamp": os.environ.get('TIMESTAMP', ''),
|
||||
"content": summary
|
||||
}
|
||||
}]
|
||||
}
|
||||
with open('/tmp/digest_payload.json', 'w') as f:
|
||||
json.dump(payload, f)
|
||||
print(f"Digest Point ID: {point_id}")
|
||||
@@ -0,0 +1,3 @@
|
||||
import json
|
||||
summary = open('/tmp/summary.txt').read()
|
||||
open('/tmp/embed_input.json','w').write(json.dumps({'model':'bge-m3:latest','input':summary}))
|
||||
@@ -0,0 +1,6 @@
|
||||
import json, sys, os
|
||||
today = os.environ.get('TODAY', '')
|
||||
prompt = open('/tmp/texts.txt').read()
|
||||
full_prompt = f"以下は{today}のGitea操作ログです。重要な変更点と傾向を日本語300字以内でまとめてください:\n{prompt}"
|
||||
payload = {'model': 'qwen2.5:7b', 'prompt': full_prompt, 'stream': False}
|
||||
open('/tmp/gen_payload.json','w').write(json.dumps(payload))
|
||||
@@ -0,0 +1,4 @@
|
||||
import json
|
||||
d = json.load(open('/tmp/scroll.json'))
|
||||
texts = '\n'.join(p.get('payload',{}).get('content','') for p in d.get('result',{}).get('points',[]))
|
||||
open('/tmp/texts.txt','w').write(texts)
|
||||
@@ -0,0 +1,25 @@
|
||||
import json, uuid, sys, os
|
||||
|
||||
content = open('/tmp/content.txt').read()
|
||||
embed_resp = json.load(open('/tmp/embed_response.json'))
|
||||
vector = embed_resp['embeddings'][0]
|
||||
point_id = str(uuid.uuid4())
|
||||
|
||||
payload = {
|
||||
"points": [{
|
||||
"id": point_id,
|
||||
"vector": vector,
|
||||
"payload": {
|
||||
"run_id": os.environ.get('RUN_ID', ''),
|
||||
"event": os.environ.get('EVENT', ''),
|
||||
"repository": os.environ.get('REPO', ''),
|
||||
"branch": os.environ.get('BRANCH', ''),
|
||||
"actor": os.environ.get('ACTOR', ''),
|
||||
"timestamp": os.environ.get('TIMESTAMP', ''),
|
||||
"content": content
|
||||
}
|
||||
}]
|
||||
}
|
||||
with open('/tmp/payload.json', 'w') as f:
|
||||
json.dump(payload, f)
|
||||
print(f"Point ID: {point_id}")
|
||||
Reference in New Issue
Block a user