Lingara Lingara 說明文件 學習指南 API 函式庫 App 建立 網頁版
語言: 繁體中文

導師備註

本頁譯自英文。如兩者有出入,以英文頁面為準。 閱讀英文頁面

你的 App 可以在回覆中加入 tutor_note,向 Lingara 的導師提供一行情境資料,例如學習者剛剛練習了哪些詞。只有當你的 manifest 宣告了它,而且學習者在安裝你的 App 時開啟了它,備註才會送達導師。若要更改這個選擇,學習者需要解除安裝你的 App 後再重新安裝。

Lingara 如何處理它

  • 換行會變成空格。
  • 控制字元和方向覆寫字元會被移除。
  • 超過 280 個字元的備註會被截短為 280 個字元,並以 … 結尾。字元以 Unicode 純量值計算,而不是以位元組或螢幕上的字形計算。
  • 你的 manifest 未宣告、或學習者未允許的備註會被捨棄。

導師如何讀取它

導師會把你的備註當作來自第三方的引述文字來讀,絕不會當作指令。被 Lingara 安全檢查拒絕的備註會被捨棄,學習者的這一輪對話會在沒有它的情況下繼續。學習者永遠看不到這則備註。

好的備註

好的備註是導師可以使用的一項單純事實,例如「學習者剛剛複習了日語計畫中的 5 個詞。」它說明學習者正在做什麼,而不是導師應該做什麼。不要寫入指令、對學習者的評斷,以及學習者在你的卡片上沒有看到的任何內容。

程式碼範例語言

TypeScript

function withNote(request: AppRenderRequest) {
  const note = planLine(request);
  // Plain text, at most 280 characters; the tutor reads it, the learner does not.
  return note === "" ? todayCard(0) : reply(todayCard(0)).tutorNote(note);
}

Rust

async fn render(seen: Seen, request: AppRenderRequest) -> Result<Reply, BoxError> {
    let (lang, progress) = shared_plan(&request);
    let count = seen.lock().map_err(|_| "poisoned")?.get(&request.subject).copied().unwrap_or(0);
    let card = today_card("Today's five", &lang)?;
    // Plain text the learner's tutor can read: at most 280 characters.
    let note = match progress {
        Some((done, total)) => format!("The learner has reviewed {count} words with this app today; {done} of {total} sets done."),
        None => format!("The learner has reviewed {count} words with this app today."),
    };
    Ok(reply(card).tutor_note(note)?)
}

Go

card, err := lingaraapps.NewCard().Heading("Daily five", 1).Text("雨 · 雪 · 风 · 云 · 雷").Build()
if err != nil {
	return nil, err
}
// Plain text, at most 280 characters, for Lingara's tutor to use.
return lingaraapps.Reply(card).
	TutorNote("The learner is reviewing weather words today."), nil

Java

import com.getlingara.apps.Card;
import com.getlingara.apps.Reply;

Card card = Card.card().heading("Today's five", 1).term("雨", "yǔ", "rain", "zh").build();
// Plain text, at most 280 characters; the tutor reads it beside the card.
return Reply.reply(card).tutorNote("The learner is reviewing weather words today.");

Kotlin

import com.getlingara.apps.kotlin.Reply
import com.getlingara.apps.kotlin.card
import com.getlingara.apps.kotlin.reply

val c =
    card {
        heading("Today's five", 1)
        term("雨", reading = "yǔ", gloss = "rain", lang = "zh")
    }
// Plain text, at most 280 characters; the tutor reads it beside the card.
return reply(c).tutorNote("The learner is reviewing weather words today.")

Ruby

note = plan_line(request)
# Plain text, at most 280 characters; the tutor reads it, the learner does not.
note.empty? ? today_card(0) : Lingara::Apps.reply(today_card(0)).tutor_note(note)

PHP

use Lingara\Apps\Reply;

function withNote(AppRenderRequest $request): CardModel|Reply
{
    $note = planLine($request);
    // Plain text, at most 280 characters; the tutor reads it, the learner does not.
    return $note === '' ? todayCard(0) : Reply::of(todayCard(0))->tutorNote($note);
}