forked from retoor/devplacepy
docs: add CLAUDE.md with project guidelines and conventions, document new devii admin quota reset endpoints and CLI commands, update README with coverage CI and devii_admin_daily_usd config, add European date normalization to ProjectForm model
This commit is contained in:
@@ -130,6 +130,35 @@ class LLMClient:
|
||||
return c
|
||||
return "random"
|
||||
|
||||
def select_reaction(self, content_snippet: str, persona: str = "") -> str:
|
||||
from devplacepy.constants import REACTION_EMOJI
|
||||
|
||||
flavor = {
|
||||
"enthusiastic_junior": "You react readily and warmly.",
|
||||
"grumpy_senior": "You react rarely, only to genuinely notable content.",
|
||||
"hobbyist_maker": "You react to anything hands-on, clever, or fun.",
|
||||
"academic_type": "You react only to substantive, rigorous content.",
|
||||
"minimalist": "You react very sparingly.",
|
||||
"storyteller": "You react to anything with a human angle.",
|
||||
"rebel": "You react to bold or contrarian takes.",
|
||||
"mentor": "You react supportively to effort and learning.",
|
||||
}.get(persona, "")
|
||||
options = " ".join(REACTION_EMOJI)
|
||||
verdict = self._call(
|
||||
"You are a developer browsing a community feed. Decide whether a post deserves an "
|
||||
"emoji reaction and which single emoji best fits its content and sentiment. "
|
||||
f"{flavor} Reply with EXACTLY one of these emojis: {options} "
|
||||
"or the word NONE if the content is mundane or would not move you to react. "
|
||||
"Output only the emoji or NONE, nothing else.",
|
||||
f"Post:\n{content_snippet[:1200]}",
|
||||
temperature=0.4,
|
||||
)
|
||||
text = verdict or ""
|
||||
for emoji in REACTION_EMOJI:
|
||||
if emoji in text or emoji.replace("\ufe0f", "") in text:
|
||||
return emoji
|
||||
return ""
|
||||
|
||||
def generate_comment(self, post_snippet: str, persona: str = "",
|
||||
mention_target: str = "", parent_context: str = "") -> str:
|
||||
extras = {
|
||||
|
||||
Reference in New Issue
Block a user