Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Initial support for TTS functionality #14716

Draft
wants to merge 20 commits into
base: develop
Choose a base branch
from

Conversation

MomentQYC
Copy link
Contributor

What

This is an initial implementation of the TTS functionality, which can subsequently be built upon to improve ease of use, add providers (the existing ones can actually be deployed on our own), and even be set up by the user.

Why

Hopefully it can be an emergency measure for some of the population at some point.

Additional info (optional)

It is currently only a preliminary realization, so only a rough framework has been formed.

Checklist

  • Read the contribution guide
  • Test working in a local environment
  • (If needed) Add story of storybook
  • (If needed) Update CHANGELOG.md
  • (If possible) Add tests

Thanks to @MarryDream for the guidance in implementing the feature.

@github-actions github-actions bot added packages/frontend Client side specific issue/PR packages/backend Server side specific issue/PR packages/misskey-js labels Oct 6, 2024
Copy link

codecov bot commented Oct 6, 2024

Codecov Report

Attention: Patch coverage is 13.93939% with 284 lines in your changes missing coverage. Please review.

Project coverage is 23.74%. Comparing base (ed89b4b) to head (b19cc62).
Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
...ges/frontend/src/pages/admin/external-services.vue 0.00% 150 Missing ⚠️
packages/frontend/src/scripts/get-note-menu.ts 0.00% 42 Missing ⚠️
...ackages/frontend/src/components/MkNoteDetailed.vue 0.00% 33 Missing ⚠️
packages/frontend/src/scripts/misskey-api.ts 0.00% 26 Missing ⚠️
packages/frontend/src/pages/admin/roles.editor.vue 0.00% 20 Missing ⚠️
packages/frontend/src/pages/admin/roles.vue 0.00% 8 Missing ⚠️
packages/frontend/src/pages/settings/profile.vue 0.00% 3 Missing ⚠️
.../frontend/src/components/MkTutorialDialog.Note.vue 0.00% 1 Missing ⚠️
...es/frontend/src/pages/admin/RolesEditorFormula.vue 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           develop   #14716       +/-   ##
============================================
- Coverage    39.57%   23.74%   -15.83%     
============================================
  Files         1553      725      -828     
  Lines       195043   108357    -86686     
  Branches      3561     1060     -2501     
============================================
- Hits         77183    25731    -51452     
+ Misses      117257    82076    -35181     
+ Partials       603      550       -53     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

github-actions bot commented Oct 6, 2024

このPRによるapi.jsonの差分

差分はこちら
--- base
+++ head
@@ -154,6 +154,9 @@
                     "translatorAvailable": {
                       "type": "boolean"
                     },
+                    "ttsAvailable": {
+                      "type": "boolean"
+                    },
                     "silencedHosts": {
                       "type": "array",
                       "items": {
@@ -594,6 +597,7 @@
                     "enableEmail",
                     "enableServiceWorker",
                     "translatorAvailable",
+                    "ttsAvailable",
                     "mediaSilencedHosts",
                     "pinnedUsers",
                     "hiddenTags",
@@ -14020,6 +14024,71 @@
                   "deeplIsPro": {
                     "type": "boolean"
                   },
+                  "hfAuthKey": {
+                    "type": [
+                      "string",
+                      "null"
+                    ]
+                  },
+                  "hfSpace": {
+                    "type": "boolean",
+                    "default": false
+                  },
+                  "hfSpaceName": {
+                    "type": [
+                      "string",
+                      "null"
+                    ]
+                  },
+                  "hfexampleAudioURL": {
+                    "type": [
+                      "string",
+                      "null"
+                    ]
+                  },
+                  "hfexampleText": {
+                    "type": [
+                      "string",
+                      "null"
+                    ]
+                  },
+                  "hfexampleLang": {
+                    "type": [
+                      "string",
+                      "null"
+                    ]
+                  },
+                  "hfslice": {
+                    "type": [
+                      "string",
+                      "null"
+                    ],
+                    "default": "Slice once every 4 sentences"
+                  },
+                  "hftopK": {
+                    "type": "integer",
+                    "default": 15
+                  },
+                  "hftopP": {
+                    "type": "integer",
+                    "default": 100
+                  },
+                  "hfTemperature": {
+                    "type": "integer",
+                    "default": 100
+                  },
+                  "hfnrm": {
+                    "type": "boolean",
+                    "default": false
+                  },
+                  "hfSpeedRate": {
+                    "type": "integer",
+                    "default": 125
+                  },
+                  "hfdas": {
+                    "type": "boolean",
+                    "default": false
+                  },
                   "enableEmail": {
                     "type": "boolean"
                   },
@@ -50243,6 +50312,9 @@
                   "isCat": {
                     "type": "boolean"
                   },
+                  "isVI": {
+                    "type": "boolean"
+                  },
                   "injectFeaturedNote": {
                     "type": "boolean"
                   },
@@ -61174,6 +61246,201 @@
         }
       }
     },
