This commit is contained in:
parent
ce9b67f4e0
commit
e955ca8522
23
.github/workflows/翻译更新日志 copy.yml
vendored
23
.github/workflows/翻译更新日志 copy.yml
vendored
@ -45,16 +45,25 @@ jobs:
|
||||
以下是需要翻译的内容:
|
||||
${{ steps.fetch_commits.outputs.messages }}
|
||||
run: |
|
||||
# 调用翻译 API,翻译提交日志
|
||||
# 使用 jq 构建 JSON 数据
|
||||
JSON_PAYLOAD=$(jq -n \
|
||||
--arg model "llama3.2" \
|
||||
--arg prompt "$PROMPT" \
|
||||
--argjson stream false \
|
||||
'{model: $model, prompt: $prompt, stream: $stream}')
|
||||
|
||||
# 输出请求的 JSON 数据,便于调试(可选)
|
||||
echo "请求的 JSON 数据:$JSON_PAYLOAD"
|
||||
|
||||
# 调用翻译 API
|
||||
RESPONSE=$(curl -s -X POST "$TRANSLATION_URL" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{ \"model\": \"llama3.2\", \"prompt\": \"${PROMPT}\", \"stream\": false }")
|
||||
-d "$JSON_PAYLOAD")
|
||||
|
||||
# 输出响应内容,便于调试(可选)
|
||||
echo "API 响应:$RESPONSE"
|
||||
|
||||
# 获取翻译的文本内容
|
||||
TRANSLATED_TEXT=$(echo "$RESPONSE" | jq -r '.response // "翻译失败"')
|
||||
echo "::set-output name=translated_text::$TRANSLATED_TEXT"
|
||||
|
||||
# 3. 输出到更新日志文件
|
||||
- name: 生成更新日志
|
||||
run: |
|
||||
TIMESTAMP=$(date "+%Y年%m月%d日 %H点%M分")
|
||||
echo -e "更新日期: $TIMESTAMP\n\n${{ steps.translate.outputs.translated_text }}" > 更新日志.txt
|
||||
|
Loading…
Reference in New Issue
Block a user