jina-ai / serve

☁️ Build multimodal AI applications with cloud-native stack
https://jina.ai/serve
Apache License 2.0
21.13k stars 2.22k forks source link

Display warning messages coming from internal API #5112

Closed Andrei997 closed 2 years ago

Andrei997 commented 2 years ago

Describe the feature We need to display potential warning messages coming from the API stream.

Your proposal We have added a new type of warning message that can be sent to the request stream from the internal API (when using jina hub push for example ). These messages need to be displayed within the console in a clear manner. Multiple warnings can be received from a single stream, there it's necessary to display them in a fitting format, such as using bullet points.

The structure of the warning message follows that of the other messages.

{
    "type": "warning",
    "subject": "parseManifest",
    "message": "manifest.yml is deprecated - docs.jina.ai/fundamentals/executor/yaml-spec"
}

Currently, CLI commands like jina hub push check for message["warning"] when the message["type"] == "complete".

elif t == 'complete':
    image = stream_msg['payload']
    warning = stream_msg.get('warning')
    ...

These functions should instead check for message["type"] == "warning" and display all warnings received throughout the lifetime of the request at the end.

elif t == 'warning':
    warning = stream_msg.get('text')
    ...
Screen Shot 2022-09-01 at 11 33 59

This is how the CLI behaves currently - it can only display one warning messages that will get sliced if too long. Instead, the CLI should be able to display multiple warning messages.

mapleeit commented 2 years ago

https://github.com/jina-ai/jina/pull/5156