Skip to content

Commit 873bcac

Browse files
committed
fix: Fixed issue with non letter/non digit symbols in Tag name.
1 parent fa4e39a commit 873bcac

File tree

1,053 files changed

+46937
-46933
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,053 files changed

+46937
-46933
lines changed

src/libs/AutoSDK/Naming/Clients/ClientNameGenerator.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ public static string GeneratePropertyName(
2121
{
2222
tag = tag ?? throw new ArgumentNullException(nameof(tag));
2323

24-
return PropertyData.SanitizeName(tag.Name.ToClassName(), settings.ClsCompliantEnumPrefix);
24+
var name = new string(tag.Name
25+
.SkipWhile(c => !char.IsDigit(c) && !char.IsLetter(c))
26+
.ToArray());
27+
28+
return PropertyData.SanitizeName(name.ToClassName(), settings.ClsCompliantEnumPrefix);
2529
}
2630
}

src/tests/AutoSDK.SnapshotTests/Snapshots/instill/NewtonsoftJson/_#G.Api.g.verified.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,55 +36,55 @@ public sealed partial class Api : global::G.IApi, global::System.IDisposable
3636
/// <summary>
3737
/// Namespaces (e.g. User, Organization) that structure the resource hierarchy.
3838
/// </summary>
39-
public x__NamespaceClient x__Namespace => new x__NamespaceClient(HttpClient, authorizations: Authorizations)
39+
public NamespaceClient Namespace => new NamespaceClient(HttpClient, authorizations: Authorizations)
4040
{
4141
JsonSerializerOptions = JsonSerializerOptions,
4242
};
4343

4444
/// <summary>
4545
/// Pipeline orchestration in VDP (Versatile Data Pipeline).
4646
/// </summary>
47-
public x__VDPClient x__VDP => new x__VDPClient(HttpClient, authorizations: Authorizations)
47+
public VDPClient VDP => new VDPClient(HttpClient, authorizations: Authorizations)
4848
{
4949
JsonSerializerOptions = JsonSerializerOptions,
5050
};
5151

5252
/// <summary>
5353
/// AI Model resources for MLOps/LLMOps.
5454
/// </summary>
55-
public x__ModelClient x__Model => new x__ModelClient(HttpClient, authorizations: Authorizations)
55+
public ModelClient Model => new ModelClient(HttpClient, authorizations: Authorizations)
5656
{
5757
JsonSerializerOptions = JsonSerializerOptions,
5858
};
5959

6060
/// <summary>
6161
/// Data orchestration for unified unstructured data representation.
6262
/// </summary>
63-
public x__ArtifactClient x__Artifact => new x__ArtifactClient(HttpClient, authorizations: Authorizations)
63+
public ArtifactClient Artifact => new ArtifactClient(HttpClient, authorizations: Authorizations)
6464
{
6565
JsonSerializerOptions = JsonSerializerOptions,
6666
};
6767

6868
/// <summary>
6969
/// Ready-to-use AI applications.
7070
/// </summary>
71-
public x__AppClient x__App => new x__AppClient(HttpClient, authorizations: Authorizations)
71+
public AppClient App => new AppClient(HttpClient, authorizations: Authorizations)
7272
{
7373
JsonSerializerOptions = JsonSerializerOptions,
7474
};
7575

7676
/// <summary>
7777
/// Resource usage metrics.
7878
/// </summary>
79-
public x__MetricsClient x__Metrics => new x__MetricsClient(HttpClient, authorizations: Authorizations)
79+
public MetricsClient Metrics => new MetricsClient(HttpClient, authorizations: Authorizations)
8080
{
8181
JsonSerializerOptions = JsonSerializerOptions,
8282
};
8383

