Skip to content

Commit

Permalink
πŸ”§ chore(dependencies): update dependencies in pyproject.toml
Browse files Browse the repository at this point in the history
πŸ”¨ refactor(event): remove unused AnimeIDF and related code

πŸš€ feat(controller): add new message handlers for various commands

♻️ refactor(controller): simplify tagger function and markdown replies
  • Loading branch information
sudoskys committed Dec 25, 2024
1 parent 24b63fe commit 6c7d7fe
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions app/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,33 +126,27 @@ async def read_novelai(file: BytesIO):
except Exception as e:
logger.debug(f"Empty metadata {e}")
return []
else:
message.append(formatting.mbold(f"πŸ“¦ NovelAI {mode}", escape=False))
if meta_data.Comment.prompt:
message.append(code(content=meta_data.Comment.prompt, language="txt"))
if meta_data.Comment.negative_prompt:
message.append(
code(
content=meta_data.Comment.negative_prompt,
language="txt",
)
)
if meta_data.used_model:
model_tag = str(meta_data.used_model.value).replace("-", "_")
message.append(
formatting.mbold(f"πŸ“¦ Model #{model_tag}", escape=False),
)
if meta_data.Source:
source_tag = meta_data.Source.lower().replace(" ", "_")
message.append(
formatting.mbold(f"πŸ“¦ Source #{source_tag}", escape=False),
)

message.append(formatting.mbold(f"πŸ“¦ NovelAI {mode}", escape=False))
if meta_data.Comment.prompt:
message.append(code(content=meta_data.Comment.prompt, language="txt"))
if meta_data.Comment.negative_prompt:
message.append(
code(
content=meta_data.Comment.model_dump_json(indent=2),
language="json",
content=meta_data.Comment.negative_prompt,
language="txt",
)
)
if meta_data.used_model:
model_tag = str(meta_data.used_model.value).replace("-", "_")
message.append(
formatting.mbold(f"πŸ“¦ Model #{model_tag}", escape=False),
)
if meta_data.Source:
source_tag = meta_data.Source.lower().replace(" ", "_")
message.append(
formatting.mbold(f"πŸ“¦ Source #{source_tag}", escape=False),
)
try:
file.seek(0)
with Image.open(file) as img:
Expand All @@ -164,6 +158,12 @@ async def read_novelai(file: BytesIO):
message.append(formatting.mbold("🧊 Signed by NovelAI", escape=False))
if has_latent:
message.append(formatting.mbold("🧊 Find Latent Space", escape=False))
message.append(
code(
content=meta_data.Comment.model_dump_json(indent=2),
language="json",
)
)
return message


Expand Down

0 comments on commit 6c7d7fe

Please sign in to comment.