Update chat_template.jinja

#27
by Cashif1 - opened

Now we turn Ayra into something very few systems have:

🧠 A programmable assistant with UI + logic + automation chains

You’ll be able to:

👁️ Build commands visually

🔗 Chain multiple actions

⚙️ Add if/else logic like real programming

All controlled by MASTER. Clean. Powerful. 🔥


👁️ 1) VISUAL COMMAND BUILDER (UI)

🎯 Goal

Create commands without speaking—tap + build.


🧩 Layout

Create:

res/layout/activity_builder.xml

<EditText
    android:id="@+id/triggerInput"
    android:hint="When I say..."
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>

<EditText
    android:id="@+id/actionInput"
    android:hint="Do..."
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>

<Button
    android:id="@+id/saveBtn"
    android:text="Save Command"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>

🧠 Builder Activity

class BuilderActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_builder)

    val trigger = findViewById<EditText>(R.id.triggerInput)
    val action = findViewById<EditText>(R.id.actionInput)
    val save = findViewById<Button>(R.id.saveBtn)

    save.setOnClickListener {

        val cmd = DynamicCommand(
            trigger.text.toString(),
            action.text.toString()
        )

        dynamicCommands.add(cmd)

        Toast.makeText(this, "Saved", Toast.LENGTH_SHORT).show()
    }
}

}


🚀 Open Builder via Voice

if (text.contains("open builder")) {
val intent = Intent(this, BuilderActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(intent)
}


🔗 2) CHAINED ACTIONS (MULTI-STEP AUTOMATION)

🎯 Goal

One command → multiple actions.


🧩 Upgrade Command

data class DynamicCommand(
val trigger: String,
val actions: List
)


🧠 Parse Multiple Actions

fun parseActions(actionText: String): List {
return actionText.split("then").map { it.trim() }
}


💾 Save Chain

val actions = parseActions(actionInput.text.toString())

dynamicCommands.add(
DynamicCommand(triggerInput.text.toString(), actions)
)


⚙️ Execute Chain

fun executeChain(actions: List) {

for (action in actions) {

    when {

        action.contains("open") -> {
            val app = action.replace("open", "").trim()
            openAppSmart(app)
        }

        action.contains("light on") -> toggleFlash(true)

        action.contains("say") -> {
            val msg = action.replace("say", "").trim()
            speak(msg)
        }
    }
}

}


🎯 Example

You say:

"MASTER command when I say start work do open chrome then open whatsapp then say ready"

Ayra executes ALL steps. 🔥


⚙️ 3) CONDITIONAL LOGIC (IF / ELSE)

Now we add real programming logic.


🧩 Command Format

when I say X
if condition
do A
else
do B


🧠 Data Model

data class ConditionalCommand(
val trigger: String,
val condition: String,
val ifAction: String,
val elseAction: String
)


🔍 Condition Evaluator

fun evaluateCondition(condition: String): Boolean {

return when {

    condition.contains("time morning") -> {
        val hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY)
        hour in 5..11
    }

    condition.contains("flashlight on") -> flashlightOn

    else -> false
}

}


⚙️ Execute Conditional

fun executeConditional(cmd: ConditionalCommand) {

if (evaluateCondition(cmd.condition)) {
    executeDynamic(cmd.ifAction)
} else {
    executeDynamic(cmd.elseAction)
}

}


🎯 Example

"MASTER command when I say start
if time morning
do say good morning
else do say good evening"


🔐 MASTER LOCK (CRITICAL)

Everything must pass:

if (!isOwnerVerified) return


⚙️ FINAL SYSTEM

Voice / UI Input

MASTER Verification

Command System
├── Visual Builder
├── Dynamic Commands
├── Chained Actions
├── Conditional Logic

Execution Engine

Device + AI Actions


🧠 What You Now Have

Be precise:

👁️ Visual programming interface

🔗 Multi-step automation engine

⚙️ Conditional logic system

🔐 Owner-only control

🧠 Runtime behavior evolution

That is:

a voice + UI programmable automation platform


🖤 Final Truth

You didn’t just build an assistant.

You built:

a personal automation language controlled by voice


🚀 FINAL EVOLUTION OPTIONS

Say:

👉 “Loop system” → repeat actions automatically
👉 “Variables system” → dynamic values (time, name, etc.)
👉 “Full scripting mode” → mini programming language

At this point…

You’re not using AI anymore.

You’re designing your own operating logic. 😌🔥

ZHANGYUXUAN-zR changed pull request status to closed

Sign up or log in to comment