8484
/// <summary>
8585
/// Pricing plans on Instill Cloud.
8686
/// </summary>
87-
public x__SubscriptionClient x__Subscription => new x__SubscriptionClient(HttpClient, authorizations: Authorizations)
87+
public SubscriptionClient Subscription => new SubscriptionClient(HttpClient, authorizations: Authorizations)
8888
{
8989
JsonSerializerOptions = JsonSerializerOptions,
9090
};
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
//HintName: G.AppClient.AppPublicServiceChat.g.cs
2+
3+
#nullable enable
4+
5+
namespace G
6+
{
7+
public partial class AppClient
8+
{
9+
partial void PrepareAppPublicServiceChatArguments(
10+
global::System.Net.Http.HttpClient httpClient,
11+
ref string namespaceId,
12+
ref string appId,
13+
global::G.ChatBody request);
14+
partial void PrepareAppPublicServiceChatRequest(
15+
global::System.Net.Http.HttpClient httpClient,
16+
global::System.Net.Http.HttpRequestMessage httpRequestMessage,
17+
string namespaceId,
18+
string appId,
19+
global::G.ChatBody request);
20+
partial void ProcessAppPublicServiceChatResponse(
21+
global::System.Net.Http.HttpClient httpClient,
22+
global::System.Net.Http.HttpResponseMessage httpResponseMessage);
23+
24+
partial void ProcessAppPublicServiceChatResponseContent(
25+
global::System.Net.Http.HttpClient httpClient,
26+
global::System.Net.Http.HttpResponseMessage httpResponseMessage,
27+
ref string content);
28+
29+
/// <summary>
30+
/// Chat<br/>
31+
/// Chat sends a message asynchronously and streams back the response.<br/>
32+
/// This method is intended for real-time conversation with a chatbot<br/>
33+
/// and the response needs to be processed incrementally.
34+
/// </summary>
35+
/// <param name="namespaceId"></param>
36+
/// <param name="appId"></param>
37+
/// <param name="request"></param>
38+
/// <param name="cancellationToken">The token to cancel the operation with</param>
39+
/// <exception cref="global::System.InvalidOperationException"></exception>
40+
public async global::System.Threading.Tasks.Task<global::G.ChatResponse> AppPublicServiceChatAsync(
41+
string namespaceId,
42+
string appId,
43+
global::G.ChatBody request,
44+
global::System.Threading.CancellationToken cancellationToken = default)
45+
{
46+
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
47+
48+
PrepareArguments(
49+
client: HttpClient);
50+
PrepareAppPublicServiceChatArguments(
51+
httpClient: HttpClient,
52+
namespaceId: ref namespaceId,
53+
appId: ref appId,
54+
request: request);
55+
56+
var __pathBuilder = new PathBuilder(
57+
path: $"/v1alpha/namespaces/{namespaceId}/apps/{appId}/chat",
58+
baseUri: HttpClient.BaseAddress);
59+
var __path = __pathBuilder.ToString();
60+
using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
61+
method: global::System.Net.Http.HttpMethod.Post,
62+
requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
63+
64+
foreach (var __authorization in Authorizations)
65+
{
66+
if (__authorization.Type == "Http" ||
67+
__authorization.Type == "OAuth2")
68+
{
69+
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
70+
scheme: __authorization.Name,
71+
parameter: __authorization.Value);
72+
}
73+
else if (__authorization.Type == "ApiKey" &&
74+
__authorization.Location == "Header")
75+
{
76+
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
77+
}
78+
}
79+
var __httpRequestContentBody = request.ToJson(JsonSerializerOptions);
80+
var __httpRequestContent = new global::System.Net.Http.StringContent(
81+
content: __httpRequestContentBody,
82+
encoding: global::System.Text.Encoding.UTF8,
83+
mediaType: "application/json");
84+
__httpRequest.Content = __httpRequestContent;
85+
86+
PrepareRequest(
87+
client: HttpClient,
88+
request: __httpRequest);
89+
PrepareAppPublicServiceChatRequest(
90+
httpClient: HttpClient,
91+
httpRequestMessage: __httpRequest,
92+
namespaceId: namespaceId,
93+
appId: appId,
94+
request: request);
95+
96+
using var __response = await HttpClient.SendAsync(
97+
request: __httpRequest,
98+
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
99+
cancellationToken: cancellationToken).ConfigureAwait(false);
100+
101+
ProcessResponse(
102+
client: HttpClient,
103+
response: __response);
104+
ProcessAppPublicServiceChatResponse(
105+
httpClient: HttpClient,
106+
httpResponseMessage: __response);
107+
108+
var __content = await __response.Content.ReadAsStringAsync().ConfigureAwait(false);
109+
110+
ProcessResponseContent(
111+
client: HttpClient,
112+
response: __response,
113+
content: ref __content);
114+
ProcessAppPublicServiceChatResponseContent(
115+
httpClient: HttpClient,
116+
httpResponseMessage: __response,
117+
content: ref __content);
118+
119+
try
120+
{
121+
__response.EnsureSuccessStatusCode();
122+
}
123+
catch (global::System.Net.Http.HttpRequestException __ex)
124+
{
125+
throw new global::System.InvalidOperationException(__content, __ex);
126+
}
127+
128+
return
129+
global::G.ChatResponse.FromJson(__content, JsonSerializerOptions) ??
130+
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
131+
}
132+
133+
/// <summary>
134+
/// Chat<br/>
135+
/// Chat sends a message asynchronously and streams back the response.<br/>
136+
/// This method is intended for real-time conversation with a chatbot<br/>
137+
/// and the response needs to be processed incrementally.
138+
/// </summary>
139+
/// <param name="namespaceId"></param>
140+
/// <param name="appId"></param>
141+
/// <param name="catalogId"></param>
142+
/// <param name="conversationUid"></param>
143+
/// <param name="message"></param>
144+
/// <param name="topK"></param>
145+
/// <param name="cancellationToken">The token to cancel the operation with</param>
146+
/// <exception cref="global::System.InvalidOperationException"></exception>
147+
public async global::System.Threading.Tasks.Task<global::G.ChatResponse> AppPublicServiceChatAsync(
148+
string namespaceId,
149+
string appId,
150+
string catalogId,
151+
string conversationUid,
152+
string message,
153+
long? topK = default,
154+
global::System.Threading.CancellationToken cancellationToken = default)
155+
{
156+
var __request = new global::G.ChatBody
157+
{
158+
CatalogId = catalogId,
159+
ConversationUid = conversationUid,
160+
Message = message,
161+
TopK = topK,
162+
};
163+
164+
return await AppPublicServiceChatAsync(
165+
namespaceId: namespaceId,
166+
appId: appId,
167+
request: __request,
168+
cancellationToken: cancellationToken).ConfigureAwait(false);
169+
}
170+
}
171+
}

0 commit comments

Comments
 (0)