Browse Source

画像に対応

kiriban
みてるぞ 2 months ago
parent
commit
d4a6f6d328
2 changed files with 11 additions and 3 deletions
  1. +1
    -1
      ai
  2. +10
    -2
      main.py

+ 1
- 1
ai

@@ -1 +1 @@
Subproject commit dfa09e1e66550e731b740d85e06d88a0caa33eda
Subproject commit f0570e0caf1db858e663a9362b9cbf111016935a

+ 10
- 2
main.py View File

@@ -41,7 +41,8 @@ def get_thread_contents (
'handle': response.post.author.handle,
'name': response.post.author.display_name,
'datetime': response.post.record.created_at,
'text': response.post.record.text }]
'text': response.post.record.text,
'embed': response.post.record.embed }]
response = response.parent

return records
@@ -60,7 +61,14 @@ def main () -> None:
for uri in check_notifications (client):
records = get_thread_contents (client, uri, 20)
if len (records) > 0:
answer = Talk.main (records[0]['text'],
answer = Talk.main ((records[0]['text']
if (records[0]['embed'] is None
or not hasattr (records[0]['embed'],
'images'))
else [
{ 'type': 'text', 'text': records[0]['text'] },
{ 'type': 'image_url', 'image_url': {
'url': f"https://cdn.bsky.app/img/feed_fullsize/plain/{ records[0]['did'] }/{ records[0]['embed'].images[0].image.ref.link }" } }]),
records[0]['name'],
[*map (lambda record: {
'role': ('assistant'


Loading…
Cancel
Save