giggle-generation-music

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Giggle Music

Giggle Music

Generates AI music via giggle.pro. Supports simplified and custom modes. Submit task → query when ready. No polling or Cron.
API Key: Set system environment variable
GIGGLE_API_KEY
. Log in to Giggle.pro and obtain the API Key from account settings.
Important: Never pass
GIGGLE_API_KEY
in exec's
env
parameter. API Key is read from system environment variable.
No Retry on Error: If script execution encounters an error, do not retry. Report the error to the user directly and stop.

通过giggle.pro生成AI音乐。支持简化模式和自定义模式。提交任务→就绪时查询。无需轮询或Cron。
API密钥:设置系统环境变量
GIGGLE_API_KEY
。登录Giggle.pro并从账户设置中获取API密钥。
重要提示绝对不要在exec的
env
参数中传递
GIGGLE_API_KEY
。API密钥从系统环境变量中读取。
错误时不重试:如果脚本执行遇到错误,请勿重试。直接向用户报告错误并停止操作。

Interaction Guide

交互指南

Mode Selection (priority: high to low)

模式选择(优先级从高到低)

User inputModeDescription
User provides full lyricsCustom mode (B)Must be lyrics, not description
User requests instrumental/background musicInstrumental mode (C)No vocals
Other cases (description, style, vocals, etc.)Simplified mode (A)Use user description as prompt; AI composes
Key rule: If the user does not provide lyrics, always use simplified mode A. Use the user's description exactly as
--prompt
; do not add or rewrite. E.g. user says "female voice, 1 min, ancient romance", use
--prompt "female voice, 1 min, ancient romance"
directly.
用户输入模式说明
用户提供完整歌词自定义模式(B)必须是歌词,而非描述
用户请求器乐/背景音乐器乐模式(C)无 vocals
其他情况(描述、风格、人声等)简化模式(A)使用用户描述作为提示词;由AI完成编曲
核心规则:如果用户未提供歌词,始终使用简化模式A。直接将用户的描述作为
--prompt
参数;请勿添加或改写。例如:用户说“女声,1分钟,古风言情”,则直接使用
--prompt "女声,1分钟,古风言情"

Guidance when info is lacking

信息缺失时的引导

Only when the user input is very vague (e.g. "generate music" with no description), ask:
Question: "What type of music would you like to generate?"
Options: AI compose (describe style) / Use my lyrics / Instrumental

仅当用户输入非常模糊时(例如仅输入“生成音乐”且无其他描述),询问:
问题:“你想要生成什么类型的音乐?”
选项:AI创作(描述风格)/ 使用我的歌词 / 器乐

Execution Flow: Submit and Query

执行流程:提交与查询

Music generation is asynchronous (typically 1–3 minutes). Submit a task to get
task_id
, then query when the user wants to check status.

音乐生成为异步操作(通常需要1–3分钟)。提交任务以获取
task_id
,然后在用户想要查看状态时进行查询

Step 1: Submit Task

步骤1:提交任务

First send a message to the user: "Music generation submitted. Usually takes 1–3 minutes. You can ask me about the progress anytime."
首先向用户发送消息:“音乐生成任务已提交。通常需要1–3分钟完成。你可以随时询问进度。”

A: Simplified Mode

A: 简化模式

bash
python3 scripts/giggle_music_api.py --prompt "user description"
bash
python3 scripts/giggle_music_api.py --prompt "用户描述"

B: Custom Mode

B: 自定义模式

bash
python3 scripts/giggle_music_api.py --custom \
  --prompt "lyrics content" \
  --style "pop, ballad" \
  --title "Song Title" \
  --vocal-gender female
bash
python3 scripts/giggle_music_api.py --custom \
  --prompt "歌词内容" \
  --style "pop, ballad" \
  --title "歌曲标题" \
  --vocal-gender female

C: Instrumental

C: 器乐模式

bash
python3 scripts/giggle_music_api.py --prompt "user description" --instrumental
Response example:
json
{"status": "started", "task_id": "xxx"}
Store task_id in memory (
addMemory
):
giggle-generation-music task_id: xxx (submitted: YYYY-MM-DD HH:mm)

bash
python3 scripts/giggle_music_api.py --prompt "用户描述" --instrumental
响应示例:
json
{"status": "started", "task_id": "xxx"}
将task_id存储到内存中
addMemory
):
giggle-generation-music task_id: xxx (submitted: YYYY-MM-DD HH:mm)

Step 2: Query When User Asks

步骤2:用户询问时查询

When the user asks about music progress (e.g. "is my music ready?", "progress?"), run:
bash
python3 scripts/giggle_music_api.py --query --task-id <task_id>
Output handling:
stdout patternAction
Plain text with music links (🎶 音乐已就绪)Forward to user as-is
Plain text with errorForward to user as-is
JSON
{"status": "processing", "task_id": "..."}
Tell user "Still in progress, please ask again in a moment"
Link return rule: Audio links in stdout must be full signed URLs (with Policy, Key-Pair-Id, Signature query params). Correct:
https://assets.giggle.pro/...?Policy=...&Key-Pair-Id=...&Signature=...
. Keep as-is when forwarding.

当用户询问音乐进度时(例如“我的音乐好了吗?”、“进度如何?”),运行:
bash
python3 scripts/giggle_music_api.py --query --task-id <task_id>
输出处理
标准输出格式操作
包含音乐链接的纯文本(🎶 音乐已就绪)直接转发给用户
包含错误信息的纯文本直接转发给用户
JSON格式
{"status": "processing", "task_id": "..."}
告知用户“仍在处理中,请稍后再问”
链接返回规则:标准输出中的音频链接必须是完整的签名URL(包含Policy、Key-Pair-Id、Signature查询参数)。正确示例:
https://assets.giggle.pro/...?Policy=...&Key-Pair-Id=...&Signature=...
。转发时保持原样即可。

Recovery

恢复机制

When the user asks about previous music progress:
  1. task_id in memory → Run
    --query --task-id xxx
    directly. Do not resubmit
  2. No task_id in memory → Tell the user, ask if they want to regenerate

当用户询问之前的音乐进度时:
  1. 内存中有task_id → 直接运行
    --query --task-id xxx
    请勿重新提交任务
  2. 内存中无task_id → 告知用户,并询问是否需要重新生成

Parameter Reference

参数参考

ParameterDescription
--prompt
Music description or lyrics (required in simplified mode)
--custom
Enable custom mode
--style
Music style (required in custom mode)
--title
Song title (required in custom mode)
--instrumental
Generate instrumental
--vocal-gender
Vocal gender: male / female (custom mode only)
--query
Query task status
--task-id
Task ID (use with --query)
参数说明
--prompt
音乐描述或歌词(简化模式下为必填项)
--custom
启用自定义模式
--style
音乐风格(自定义模式下为必填项)
--title
歌曲标题(自定义模式下为必填项)
--instrumental
生成器乐
--vocal-gender
人声性别:male / female(仅适用于自定义模式)
--query
查询任务状态
--task-id
任务ID(与--query配合使用)