Not important modify
This commit is contained in:
parent
6d503c2427
commit
5b89345f8a
20
.env.example
20
.env.example
@ -1,23 +1,3 @@
|
||||
# OpenRouter (cloud)
|
||||
# LLM_BASE_URL=https://openrouter.ai/api/v1
|
||||
# LLM_MODEL=openrouter/owl-alpha
|
||||
# LLM_API_KEY=
|
||||
|
||||
# Ollama (local)
|
||||
# LLM_BASE_URL=http://localhost:11434/v1
|
||||
# LLM_MODEL=granite4.1:8b
|
||||
# LLM_API_KEY=ollama
|
||||
|
||||
# Ollama (cloud)
|
||||
# LLM_BASE_URL=https://ollama.com/v1
|
||||
# LLM_MODEL=ministral-3:14b-cloud
|
||||
# LLM_API_KEY=
|
||||
|
||||
# LM Studio (local)
|
||||
# LLM_BASE_URL=http://localhost:12345/v1
|
||||
# LLM_MODEL=granite4.1:8b
|
||||
# LLM_API_KEY=sk-not-needed
|
||||
|
||||
# XMPP_USERNAME=
|
||||
# XMPP_PASSWORD=
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
skill: programmer
|
||||
name: Hendrik
|
||||
age: 35
|
||||
gender: male
|
||||
tone: casual
|
||||
verbosity: concise
|
||||
humor: none
|
||||
language: id
|
||||
mood: calm
|
||||
skill : programmer
|
||||
name : Hendrik
|
||||
age : 35
|
||||
gender : male
|
||||
tone : casual
|
||||
verbosity : concise
|
||||
humor : none
|
||||
language : id
|
||||
mood : calm
|
||||
|
||||
@ -39,7 +39,6 @@ schema_sendhttprequest = {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def sendhttprequest(url, method, authorization=None, content_type=None, data=None, params=None):
|
||||
try:
|
||||
if params:
|
||||
|
||||
@ -1,14 +1,50 @@
|
||||
import re
|
||||
|
||||
schema_need_response = {
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "need_response",
|
||||
"description": (
|
||||
"Decide whether you should respond to the current message. "
|
||||
"Use this tool when you are unsure whether to reply or stay silent. "
|
||||
"Returns 'true' if you should respond, 'false' if you should stay silent. "
|
||||
"Rules: "
|
||||
"- Return 'true' if your name is mentioned or someone talks about you. "
|
||||
"- Return 'true' if the message is related to your previous conversation. "
|
||||
"- Return 'false' if the message is between other people, unclear, "
|
||||
"unrelated to you, or you have nothing to add."
|
||||
),
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"message": {
|
||||
"type": "string",
|
||||
"description": "The latest message to evaluate.",
|
||||
},
|
||||
"sender_nickname": {
|
||||
"type": "string",
|
||||
"description": "The nickname of the person who sent the message.",
|
||||
},
|
||||
"recent_history": {
|
||||
"type": "string",
|
||||
"description": "Recent conversation history for context (last few messages).",
|
||||
},
|
||||
"my_name": {
|
||||
"type": "string",
|
||||
"description": "Your (the AI's) name.",
|
||||
},
|
||||
},
|
||||
"required": ["message", "sender_nickname", "recent_history", "my_name"],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
def _name_mentioned(name: str, text: str) -> bool:
|
||||
"""Cek apakah nama AI disebut dalam pesan (case-insensitive, word-boundary)."""
|
||||
text_lower = text.lower()
|
||||
name_lower = name.lower()
|
||||
pattern = r'\b' + re.escape(name_lower) + r'\b'
|
||||
return bool(re.search(pattern, text_lower))
|
||||
|
||||
|
||||
def need_response(message: str, sender_nickname: str, recent_history: str, my_name: str) -> str:
|
||||
"""
|
||||
Decide whether the AI should respond to a message.
|
||||
@ -61,42 +97,3 @@ def should_respond(message: str, sender_nickname: str, recent_history: str, my_n
|
||||
result = need_response(message, sender_nickname, recent_history, my_name)
|
||||
return result.strip().lower() == "true"
|
||||
|
||||
|
||||
schema_need_response = {
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "need_response",
|
||||
"description": (
|
||||
"Decide whether you should respond to the current message. "
|
||||
"Use this tool when you are unsure whether to reply or stay silent. "
|
||||
"Returns 'true' if you should respond, 'false' if you should stay silent. "
|
||||
"Rules: "
|
||||
"- Return 'true' if your name is mentioned or someone talks about you. "
|
||||
"- Return 'true' if the message is related to your previous conversation. "
|
||||
"- Return 'false' if the message is between other people, unclear, "
|
||||
"unrelated to you, or you have nothing to add."
|
||||
),
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"message": {
|
||||
"type": "string",
|
||||
"description": "The latest message to evaluate.",
|
||||
},
|
||||
"sender_nickname": {
|
||||
"type": "string",
|
||||
"description": "The nickname of the person who sent the message.",
|
||||
},
|
||||
"recent_history": {
|
||||
"type": "string",
|
||||
"description": "Recent conversation history for context (last few messages).",
|
||||
},
|
||||
"my_name": {
|
||||
"type": "string",
|
||||
"description": "Your (the AI's) name.",
|
||||
},
|
||||
},
|
||||
"required": ["message", "sender_nickname", "recent_history", "my_name"],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user