forked from irmen/Tale
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix portrait issue (due to deferred actions)
brim and shanda are autonomous
- Loading branch information
Showing
8 changed files
with
53 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
|
||
from tale.image_gen.base_gen import ImageGeneratorBase | ||
|
||
|
||
image_token = '<:>' | ||
|
||
def pad_text_for_avatar(text: str, npc_name: str) -> str: | ||
"""Pad text for NPC output.""" | ||
return npc_name +' <:> ' + text | ||
return npc_name + ' <:> ' + text if npc_name else text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
|
||
|
||
from tale.resources_utils import pad_text_for_avatar | ||
|
||
|
||
class TestResourceUtils: | ||
|
||
def test_pad_for_avatar(self): | ||
"""Test padding for avatar.""" | ||
text = "This is a test." | ||
npc_name = "Test NPC" | ||
expected = "Test NPC <:> This is a test." | ||
assert pad_text_for_avatar(text, npc_name) == expected | ||
|
||
def test_pad_for_avatar_empty(self): | ||
"""Test padding for avatar with empty text.""" | ||
text = "" | ||
npc_name = "Test NPC" | ||
expected = "Test NPC <:> " | ||
assert pad_text_for_avatar(text, npc_name) == expected | ||
|
||
def test_pad_for_avatar_empty_npc(self): | ||
"""Test padding for avatar with empty NPC name.""" | ||
text = "This is a test." | ||
npc_name = "" | ||
expected = "This is a test." | ||
assert pad_text_for_avatar(text, npc_name) == expected |