Skip to content

Commit be66cdf

Browse files
committed
Updated code language format
1 parent ebd3622 commit be66cdf

File tree

10 files changed

+289
-100
lines changed

10 files changed

+289
-100
lines changed

blazor/smart-paste/claude-service.md

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ Create a service class to manage interactions with the Claude API, including aut
2828
2. Add a new file named `ClaudeAIService.cs` in the `Services` folder.
2929
3. Implement the service as shown below, storing the API key securely in a configuration file or environment variable (e.g., `appsettings.json`).
3030

31-
```csharp
31+
{% tabs %}
32+
{% highlight c# tabtitle="ClaudeAIService.cs" %}
33+
3234
using System.Net;
3335
using System.Text;
3436
using System.Text.Json;
@@ -93,7 +95,9 @@ public class ClaudeAIService
9395
}
9496
}
9597
}
96-
```
98+
99+
{% endhighlight %}
100+
{% endtabs %}
97101

98102
N> Store the Claude API key in `appsettings.json` (e.g., `{ "Claude": { "ApiKey": "your-api-key" } }`) or as an environment variable to ensure security. Verify the `anthropic-version` header in [Claude API Documentation](https://docs.anthropic.com/claude/docs) for the latest version.
99103

@@ -104,7 +108,9 @@ Define C# classes to match the Claude API’s JSON request and response format.
104108
1. Create a new file named `ClaudeModels.cs` in the `Services` folder.
105109
2. Add the following model classes:
106110

107-
```csharp
111+
{% tabs %}
112+
{% highlight c# tabtitle="ClaudeModels.cs" %}
113+
108114
public class ClaudeChatRequest
109115
{
110116
public string Model { get; set; }
@@ -128,7 +134,9 @@ public class ClaudeContentBlock
128134
{
129135
public string Text { get; set; }
130136
}
131-
```
137+
138+
{% endhighlight %}
139+
{% endtabs %}
132140

133141
## Create a Custom AI Service
134142

@@ -137,7 +145,9 @@ Implement the `IChatInferenceService` interface to connect the Smart Paste Butto
137145
1. Create a new file named `ClaudeInferenceService.cs` in the `Services` folder.
138146
2. Add the following implementation:
139147

140-
```csharp
148+
{% tabs %}
149+
{% highlight c# tabtitle="ClaudeInferenceService.cs" %}
150+
141151
using Syncfusion.Blazor.AI;
142152
using System.Threading.Tasks;
143153

@@ -155,15 +165,19 @@ public class ClaudeInferenceService : IChatInferenceService
155165
return await _claudeService.CompleteAsync(options.Messages);
156166
}
157167
}
158-
```
168+
169+
{% endhighlight %}
170+
{% endtabs %}
159171

160172
## Configure the Blazor App
161173

162174
Register the Claude service and `IChatInferenceService` implementation in the dependency injection container.
163175

164176
Update the **~/Program.cs** file as follows:
165177

166-
```csharp
178+
{% tabs %}
179+
{% highlight c# tabtitle="~/Program.cs" hl_lines="3 10 11" %}
180+
167181
using Microsoft.AspNetCore.Components;
168182
using Microsoft.AspNetCore.Components.Web;
169183
using Syncfusion.Blazor;
@@ -180,13 +194,17 @@ builder.Services.AddSingleton<IChatInferenceService, ClaudeInferenceService>();
180194

181195
var app = builder.Build();
182196
// ...
183-
```
197+
198+
{% endhighlight %}
199+
{% endtabs %}
184200

185201
## Add the Smart Paste Button
186202

187203
Add the Smart Paste Button to a form in the **~/Pages/Home.razor** file to test the Groq AI integration.
188204

189-
```razor
205+
{% tabs %}
206+
{% highlight razor tabtitle="~/Pages/Home.razor" %}
207+
190208
@using Syncfusion.Blazor.DataForm
191209
@using Syncfusion.Blazor.SmartComponents
192210
@using System.ComponentModel.DataAnnotations
@@ -234,7 +252,9 @@ Add the Smart Paste Button to a form in the **~/Pages/Home.razor** file to test
234252
public string Address { get; set; }
235253
}
236254
}
237-
```
255+
256+
{% endhighlight %}
257+
{% endtabs %}
238258

239259
N> Ensure the [Syncfusion Blazor DataForm](https://blazor.syncfusion.com/documentation/data-form/getting-started-with-web-app) package is installed for form integration.
240260

blazor/smart-paste/deepseek-service.md

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ Create a service class to manage interactions with the DeepSeek API, including a
2626
2. Add a new file named `DeepSeekAIService.cs` in the `Services` folder.
2727
3. Implement the service as shown below, storing the API key securely in a configuration file or environment variable (e.g., `appsettings.json`).
2828

29-
```csharp
29+
{% tabs %}
30+
{% highlight c# tabtitle="DeepSeekAIService.cs" %}
31+
3032
using System.Net;
3133
using System.Text;
3234
using System.Text.Json;
@@ -89,7 +91,9 @@ public class DeepSeekAIService
8991
}
9092
}
9193
}
92-
```
94+
95+
{% endhighlight %}
96+
{% endtabs %}
9397

9498
N> Store the DeepSeek API key in `appsettings.json` (e.g., `{ "DeepSeek": { "ApiKey": "your-api-key" } }`) or as an environment variable to ensure security.
9599

@@ -100,7 +104,9 @@ Define C# classes to match the DeepSeek API’s JSON request and response format
100104
1. Create a new file named `DeepSeekModels.cs` in the `Services` folder.
101105
2. Add the following model classes:
102106

103-
```csharp
107+
{% tabs %}
108+
{% highlight c# tabtitle="DeepSeekModels.cs" %}
109+
104110
public class DeepSeekMessage
105111
{
106112
public string Role { get; set; }
@@ -123,7 +129,9 @@ public class DeepSeekChoice
123129
{
124130
public DeepSeekMessage Message { get; set; }
125131
}
126-
```
132+
133+
{% endhighlight %}
134+
(% endtabs %)
127135

128136
## Create a Custom AI Service
129137

@@ -132,7 +140,9 @@ Implement the `IChatInferenceService` interface to connect the Smart Paste Butto
132140
1. Create a new file named `DeepSeekInferenceService.cs` in the `Services` folder.
133141
2. Add the following implementation:
134142

135-
```csharp
143+
{% tabs %}
144+
{% highlight c# tabtitle="DeepSeekInferenceService.cs" %}
145+
136146
using Syncfusion.Blazor.AI;
137147
using System.Threading.Tasks;
138148

@@ -150,15 +160,19 @@ public class DeepSeekInferenceService : IChatInferenceService
150160
return await _deepSeekService.CompleteAsync(options.Messages);
151161
}
152162
}
153-
```
163+
164+
{% endhighlight %}
165+
{% endtabs %}
154166

155167
## Configure the Blazor App
156168

157169
Register the DeepSeek service and `IChatInferenceService` implementation in the dependency injection container.
158170

159171
Update the **~/Program.cs** file as follows:
160172

161-
```csharp
173+
{% tabs %}
174+
{% highlight c# tabtitle="~/Program.cs" hl_lines="3 10 11" %}
175+
162176
using Microsoft.AspNetCore.Components;
163177
using Microsoft.AspNetCore.Components.Web;
164178
using Syncfusion.Blazor;
@@ -175,13 +189,17 @@ builder.Services.AddSingleton<IChatInferenceService, DeepSeekInferenceService>()
175189

176190
var app = builder.Build();
177191
// ...
178-
```
192+
193+
{% endhighlight %}
194+
{% endtabs %}
179195

180196
## Add the Smart Paste Button
181197

182198
Add the Smart Paste Button to a form in the **~/Pages/Home.razor** file to test the Groq AI integration.
183199

184-
```razor
200+
{% tabs %}
201+
{% highlight c# tabtitle="~/Pages/Home.razor" %}
202+
185203
@using Syncfusion.Blazor.DataForm
186204
@using Syncfusion.Blazor.SmartComponents
187205
@using System.ComponentModel.DataAnnotations
@@ -229,7 +247,9 @@ Add the Smart Paste Button to a form in the **~/Pages/Home.razor** file to test
229247
public string Address { get; set; }
230248
}
231249
}
232-
```
250+
251+
{% endhighlight %}
252+
{% endtabs %}
233253

234254
N> Ensure the [Syncfusion Blazor DataForm](https://blazor.syncfusion.com/documentation/data-form/getting-started-with-web-app) package is installed for form integration.
235255

blazor/smart-paste/gemini-service.md

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ Create a service class to manage interactions with the Gemini API, including aut
2626
2. Add a new file named `GeminiService.cs` in the `Services` folder.
2727
3. Implement the service as shown below, storing the API key securely in a configuration file or environment variable (e.g., `appsettings.json`).
2828

29-
```csharp
29+
{% tabs %}
30+
{% highlight c# tabtitle="GeminiService.cs" %}
31+
3032
using System.Net;
3133
using System.Text;
3234
using System.Text.Json;
@@ -107,7 +109,9 @@ public class GeminiService
107109
};
108110
}
109111
}
110-
```
112+
113+
{% endhighlight %}
114+
{% endtabs %}
111115

112116
N> Store the Gemini API key in `appsettings.json` (e.g., `{ "Gemini": { "ApiKey": "your-api-key" } }`) or as an environment variable to ensure security. The `SafetySettings` filter harmful content; adjust thresholds based on your application’s needs.
113117

@@ -118,7 +122,9 @@ Define C# classes to match the Gemini API’s JSON request and response format.
118122
1. Create a new file named `GeminiModels.cs` in the `Services` folder.
119123
2. Add the following model classes:
120124

121-
```csharp
125+
{% tabs %}
126+
{% highlight c# tabtitle="GeminiModels.cs" %}
127+
122128
public class Part
123129
{
124130
public string Text { get; set; }
@@ -172,7 +178,9 @@ public class GeminiChatParameters
172178
public GenerationConfig GenerationConfig { get; init; } = new();
173179
public List<SafetySetting> SafetySettings { get; init; } = new();
174180
}
175-
```
181+
182+
{% endhighlight %}
183+
{% endtabs %}
176184

177185
## Create a Custom AI Service
178186

@@ -181,7 +189,9 @@ Implement the `IChatInferenceService` interface to connect the Smart Paste Butto
181189
1. Create a new file named `GeminiInferenceService.cs` in the `Services` folder.
182190
2. Add the following implementation:
183191

184-
```csharp
192+
{% tabs %}
193+
{% highlight c# tabtitle="GeminiInferenceService.cs" %}
194+
185195
using Syncfusion.Blazor.AI;
186196
using System.Threading.Tasks;
187197

@@ -199,15 +209,19 @@ public class GeminiInferenceService : IChatInferenceService
199209
return await _geminiService.CompleteAsync(options.Messages);
200210
}
201211
}
202-
```
212+
213+
{% endhighlight %}
214+
{% endtabs %}
203215

204216
## Configure the Blazor App
205217

206218
Register the Gemini service and `IChatInferenceService` implementation in the dependency injection container.
207219

208220
Update the **~/Program.cs** file as follows:
209221

210-
```csharp
222+
{% tabs %}
223+
{% highlight c# tabtitle="~/Program.cs" hl_lines="3 10 11" %}
224+
211225
using Microsoft.AspNetCore.Components;
212226
using Microsoft.AspNetCore.Components.Web;
213227
using Syncfusion.Blazor;
@@ -224,13 +238,17 @@ builder.Services.AddSingleton<IChatInferenceService, GeminiInferenceService>();
224238

225239
var app = builder.Build();
226240
// ...
227-
```
241+
242+
{% endhighlight %}
243+
{% endtabs %}
228244

229245
## Add the Smart Paste Button
230246

231247
Add the Smart Paste Button to a form in the **~/Pages/Home.razor** file to test the Groq AI integration.
232248

233-
```razor
249+
{% tabs %}
250+
{% highlight c# tabtitle="~/Pages/Home.razor" %}
251+
234252
@using Syncfusion.Blazor.DataForm
235253
@using Syncfusion.Blazor.SmartComponents
236254
@using System.ComponentModel.DataAnnotations
@@ -278,7 +296,9 @@ Add the Smart Paste Button to a form in the **~/Pages/Home.razor** file to test
278296
public string Address { get; set; }
279297
}
280298
}
281-
```
299+
300+
{% endhighlight %}
301+
{% endtabs %}
282302

283303
N> Ensure the [Syncfusion Blazor DataForm](https://blazor.syncfusion.com/documentation/data-form/getting-started-with-web-app) package is installed for form integration.
284304

0 commit comments

Comments
 (0)