Update sequence diagram (#345)
* Updated sequence diagram for new Model downloading architecture * Minor update * Update sequence.md as well * Fixing error * More error fixes
This commit is contained in:
Родитель
f376f50d7e
Коммит
3ad908bd19
|
@ -3,10 +3,13 @@
|
||||||
This diagram shows a flow of messages and selected calls for specifically the remote language model down(loading) step.
|
This diagram shows a flow of messages and selected calls for specifically the remote language model down(loading) step.
|
||||||
|
|
||||||
`^` - web worker scripts,
|
`^` - web worker scripts,
|
||||||
the rest are content scripts
|
`*` - background script
|
||||||
|
|
||||||
|
The rest are content scripts
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
sequenceDiagram
|
sequenceDiagram
|
||||||
|
participant b as backgroundScript*
|
||||||
participant m as mediator
|
participant m as mediator
|
||||||
participant t as Translation
|
participant t as Translation
|
||||||
participant w as translationWorker^
|
participant w as translationWorker^
|
||||||
|
@ -15,21 +18,35 @@ sequenceDiagram
|
||||||
m->>+t: translate
|
m->>+t: translate
|
||||||
t-)+w: translate
|
t-)+w: translate
|
||||||
w->>w: loadTranslationEngine()
|
w->>w: loadTranslationEngine()
|
||||||
w->>w: loadLanguageModel()
|
w->>w: getLanguageModels()
|
||||||
|
w->>t: downloadLanguageModels
|
||||||
|
t->>m: downloadLanguageModels
|
||||||
|
m->>b: downloadLanguageModels
|
||||||
|
b->>b: getLanguageModels()
|
||||||
|
b->>b: getLanguageModel()
|
||||||
|
b->>b: downloadFile()
|
||||||
|
b->>b: getItemFromCacheOrWeb()
|
||||||
|
b->>cache: cache.match(Model)
|
||||||
|
alt cache match
|
||||||
|
cache->>b: (Model as Blob)
|
||||||
|
else cache not matched
|
||||||
|
b->>b: getItemFromWeb()
|
||||||
|
b->>gcp: Download Model
|
||||||
|
gcp->>b: Model
|
||||||
|
b->>b: digestSha256(Model as Arraybuffer)
|
||||||
|
Note right of b: Validate Model's hash
|
||||||
|
b->>cache: cache.put(Model as Blob)
|
||||||
|
cache->>b: (Model as Blob)
|
||||||
|
end
|
||||||
|
b->>m: responseDownloadLanguageModels (Model as Blob)
|
||||||
|
m->>t: sendDownloadedLanguageModels (Model as Blob)
|
||||||
|
t->>w: responseDownloadLanguageModels (Model as Blob)
|
||||||
|
w->>w: loadLanguageModel(Model as Blob)
|
||||||
w->>w: constructTranslationService()
|
w->>w: constructTranslationService()
|
||||||
w->>w: constructTranslationModel()
|
w->>w: constructTranslationModel()
|
||||||
w->>w: constructTranslationModelHelper()
|
w->>w: constructTranslationModelHelper()
|
||||||
w->>w: downloadFiles()
|
w->>w: fetchFile()
|
||||||
w->>w: getItemFromCacheOrWeb()
|
w->>w: Blob.arrayBuffer()
|
||||||
w->>cache: cache.match(Model)
|
|
||||||
alt cache match
|
|
||||||
cache->>w: (Model as ArrayBuffer)
|
|
||||||
else cache not matched
|
|
||||||
cache->>gcp: Download model
|
|
||||||
cache->>w: (Model as ArrayBuffer)
|
|
||||||
end
|
|
||||||
w->>w: this.digestSha256(arraybuffer)
|
|
||||||
Note right of w: Validate model's hash
|
|
||||||
w->>w: prepareAlignedMemoryFromBuffer(buffer, fileAlignment):alignedMemories
|
w->>w: prepareAlignedMemoryFromBuffer(buffer, fileAlignment):alignedMemories
|
||||||
w->>w: new WasmEngineModule.AlignedMemoryList(alignedMemories):alignedMemoryList
|
w->>w: new WasmEngineModule.AlignedMemoryList(alignedMemories):alignedMemoryList
|
||||||
w->>w: new WasmEngineModule.TranslationModel(alignedMemoryList)
|
w->>w: new WasmEngineModule.TranslationModel(alignedMemoryList)
|
||||||
|
|
|
@ -67,7 +67,15 @@ sequenceDiagram
|
||||||
t-)+w: translate
|
t-)+w: translate
|
||||||
deactivate t
|
deactivate t
|
||||||
w->>w: load engine
|
w->>w: load engine
|
||||||
w->>w: load models
|
w->>t: download models
|
||||||
|
deactivate w
|
||||||
|
t->>m: download models
|
||||||
|
m->>+bg: download models
|
||||||
|
bg->>bg: download models
|
||||||
|
bg->>m: models
|
||||||
|
deactivate bg
|
||||||
|
m->>t: models
|
||||||
|
t->>+w: load models
|
||||||
w-)+t: displayOutboundTranslation
|
w-)+t: displayOutboundTranslation
|
||||||
t-)+m: displayOutboundTranslation
|
t-)+m: displayOutboundTranslation
|
||||||
deactivate t
|
deactivate t
|
||||||
|
|
Загрузка…
Ссылка в новой задаче