Browse Source

Fix up issues found during testing

tags/v0.6.0
sa_ddam213 2 years ago
parent
commit
a8a498dc12
8 changed files with 15 additions and 12 deletions
  1. +1
    -1
      LLama.Web/Extensions.cs
  2. +1
    -1
      LLama.Web/Hubs/SessionConnectionHub.cs
  3. +1
    -1
      LLama.Web/Pages/Shared/_ChatTemplates.cshtml
  4. +0
    -1
      LLama.Web/Pages/Shared/_Parameters.cshtml
  5. +2
    -0
      LLama.Web/Program.cs
  6. +4
    -3
      LLama.Web/Services/ModelService.cs
  7. +3
    -3
      LLama.Web/appsettings.json
  8. +3
    -2
      LLama.Web/wwwroot/js/sessionConnectionChat.js

+ 1
- 1
LLama.Web/Extensions.cs View File

@@ -33,7 +33,7 @@ namespace LLama.Web
/// <returns>Combined list with duplicates removed</returns>
private static List<string> CombineCSV(List<string> list, string csv)
{
var results = list?.Count == 0
var results = list is null || list.Count == 0
? CommaSeperatedToList(csv)
: CommaSeperatedToList(csv).Concat(list);
return results


+ 1
- 1
LLama.Web/Hubs/SessionConnectionHub.cs View File

@@ -37,7 +37,7 @@ namespace LLama.Web.Hubs


[HubMethodName("LoadModel")]
public async Task OnLoadModel(ISessionConfig sessionConfig, InferenceOptions inferenceConfig)
public async Task OnLoadModel(SessionConfig sessionConfig, InferenceOptions inferenceConfig)
{
_logger.Log(LogLevel.Information, "[OnLoadModel] - Load new model, Connection: {0}", Context.ConnectionId);
await _modelSessionService.CloseAsync(Context.ConnectionId);


+ 1
- 1
LLama.Web/Pages/Shared/_ChatTemplates.cshtml View File

@@ -25,7 +25,7 @@
<div class="m-2 me-4">
<img src="~/image/robot.png" width="60"/>
</div>
<div id="{{id}}" class="d-flex flex-column flex-fill justify-content-between">
<div id="{{uniqueId}}" class="d-flex flex-column flex-fill justify-content-between">
<span class="content"><img src="~/image/loading.gif" width="30" /></span>
<div class="d-flex justify-content-end">
<div class="d-flex flex-column align-items-end">


+ 0
- 1
LLama.Web/Pages/Shared/_Parameters.cshtml View File

@@ -1,7 +1,6 @@
@page
@using LLama.Common;
@model LLama.Abstractions.IInferenceParams
}

<div class="d-flex flex-row gap-3">
<div class="d-flex flex-column mb-2">


+ 2
- 0
LLama.Web/Program.cs View File

@@ -14,6 +14,8 @@ namespace LLama.Web
// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddSignalR();
builder.Logging.ClearProviders();
builder.Services.AddLogging((loggingBuilder) => loggingBuilder.SetMinimumLevel(LogLevel.Trace).AddConsole());

// Load InteractiveOptions
builder.Services.AddOptions<LLamaOptions>()


+ 4
- 3
LLama.Web/Services/ModelService.cs View File

@@ -1,6 +1,7 @@
using LLama.Web.Async;
using LLama.Web.Common;
using LLama.Web.Models;
using Microsoft.Extensions.Options;
using System.Collections.Concurrent;

namespace LLama.Web.Services
@@ -11,10 +12,10 @@ namespace LLama.Web.Services
/// </summary>
public class ModelService : IModelService
{
private readonly ILogger _llamaLogger;
private readonly AsyncLock _modelLock;
private readonly AsyncLock _contextLock;
private readonly LLamaOptions _configuration;
private readonly ILogger<ModelService> _llamaLogger;
private readonly ConcurrentDictionary<string, LLamaModel> _modelInstances;


@@ -23,12 +24,12 @@ namespace LLama.Web.Services
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="options">The options.</param>
public ModelService(LLamaOptions configuration, ILogger llamaLogger)
public ModelService(IOptions<LLamaOptions> configuration, ILogger<ModelService> llamaLogger)
{
_llamaLogger = llamaLogger;
_modelLock = new AsyncLock();
_contextLock = new AsyncLock();
_configuration = configuration;
_configuration = configuration.Value;
_modelInstances = new ConcurrentDictionary<string, LLamaModel>();
}



+ 3
- 3
LLama.Web/appsettings.json View File

@@ -7,12 +7,12 @@
},
"AllowedHosts": "*",
"LLamaOptions": {
"ModelLoadType": "Single",
"ModelLoadType": 0,
"Models": [
{
"Name": "WizardLM-7B",
"Name": "LLama2-7b-Chat",
"MaxInstances": 20,
"ModelPath": "D:\\Repositories\\AI\\Models\\wizardLM-7B.ggmlv3.q4_0.bin",
"ModelPath": "..\\LLama.Unittest\\Models\\llama-2-7b-chat.Q4_0.gguf",
"ContextSize": 2048,
"BatchSize": 2048,
"Threads": 4,


+ 3
- 2
LLama.Web/wwwroot/js/sessionConnectionChat.js View File

@@ -43,8 +43,8 @@ const createConnectionSessionChat = () => {
return;

if (response.tokenType == Enums.TokenType.Begin) {
const uniqueId = randomString();
outputContainer.append(Mustache.render(outputBotTemplate, { id: uniqueId, ...response }));
let uniqueId = randomString();
outputContainer.append(Mustache.render(outputBotTemplate, { uniqueId: uniqueId, ...response }));
responseContainer = $(`#${uniqueId}`);
responseContent = responseContainer.find(".content");
responseFirstToken = true;
@@ -102,6 +102,7 @@ const createConnectionSessionChat = () => {
}

const unloadModel = async () => {
await cancelPrompt();
disableControls();
enablePromptControls();
$("#load").removeAttr("disabled");


Loading…
Cancel
Save