Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Self-Hosted AI Server support #32

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ENV CleanUrl=http://0.0.0.0
ENV ASPNETCORE_ENVIRONMENT=Production
ENV DOTNET_PRINT_TELEMETRY_MESSAGE=false
ENV LIBRUM_SELFHOSTED=true
ENV AI_SELFHOSTED=false

EXPOSE 5000/tcp
EXPOSE 5001/tcp
Expand Down
1 change: 1 addition & 0 deletions self-hosting/librum-server.service
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ SyslogIdentifier=librum-server
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
Environment=LIBRUM_SELFHOSTED=true
Environment=AI_SELFHOSTED=false
EnvironmentFile=/etc/librum-server/librum-server.conf

[Install]
Expand Down
3 changes: 3 additions & 0 deletions src/Application/Services/AIService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ private HttpRequestMessage CreateOpenAiExplanationRequest(string email,
string text)
{
var url = "https://api.openai.com/v1/chat/completions";
if (_configuration["AI_SELFHOSTED"] == "true" && String.IsNullOrEmpty(_configuration["AIServerUrl"])){
url = _configuration["AIServerUrl"];
}
var body = new
{
model = "gpt-3.5-turbo",
Expand Down