+    "/notes/tts": {
+      "post": {
+        "operationId": "notes___tts",
+        "summary": "notes/tts",
+        "description": "No description provided.\n\n**Credential required**: *Yes* / **Permission**: *read:account*",
+        "externalDocs": {
+          "description": "Source code",
+          "url": "https:/misskey-dev/misskey/blob/develop/packages/backend/src/server/api/endpoints/notes/tts.ts"
+        },
+        "tags": [
+          "notes"
+        ],
+        "security": [
+          {
+            "bearerAuth": []
+          }
+        ],
+        "requestBody": {
+          "required": true,
+          "content": {
+            "application/json": {
+              "schema": {
+                "type": "object",
+                "properties": {
+                  "noteId": {
+                    "type": "string",
+                    "format": "misskey:id"
+                  }
+                },
+                "required": [
+                  "noteId"
+                ]
+              }
+            }
+          }
+        },
+        "responses": {
+          "200": {
+            "description": "OK (with results)",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "type": "string",
+                  "contentMediaType": "audio/flac"
+                }
+              }
+            }
+          },
+          "204": {
+            "description": "OK (without any results)"
+          },
+          "400": {
+            "description": "Client error",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "INCORRECT_CONFIG": {
+                    "value": {
+                      "error": {
+                        "message": "Incorrect configuration.",
+                        "code": "INCORRECT_CONFIG",
+                        "id": "8d171e60-83b8-11ef-b98c-a7506d6c1de4"
+                      }
+                    }
+                  },
+                  "UNAVAILABLE": {
+                    "value": {
+                      "error": {
+                        "message": "Convert of notes unavailable.",
+                        "code": "UNAVAILABLE",
+                        "id": "97a0826c-6393-11ef-a650-67972d710975"
+                      }
+                    }
+                  },
+                  "NO_SUCH_NOTE": {
+                    "value": {
+                      "error": {
+                        "message": "No such note.",
+                        "code": "NO_SUCH_NOTE",
+                        "id": "bea9b03f-36e0-49c5-a4db-627a029f8971"
+                      }
+                    }
+                  },
+                  "CANNOT_CONVERT_INVISIBLE_NOTE": {
+                    "value": {
+                      "error": {
+                        "message": "Cannot convert invisible note.",
+                        "code": "CANNOT_CONVERT_INVISIBLE_NOTE",
+                        "id": "f57caae0-6394-11ef-8e2a-d706932c1030"
+                      }
+                    }
+                  },
+                  "INVALID_PARAM": {
+                    "value": {
+                      "error": {
+                        "message": "Invalid param.",
+                        "code": "INVALID_PARAM",
+                        "id": "3d81ceae-475f-4600-b2a8-2bc116157532"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          "401": {
+            "description": "Authentication error",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "CREDENTIAL_REQUIRED": {
+                    "value": {
+                      "error": {
+                        "message": "Credential required.",
+                        "code": "CREDENTIAL_REQUIRED",
+                        "id": "1384574d-a912-4b81-8601-c7b1c4085df1"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          "403": {
+            "description": "Forbidden error",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "AUTHENTICATION_FAILED": {
+                    "value": {
+                      "error": {
+                        "message": "Authentication failed. Please ensure your token is correct.",
+                        "code": "AUTHENTICATION_FAILED",
+                        "id": "b0a7f5f8-dc2f-4171-b91f-de88ad238e14"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          "418": {
+            "description": "I'm Ai",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "I_AM_AI": {
+                    "value": {
+                      "error": {
+                        "message": "You sent a request to Ai-chan, Misskey's showgirl, instead of the server.",
+                        "code": "I_AM_AI",
+                        "id": "60c46cd1-f23a-46b1-bebe-5d2b73951a84"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          "500": {
+            "description": "Internal server error",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "INTERNAL_ERROR": {
+                    "value": {
+                      "error": {
+                        "message": "Internal error occurred. Please contact us if the error persists.",
+                        "code": "INTERNAL_ERROR",
+                        "id": "5d37dbcb-891e-41ca-a3d6-e690c97775ac"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    },
     "/notes/unrenote": {
       "post": {
         "operationId": "notes___unrenote",
@@ -77084,6 +77351,9 @@
           "isCat": {
             "type": "boolean"
           },
+          "isVI": {
+            "type": "boolean"
+          },
           "instance": {
             "type": "object",
             "properties": {
@@ -81143,6 +81413,7 @@
               "isLocked",
               "isBot",
               "isCat",
+              "isVI",
               "isExplorable"
             ]
           }
@@ -81435,6 +81706,9 @@
           "canUseTranslator": {
             "type": "boolean"
           },
+          "canUseTTS": {
+            "type": "boolean"
+          },
           "canHideAds": {
             "type": "boolean"
           },
@@ -81506,6 +81780,7 @@
           "canManageAvatarDecorations",
           "canSearchNotes",
           "canUseTranslator",
+          "canUseTTS",
           "canHideAds",
           "driveCapacityMb",
           "alwaysMarkNsfw",
@@ -82046,6 +82321,9 @@
           "translatorAvailable": {
             "type": "boolean"
           },
+          "ttsAvailable": {
+            "type": "boolean"
+          },
           "mediaProxy": {
             "type": "string"
           },
@@ -82149,6 +82427,7 @@
           "enableEmail",
           "enableServiceWorker",
           "translatorAvailable",
+          "ttsAvailable",
           "mediaProxy",
           "enableUrlPreview",
           "backgroundImageUrl",

Get diff files from Workflow Page

@kakkokari-gtyih
Copy link
Contributor

I think we should discuss the feature first (especially large scale one like this) in an issue before actually implement it

@MomentQYC
Copy link
Contributor Author

I think we should discuss the feature first (especially large scale one like this) in an issue before actually implement it

#14721

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packages/backend Server side specific issue/PR packages/frontend Client side specific issue/PR packages/misskey-js
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants