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 26 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.75%. Comparing base (a3d236c) to head (0c79b46).
Report is 329 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    41.74%   23.75%   -17.99%     
============================================
  Files         1549      725      -824     
  Lines       196555   108491    -88064     
  Branches      2767     1059     -1708     
============================================
- Hits         82055    25777    -56278     
+ Misses      113939    82165    -31774     
+ Partials       561      549       -12     

☔ 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
@@ -157,6 +157,9 @@
                     "translatorAvailable": {
                       "type": "boolean"
                     },
+                    "ttsAvailable": {
+                      "type": "boolean"
+                    },
                     "silencedHosts": {
                       "type": "array",
                       "items": {
@@ -449,6 +452,75 @@
                     "deeplIsPro": {
                       "type": "boolean"
                     },
+                    "hfAuthKey": {
+                      "type": [
+                        "string",
+                        "null"
+                      ]
+                    },
+                    "hfSpace": {
+                      "type": "boolean"
+                    },
+                    "hfSpaceName": {
+                      "type": [
+                        "string",
+                        "null"
+                      ]
+                    },
+                    "hfexampleAudioURL": {
+                      "type": [
+                        "string",
+                        "null"
+                      ]
+                    },
+                    "hfexampleText": {
+                      "type": [
+                        "string",
+                        "null"
+                      ]
+                    },
+                    "hfexampleLang": {
+                      "type": [
+                        "string",
+                        "null"
+                      ]
+                    },
+                    "hfslice": {
+                      "type": [
+                        "string",
+                        "null"
+                      ]
+                    },
+                    "hftopK": {
+                      "type": [
+                        "number",
+                        "null"
+                      ]
+                    },
+                    "hftopP": {
+                      "type": [
+                        "number",
+                        "null"
+                      ]
+                    },
+                    "hfTemperature": {
+                      "type": [
+                        "number",
+                        "null"
+                      ]
+                    },
+                    "hfSpeedRate": {
+                      "type": [
+                        "number",
+                        "null"
+                      ]
+                    },
+                    "hfnrm": {
+                      "type": "boolean"
+                    },
+                    "hfdas": {
+                      "type": "boolean"
+                    },
                     "defaultDarkTheme": {
                       "type": [
                         "string",
@@ -607,6 +679,7 @@
                     "enableEmail",
                     "enableServiceWorker",
                     "translatorAvailable",
+                    "ttsAvailable",
                     "mediaSilencedHosts",
                     "pinnedUsers",
                     "hiddenTags",
@@ -668,6 +741,19 @@
                     "backgroundImageUrl",
                     "deeplAuthKey",
                     "deeplIsPro",
+                    "hfAuthKey",
+                    "hfSpace",
+                    "hfSpaceName",
+                    "hfexampleAudioURL",
+                    "hfexampleText",
+                    "hfexampleLang",
+                    "hfslice",
+                    "hftopK",
+                    "hftopP",
+                    "hfTemperature",
+                    "hfSpeedRate",
+                    "hfnrm",
+                    "hfdas",
                     "defaultDarkTheme",
                     "defaultLightTheme",
                     "description",
@@ -14047,6 +14133,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"
                   },
@@ -50281,6 +50432,9 @@
                   "isCat": {
                     "type": "boolean"
                   },
+                  "isVI": {
+                    "type": "boolean"
+                  },
                   "injectFeaturedNote": {
                     "type": "boolean"
                   },
@@ -61222,6 +61376,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://github.com/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",
@@ -77132,6 +77481,9 @@
           "isCat": {
             "type": "boolean"
           },
+          "isVI": {
+            "type": "boolean"
+          },
           "instance": {
             "type": "object",
             "properties": {
@@ -81191,6 +81543,7 @@
               "isLocked",
               "isBot",
               "isCat",
+              "isVI",
               "isExplorable"
             ]
           }
@@ -81483,6 +81836,9 @@
           "canUseTranslator": {
             "type": "boolean"
           },
+          "canUseTTS": {
+            "type": "boolean"
+          },
           "canHideAds": {
             "type": "boolean"
           },
@@ -81554,6 +81910,7 @@
           "canManageAvatarDecorations",
           "canSearchNotes",
           "canUseTranslator",
+          "canUseTTS",
           "canHideAds",
           "driveCapacityMb",
           "alwaysMarkNsfw",
@@ -82097,6 +82454,9 @@
           "translatorAvailable": {
             "type": "boolean"
           },
+          "ttsAvailable": {
+            "type": "boolean"
+          },
           "mediaProxy": {
             "type": "string"
           },
@@ -82201,6 +82561,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