-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fixed issue with non letter/non digit symbols in Tag name.
- Loading branch information
Showing
1,053 changed files
with
46,937 additions
and
46,933 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
171 changes: 171 additions & 0 deletions
171
...otTests/Snapshots/instill/NewtonsoftJson/_#G.AppClient.AppPublicServiceChat.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
//HintName: G.AppClient.AppPublicServiceChat.g.cs | ||
|
||
#nullable enable | ||
|
||
namespace G | ||
{ | ||
public partial class AppClient | ||
{ | ||
partial void PrepareAppPublicServiceChatArguments( | ||
global::System.Net.Http.HttpClient httpClient, | ||
ref string namespaceId, | ||
ref string appId, | ||
global::G.ChatBody request); | ||
partial void PrepareAppPublicServiceChatRequest( | ||
global::System.Net.Http.HttpClient httpClient, | ||
global::System.Net.Http.HttpRequestMessage httpRequestMessage, | ||
string namespaceId, | ||
string appId, | ||
global::G.ChatBody request); | ||
partial void ProcessAppPublicServiceChatResponse( | ||
global::System.Net.Http.HttpClient httpClient, | ||
global::System.Net.Http.HttpResponseMessage httpResponseMessage); | ||
|
||
partial void ProcessAppPublicServiceChatResponseContent( | ||
global::System.Net.Http.HttpClient httpClient, | ||
global::System.Net.Http.HttpResponseMessage httpResponseMessage, | ||
ref string content); | ||
|
||
/// <summary> | ||
/// Chat<br/> | ||
/// Chat sends a message asynchronously and streams back the response.<br/> | ||
/// This method is intended for real-time conversation with a chatbot<br/> | ||
/// and the response needs to be processed incrementally. | ||
/// </summary> | ||
/// <param name="namespaceId"></param> | ||
/// <param name="appId"></param> | ||
/// <param name="request"></param> | ||
/// <param name="cancellationToken">The token to cancel the operation with</param> | ||
/// <exception cref="global::System.InvalidOperationException"></exception> | ||
public async global::System.Threading.Tasks.Task<global::G.ChatResponse> AppPublicServiceChatAsync( | ||
string namespaceId, | ||
string appId, | ||
global::G.ChatBody request, | ||
global::System.Threading.CancellationToken cancellationToken = default) | ||
{ | ||
request = request ?? throw new global::System.ArgumentNullException(nameof(request)); | ||
|
||
PrepareArguments( | ||
client: HttpClient); | ||
PrepareAppPublicServiceChatArguments( | ||
httpClient: HttpClient, | ||
namespaceId: ref namespaceId, | ||
appId: ref appId, | ||
request: request); | ||
|
||
var __pathBuilder = new PathBuilder( | ||
path: $"/v1alpha/namespaces/{namespaceId}/apps/{appId}/chat", | ||
baseUri: HttpClient.BaseAddress); | ||
var __path = __pathBuilder.ToString(); | ||
using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( | ||
method: global::System.Net.Http.HttpMethod.Post, | ||
requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); | ||
|
||
foreach (var __authorization in Authorizations) | ||
{ | ||
if (__authorization.Type == "Http" || | ||
__authorization.Type == "OAuth2") | ||
{ | ||
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( | ||
scheme: __authorization.Name, | ||
parameter: __authorization.Value); | ||
} | ||
else if (__authorization.Type == "ApiKey" && | ||
__authorization.Location == "Header") | ||
{ | ||
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value); | ||
} | ||
} | ||
var __httpRequestContentBody = request.ToJson(JsonSerializerOptions); | ||
var __httpRequestContent = new global::System.Net.Http.StringContent( | ||
content: __httpRequestContentBody, | ||
encoding: global::System.Text.Encoding.UTF8, | ||
mediaType: "application/json"); | ||
__httpRequest.Content = __httpRequestContent; | ||
|
||
PrepareRequest( | ||
client: HttpClient, | ||
request: __httpRequest); | ||
PrepareAppPublicServiceChatRequest( | ||
httpClient: HttpClient, | ||
httpRequestMessage: __httpRequest, | ||
namespaceId: namespaceId, | ||
appId: appId, | ||
request: request); | ||
|
||
using var __response = await HttpClient.SendAsync( | ||
request: __httpRequest, | ||
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, | ||
cancellationToken: cancellationToken).ConfigureAwait(false); | ||
|
||
ProcessResponse( | ||
client: HttpClient, | ||
response: __response); | ||
ProcessAppPublicServiceChatResponse( | ||
httpClient: HttpClient, | ||
httpResponseMessage: __response); | ||
|
||
var __content = await __response.Content.ReadAsStringAsync().ConfigureAwait(false); | ||
|
||
ProcessResponseContent( | ||
client: HttpClient, | ||
response: __response, | ||
content: ref __content); | ||
ProcessAppPublicServiceChatResponseContent( | ||
httpClient: HttpClient, | ||
httpResponseMessage: __response, | ||
content: ref __content); | ||
|
||
try | ||
{ | ||
__response.EnsureSuccessStatusCode(); | ||
} | ||
catch (global::System.Net.Http.HttpRequestException __ex) | ||
{ | ||
throw new global::System.InvalidOperationException(__content, __ex); | ||
} | ||
|
||
return | ||
global::G.ChatResponse.FromJson(__content, JsonSerializerOptions) ?? | ||
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); | ||
} | ||
|
||
/// <summary> | ||
/// Chat<br/> | ||
/// Chat sends a message asynchronously and streams back the response.<br/> | ||
/// This method is intended for real-time conversation with a chatbot<br/> | ||
/// and the response needs to be processed incrementally. | ||
/// </summary> | ||
/// <param name="namespaceId"></param> | ||
/// <param name="appId"></param> | ||
/// <param name="catalogId"></param> | ||
/// <param name="conversationUid"></param> | ||
/// <param name="message"></param> | ||
/// <param name="topK"></param> | ||
/// <param name="cancellationToken">The token to cancel the operation with</param> | ||
/// <exception cref="global::System.InvalidOperationException"></exception> | ||
public async global::System.Threading.Tasks.Task<global::G.ChatResponse> AppPublicServiceChatAsync( | ||
string namespaceId, | ||
string appId, | ||
string catalogId, | ||
string conversationUid, | ||
string message, | ||
long? topK = default, | ||
global::System.Threading.CancellationToken cancellationToken = default) | ||
{ | ||
var __request = new global::G.ChatBody | ||
{ | ||
CatalogId = catalogId, | ||
ConversationUid = conversationUid, | ||
Message = message, | ||
TopK = topK, | ||
}; | ||
|
||
return await AppPublicServiceChatAsync( | ||
namespaceId: namespaceId, | ||
appId: appId, | ||
request: __request, | ||
cancellationToken: cancellationToken).ConfigureAwait(false); | ||
} | ||
} | ||
} |
Oops, something went wrong.