Skip to content

Commit 0cbeec1

Browse files
authored
Merge pull request #71 from FBoucher/add-reka
Enhances blog post summaries with AI
2 parents f54dc11 + 533ba97 commit 0cbeec1

33 files changed

+613
-35
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Build and Push Docker Images
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
env:
11+
REGISTRY: docker.io
12+
API_IMAGE_NAME: fboucher/notebookmark-api
13+
BLAZOR_IMAGE_NAME: fboucher/notebookmark-blazor
14+
15+
jobs:
16+
build-and-push:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Log in to Docker Hub
27+
if: github.event_name != 'pull_request'
28+
uses: docker/login-action@v3
29+
with:
30+
registry: ${{ env.REGISTRY }}
31+
username: ${{ secrets.DOCKER_USERNAME }}
32+
password: ${{ secrets.DOCKER_PASSWORD }}
33+
34+
- name: Extract metadata for API
35+
id: meta-api
36+
uses: docker/metadata-action@v5
37+
with:
38+
images: ${{ env.REGISTRY }}/${{ env.API_IMAGE_NAME }}
39+
tags: |
40+
type=ref,event=branch
41+
type=ref,event=pr
42+
type=sha
43+
type=raw,value=latest,enable={{is_default_branch}}
44+
45+
- name: Extract metadata for Blazor App
46+
id: meta-blazor
47+
uses: docker/metadata-action@v5
48+
with:
49+
images: ${{ env.REGISTRY }}/${{ env.BLAZOR_IMAGE_NAME }}
50+
tags: |
51+
type=ref,event=branch
52+
type=ref,event=pr
53+
type=sha
54+
type=raw,value=latest,enable={{is_default_branch}}
55+
56+
- name: Build and push API Docker image
57+
uses: docker/build-push-action@v5
58+
with:
59+
context: .
60+
file: ./NoteBookmark.Api/Dockerfile
61+
push: ${{ github.event_name != 'pull_request' }}
62+
tags: ${{ steps.meta-api.outputs.tags }}
63+
labels: ${{ steps.meta-api.outputs.labels }}
64+
65+
- name: Build and push Blazor App Docker image
66+
uses: docker/build-push-action@v5
67+
with:
68+
context: .
69+
file: ./NoteBookmark.BlazorApp/Dockerfile
70+
push: ${{ github.event_name != 'pull_request' }}
71+
tags: ${{ steps.meta-blazor.outputs.tags }}
72+
labels: ${{ steps.meta-blazor.outputs.labels }}

NoteBookmark.AIServices/Choice.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace NoteBookmark.AIServices;
4+
5+
public class Choice
6+
{
7+
[JsonPropertyName("finish_reason")]
8+
public string? FinishReason { get; set; }
9+
10+
[JsonPropertyName("index")]
11+
public int Index { get; set; }
12+
13+
[JsonPropertyName("logprobs")]
14+
public object? Logprobs { get; set; }
15+
16+
[JsonPropertyName("message")]
17+
public Message? Message { get; set; }
18+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace NoteBookmark.AIServices;
4+
5+
public class ContentItem
6+
{
7+
[JsonPropertyName("type")]
8+
public string? Type { get; set; }
9+
10+
[JsonPropertyName("text")]
11+
public string? Text { get; set; }
12+
}

NoteBookmark.AIServices/Message.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System.Text.Json;
2+
using System.Text.Json.Serialization;
3+
4+
namespace NoteBookmark.AIServices;
5+
6+
public class Message
7+
{
8+
[JsonPropertyName("content")]
9+
public string? Content { get; set; }
10+
11+
[JsonPropertyName("refusal")]
12+
public object? Refusal { get; set; }
13+
14+
[JsonPropertyName("role")]
15+
public string? Role { get; set; }
16+
17+
[JsonPropertyName("annotations")]
18+
public object? Annotations { get; set; }
19+
20+
[JsonPropertyName("audio")]
21+
public object? Audio { get; set; }
22+
23+
[JsonPropertyName("function_call")]
24+
public object? FunctionCall { get; set; }
25+
26+
[JsonPropertyName("tool_calls")]
27+
public object? ToolCalls { get; set; }
28+
29+
[JsonPropertyName("reasoning_content")]
30+
public string? ReasoningContent { get; set; }
31+
32+
[JsonPropertyName("reasoning_steps")]
33+
public List<ReasoningStep>? ReasoningSteps { get; set; }
34+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net9.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.0-rc.1.25451.107" />
11+
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.9" />
12+
</ItemGroup>
13+
14+
</Project>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace NoteBookmark.AIServices;
4+
5+
public class ReasoningStep
6+
{
7+
[JsonPropertyName("role")]
8+
public string? Role { get; set; }
9+
10+
[JsonPropertyName("content")]
11+
public object? Content { get; set; }
12+
13+
[JsonPropertyName("reasoning_content")]
14+
public string? ReasoningContent { get; set; }
15+
16+
[JsonPropertyName("tool_calls")]
17+
public List<ToolCall>? ToolCalls { get; set; }
18+
19+
[JsonPropertyName("tool_call_id")]
20+
public string? ToolCallId { get; set; }
21+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace NoteBookmark.AIServices;
4+
5+
public class RekaChatResponse
6+
{
7+
[JsonPropertyName("id")]
8+
public string? Id { get; set; }
9+
10+
[JsonPropertyName("model")]
11+
public string? Model { get; set; }
12+
13+
[JsonPropertyName("usage")]
14+
public RekaUsage? Usage { get; set; }
15+
16+
[JsonPropertyName("responses")]
17+
public List<ResponseItem>? Responses { get; set; }
18+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace NoteBookmark.AIServices;
4+
5+
public class RekaMessage
6+
{
7+
[JsonPropertyName("role")]
8+
public string? Role { get; set; }
9+
10+
[JsonPropertyName("content")]
11+
public List<ContentItem>? Content { get; set; }
12+
13+
[JsonPropertyName("in_reasoning")]
14+
public bool InReasoning { get; set; }
15+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
using System.Text.Json.Serialization;
3+
4+
namespace NoteBookmark.AIServices;
5+
6+
public class RekaResponse
7+
{
8+
[JsonPropertyName("id")]
9+
public string? Id { get; set; }
10+
11+
[JsonPropertyName("choices")]
12+
public List<Choice>? Choices { get; set; }
13+
14+
[JsonPropertyName("created")]
15+
public long Created { get; set; }
16+
17+
[JsonPropertyName("model")]
18+
public string? Model { get; set; }
19+
20+
[JsonPropertyName("object")]
21+
public string? Object { get; set; }
22+
23+
[JsonPropertyName("service_tier")]
24+
public string? ServiceTier { get; set; }
25+
26+
[JsonPropertyName("system_fingerprint")]
27+
public string? SystemFingerprint { get; set; }
28+
29+
[JsonPropertyName("usage")]
30+
public Usage? Usage { get; set; }
31+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace NoteBookmark.AIServices;
4+
5+
public class RekaUsage
6+
{
7+
[JsonPropertyName("input_tokens")]
8+
public int InputTokens { get; set; }
9+
10+
[JsonPropertyName("output_tokens")]
11+
public int OutputTokens { get; set; }
12+
13+
[JsonPropertyName("reasoning_tokens")]
14+
public int ReasoningTokens { get; set; }
15+
}

0 commit comments

Comments
 (0)