Skip to content

Commit 557c153

Browse files
committed
update
1 parent b233af2 commit 557c153

File tree

11 files changed

+153
-19
lines changed

11 files changed

+153
-19
lines changed

MyApp/_includes/admin-ui-claims-validation.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ It will generate that Error Response instead:
2525
<error-summary :status="{message:`'todos:write' Permission Required`}"></error-summary>
2626
:::
2727

28-
Which is a good example showing how `HasClaimValidator.ClaimErrorMessages` can be used to add custom error messages
29-
for your own custom claim validation.
28+
This is a good example for how to use `HasClaimValidator.ClaimErrorMessages` to add custom error messages
29+
for your own custom claim validations.
3030

3131
### Inspecting Claims inside Services
3232

MyApp/_pages/admin-ui-analytics.md

+91-12
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Admin UI Analytics
33
---
44

5-
Comprehensive API Analytics is available to all ServiceStack Apps configured with [SQLite Request Logging[(/sqlite-request-logs).
5+
Comprehensive API Analytics is available to all ServiceStack Apps configured with [SQLite Request Logging](/sqlite-request-logs).
66

77
### Benefits of API Analytics
88

@@ -15,21 +15,19 @@ IPs where most traffic generates:
1515
- **Troubleshooting:** Aids in quickly identifying trends, anomalies, or specific endpoints related to issues.
1616
- **Resource Planning:** Understanding usage patterns helps in scaling infrastructure appropriately.
1717
- **Security Insight:** Identifying bot traffic and unusual request patterns can be an early indicator of security concerns.
18+
- **Interactive Analytics:** Analytics are also interactive where you're able to drill down to monitor the activity of individual APIs, Users, API Keys and IPs with links back to the request logs which the summary analytics are derived from.
1819

19-
### Interactive Analytics
20+
### Getting Started
2021

21-
Analytics are also interactive where you're able to drill down to monitor the activity of individual APIs, Users, API Keys
22-
and IPs which have further links back to the request logs which the summary analytics are derived from.
23-
24-
As they offer significant and valuable insights they're now built into all ASP.NET Core IdentityAuth templates,
22+
As they offer significant and valuable insights they're now built into all new ASP.NET Core IdentityAuth templates,
2523
existing .NET 8 IdentityAuth templates can enable it with:
2624

2725
:::sh
2826
x mix sqlitelogs
2927
:::
3028

31-
.NET 8 Templates that are not configured to use [Endpoint Routing[(/endpoint-routing)
32-
and [ASP.NET Core IOC[(/net-ioc) will need to explicitly register `SqliteRequestLogger`
29+
.NET 8 Templates that are not configured to use [Endpoint Routing](/endpoint-routing)
30+
and [ASP.NET Core IOC](/net-ioc) will need to explicitly register `SqliteRequestLogger`
3331
as a singleton dependency in addition to configuring it on the `RequestLogsFeature` plugin:
3432

3533
```csharp
@@ -56,18 +54,24 @@ public class ConfigureRequestLogs : IHostingStartup
5654
}
5755
```
5856

59-
This will enable a more feature rich Request Logging Admin UI which utilizes the full queryability of an AutoQueryGrid
60-
to filter, sort and export Request Logs.
57+
## Analytics Admin UI
58+
59+
Once configured, [SQLite Request Logs](/sqlite-request-logs) enable a more feature rich Request Logging Admin UI which utilizes the full queryability of an AutoQueryGrid to filter, sort and export Request Logs.
6160

6261
[![](/img/pages/admin-ui/sqlitelogs.webp)](/img/pages/admin-ui/sqlitelogs.webp)
6362

63+
### Rolling Monthly Request Logs
64+
65+
Benefits of using SQLite includes removing load from your App's primary database and being able to create naturally scalable and isolated Monthly databases on-the-fly which allow requests to be easily archived into managed file storage instead of a singular growing database.
66+
6467
## Analytics Overview
6568

66-
Utilizing an `SqliteRequestLogger` will also enable the new **Analytics** Admin UI in the sidebar which initially
67-
displays the API Analytics Dashboard:
69+
It also enables the new **Analytics** Admin UI in the sidebar which initially displays the API Analytics overview Dashboard:
6870

6971
[![](/img/pages/admin-ui/analytics-apis1.webp)](/img/pages/admin-ui/analytics-apis1.webp)
7072

73+
Different charts displayed on the dashboard include:
74+
7175
### Distribution Pie Charts
7276

7377
Lets you quickly understand the composition of your user base and traffic sources and the
@@ -229,3 +233,78 @@ bar chart to view its individual analytics made from that IP Address.
229233
Provides comprehensive IP Address analytics Similar to User Analytics but limited to the API Usage from a single IP Address:
230234

231235
[![](/img/pages/admin-ui/analytics-ip.webp)](/img/pages/admin-ui/analytics-ip.webp)
236+
237+
## Blocking User Agents
238+
239+
The insights from the Analytics showed us that our [pvq.app](https://pvq.app) was experiencing significant load from
240+
AI bots and scrapers which was the primary cause of its high resource usage and detrimental load times for normal
241+
user requests, so much so we've intervened to prevent these bots from scraping our site.
242+
243+
### Disallowing Bots in robots.txt
244+
245+
In an ideal world you would just need to instruct problematic bots not to scrape your site by adding them to [pvq.app/robots.txt](https://pvq.app/robots.txt), e.g:
246+
247+
```txt
248+
User-agent: Googlebot
249+
Allow: /
250+
User-agent: Bingbot
251+
Allow: /
252+
253+
User-agent: bytespider
254+
Disallow: /
255+
User-agent: gptbot
256+
Disallow: /
257+
User-agent: claudebot
258+
Disallow: /
259+
User-agent: amazonbot
260+
Disallow: /
261+
User-agent: mj12bot
262+
Disallow: /
263+
User-agent: semrushbot
264+
Disallow: /
265+
User-agent: dotbot
266+
Disallow: /
267+
User-agent: WhatsApp Bot
268+
Disallow: /
269+
User-agent: *
270+
Disallow: /
271+
```
272+
273+
### Disallowing Bot Requests
274+
275+
As this was not having an immediate effect we took a more forceful approach to implement a middleware to reject all
276+
requests from disallowed bots from accessing our App which you can add to your own App with:
277+
278+
:::sh
279+
x mix useragent-blocking
280+
:::
281+
282+
This will allow you to configure which Bot User Agents you want to reject from accessing your site, e.g:
283+
284+
```csharp
285+
services.Configure<UserAgentBlockingOptions>(options =>
286+
{
287+
// Add user agents to block
288+
options.BlockedUserAgents.AddRange([
289+
"bytespider",
290+
"gptbot",
291+
"gptbot",
292+
"claudebot",
293+
"amazonbot",
294+
"imagesiftbot",
295+
"semrushbot",
296+
"dotbot",
297+
"semrushbot",
298+
"dataforseobot",
299+
"WhatsApp Bot",
300+
"HeadlessChrome",
301+
"PetalBot",
302+
]);
303+
304+
// Optional: Customize the response status code
305+
// options.BlockedStatusCode = StatusCodes.Status429TooManyRequests;
306+
307+
// Optional: Customize the blocked message
308+
options.BlockedMessage = "This bot is not allowed to access our website";
309+
});
310+
```

MyApp/_pages/admin-ui-identity-roles.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ services.AddPlugin(
2727

2828
### IdentityAuth Role Claims
2929

30-
The Edit Role Admin UI can also be configured to Add/Remove Claims to a Role, e.g:
30+
The Edit Role Admin UI also supports Adding and Remove Claims for a Role, e.g:
3131

3232
![](/img/pages/admin-ui/identityauth-role-claims.webp)
3333

MyApp/_pages/ai-server/image-to-text.md

+57-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ AI Server's Image to Text UI lets you request image classifications from its act
1818

1919
::include ai-server/endpoint-usage.md::
2020

21+
### Ollama Vision Models
22+
23+
If AI Server has access to any Ollama Vision Models (e.g. **gemma3:27b** or **mistral-small**), it can be used
24+
instead to get information about the uploaded image:
25+
26+
- `Model` - the ollama vision model to use
27+
- `Prompt` - vision model prompt
28+
2129
### Image to Text {#image-to-text}
2230

2331
::include ai-server/cs/image-to-text-1.cs.md::
@@ -29,4 +37,52 @@ AI Server's Image to Text UI lets you request image classifications from its act
2937
:::info
3038
Ensure that the ComfyUI Agent has the Florence 2 model downloaded and installed for the Image-To-Text functionality to work.
3139
This can be done by setting the `DEFAULT_MODELS` environment variable in the `.env` file to include `image-to-text`
32-
:::
40+
:::
41+
42+
## Support for Ollama Vision Models
43+
44+
By default [ImageToText](/ai-server/image-to-text) uses a purpose-specific **Florence 2 Vision model** with ComfyUI for its functionality which is capable of generating a very short description about an image, e.g:
45+
46+
> A woman sitting on the edge of a lake with a wolf
47+
48+
But with LLMs gaining multi modal capabilities and Ollama's recent support of Vision Models we can instead use popular
49+
Open Source models like Google's **gemma3:27b** or Mistral's **mistral-small:24b** to extract information from images.
50+
51+
Both models are very capable vision models that's can provide rich detail about an image:
52+
53+
### Describe Image
54+
55+
<div class="not-prose mt-8 grid grid-cols-2 gap-4">
56+
<a class="block group border dark:border-gray-800 hover:border-indigo-700 dark:hover:border-indigo-700 flex flex-col justify-between" href="/img/pages/ai-server/image-to-text/gemma3-describe.png">
57+
<img class="p-2" src="/img/pages/ai-server/image-to-text/gemma3-describe.png" />
58+
</a>
59+
<a class="block group border dark:border-gray-800 hover:border-indigo-700 dark:hover:border-indigo-700 flex flex-col justify-between" href="/img/pages/ai-server/image-to-text/mistral-small-describe.png">
60+
<img class="p-2" src="/img/pages/ai-server/image-to-text/mistral-small-describe.png" />
61+
</a>
62+
</div>
63+
64+
### Caption Image
65+
66+
Although our initial testing sees gemma being better at responding to a wide variety of different prompts, e.g:
67+
68+
<div class="not-prose mt-8 grid grid-cols-2 gap-4">
69+
<a class="block group border dark:border-gray-800 hover:border-indigo-700 dark:hover:border-indigo-700 flex flex-col justify-between" href="/img/pages/ai-server/image-to-text/gemma3-caption.png">
70+
<img class="p-2" src="/img/pages/ai-server/image-to-text/gemma3-caption.png" />
71+
</a>
72+
<a class="block group border dark:border-gray-800 hover:border-indigo-700 dark:hover:border-indigo-700 flex flex-col justify-between" href="/img/pages/ai-server/image-to-text/mistral-small-caption.png">
73+
<img class="p-2" src="/img/pages/ai-server/image-to-text/mistral-small-caption.png" />
74+
</a>
75+
</div>
76+
77+
## Support OllamaGenerate Endpoint
78+
79+
To support Ollama's vision models AI Server added a new feature pipeline around
80+
[Ollama's generate completion API](https://github.com/ollama/ollama/blob/main/docs/api.md#generate-a-completion):
81+
82+
83+
- `ImageToText`
84+
- **Model** - Whether to use a Vision Model for the request
85+
- **Prompt** - Prompt for the vision model
86+
- `OllamaGeneration`: Synchronous invocation of Ollama's Generate API
87+
- `QueueOllamaGeneration`: Asynchronous or Web Callback invocation of Ollama's Generate API
88+
- `GetOllamaGenerationStatus`: Get the generation status of an Ollama Generate API

MyApp/_pages/templates/angular.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The default Angular SPA Template can be downloaded below:
3131
</project-template>
3232
</project-creator>
3333

34-
Alternatively you can download a custom template from the [Start Page](/start).
34+
Alternatively you can download a custom template from the [Start Page](https://servicestack.net/start).
3535

3636
The source code for the template is maintained at [NetCoreTemplates/angular-spa](https://github.com/NetCoreTemplates/angular-spa)
3737
whilst an online live-demo is available from: [angular-spa.web-templates.io](https://angular-spa.web-templates.io)
@@ -254,8 +254,7 @@ export class BookingListComponent implements OnInit {
254254
}
255255
```
256256

257-
Using `provideApiState()` implicitly injects the populated API context containing both the APIs Loading and Error into
258-
child components saving you from explicitly specifying it in each component.
257+
Using `provideApiState()` implicitly injects the populated API context containing both the APIs Loading and Error state into child components saving you from having to explicitly inject it into each component.
259258

260259
E.g. the `<form-loading>` component will display when API Requests are in-flight whilst API Error Responses are displayed
261260
after receiving failed API Responses:
Loading
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)