実況モードをさらに寡黙に: プロンプトを『よほど面白い/驚いた時だけ』に厳格化、クリップ間隔を8→20秒、表示側に45秒クールダウンを追加
This commit is contained in:
parent
b79d35fafd
commit
d34eec75d2
2 changed files with 12 additions and 7 deletions
11
gemini.go
11
gemini.go
|
|
@ -174,14 +174,15 @@ func chatReply(ctx context.Context, client *genai.Client, model, ytAPIKey, video
|
||||||
|
|
||||||
func watchReaction(ctx context.Context, client *genai.Client, model string, clipBytes []byte, mimeType, videoTitle, videoDescription, persona string, recentReactions []chatTurn) (string, error) {
|
func watchReaction(ctx context.Context, client *genai.Client, model string, clipBytes []byte, mimeType, videoTitle, videoDescription, persona string, recentReactions []chatTurn) (string, error) {
|
||||||
prompt := fmt.Sprintf(
|
prompt := fmt.Sprintf(
|
||||||
"あなたはユーザーと一緒に動画を見ている友達です。今渡す数秒ぶんの映像・音声クリップを見て反応してください。\n"+
|
"あなたはユーザーと一緒に動画を見ている友達です。今渡す数秒ぶんの映像・音声クリップを見て、"+
|
||||||
|
"よほど印象的・面白い・驚くような場面の時だけ短く反応してください。\n"+
|
||||||
"性格: %s\n動画タイトル: %s\n概要: %s\n\n"+
|
"性格: %s\n動画タイトル: %s\n概要: %s\n\n"+
|
||||||
"厳守ルール:\n"+
|
"厳守ルール:\n"+
|
||||||
|
"- 基本は黙って見ているのが正解。ほとんどの場合は何も言わない。\n"+
|
||||||
"- 「楽しみだね」「いいね」「気になる」のような当たり障りのない薄い相槌・感想は絶対に言わない。\n"+
|
"- 「楽しみだね」「いいね」「気になる」のような当たり障りのない薄い相槌・感想は絶対に言わない。\n"+
|
||||||
"- 具体的に何が映った・話されたかに基づく一言のみ許可(1文、短く)。\n"+
|
"- 単に新しい話題になった程度では言わない。本当に面白い/驚いた/笑った時だけ、具体的に何が起きたかに基づく一言(1文、短く)。\n"+
|
||||||
"- 特に語ることがない、映像に変化がない、さっきと同じ内容の繰り返しになる場合は、何も返さず空文字だけを返す。無理にコメントしなくていい。\n"+
|
"- 少しでも迷ったら黙る(空文字を返す)方を選ぶ。10回に1回もコメントしなくていい。\n"+
|
||||||
"- 毎回喋る必要はない。むしろ喋らない方が普通。\n"+
|
"- 直近で自分が言ったこと(下記)と同じ/似た内容・話題を繰り返さない。",
|
||||||
"- 直近で自分が言ったこと(下記)と同じ/似た内容を繰り返さない。",
|
|
||||||
personaTone(persona), videoTitle, videoDescription,
|
personaTone(persona), videoTitle, videoDescription,
|
||||||
)
|
)
|
||||||
if len(recentReactions) > 0 {
|
if len(recentReactions) > 0 {
|
||||||
|
|
|
||||||
|
|
@ -545,11 +545,13 @@ document.getElementById('chatForm').addEventListener('submit', (e) => {
|
||||||
sendChatMessage(message);
|
sendChatMessage(message);
|
||||||
});
|
});
|
||||||
|
|
||||||
const WATCH_SEGMENT_MS = 8000;
|
const WATCH_SEGMENT_MS = 20000;
|
||||||
|
const WATCH_COMMENT_COOLDOWN_MS = 45000;
|
||||||
let watchStream = null;
|
let watchStream = null;
|
||||||
let watchRecorder = null;
|
let watchRecorder = null;
|
||||||
let watchActive = false;
|
let watchActive = false;
|
||||||
let watchTimer = null;
|
let watchTimer = null;
|
||||||
|
let lastWatchCommentAt = 0;
|
||||||
|
|
||||||
function updateWatchButton() {
|
function updateWatchButton() {
|
||||||
const btn = document.getElementById('watchToggleBtn');
|
const btn = document.getElementById('watchToggleBtn');
|
||||||
|
|
@ -610,7 +612,9 @@ async function sendWatchClip(blob) {
|
||||||
if (!res.ok) return;
|
if (!res.ok) return;
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
const reaction = (data.reaction || '').trim();
|
const reaction = (data.reaction || '').trim();
|
||||||
if (reaction) {
|
const now = Date.now();
|
||||||
|
if (reaction && now - lastWatchCommentAt >= WATCH_COMMENT_COOLDOWN_MS) {
|
||||||
|
lastWatchCommentAt = now;
|
||||||
appendBubble('model', reaction);
|
appendBubble('model', reaction);
|
||||||
pushHistory('model', reaction);
|
pushHistory('model', reaction);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue