修复 发布后 docker ffmpge安装缓慢问题
This commit is contained in:
parent
4d146d718b
commit
936423dc22
|
|
@ -1,9 +1,12 @@
|
||||||
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||||
|
|
||||||
FROM dotnet/aspnet:8.0
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
||||||
|
|
||||||
RUN ["apt-get", "--assume-yes", "update"]
|
|
||||||
RUN ["apt-get", "--assume-yes", "install", "ffmpeg"]
|
# 更新 apt 源
|
||||||
|
COPY sources.list /etc/apt/sources.list
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y ffmpeg
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
EXPOSE 9040
|
EXPOSE 9040
|
||||||
|
|
@ -13,9 +16,6 @@ COPY . .
|
||||||
ENV TZ=Asia/Shanghai
|
ENV TZ=Asia/Shanghai
|
||||||
|
|
||||||
|
|
||||||
#RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ sid main contrib non-free" > /etc/apt/sources.list
|
|
||||||
#RUN apt-get update && apt-get install -y apt-transport-https ca-certificates apt-utils libgdiplus libc6-dev && apt-get install -y libfreetype6 && apt-get install -y libfontconfig1 && apt-get install -y fontconfig
|
|
||||||
#
|
|
||||||
ENV ASPNETCORE_URLS=http://+:9040
|
ENV ASPNETCORE_URLS=http://+:9040
|
||||||
|
|
||||||
ENTRYPOINT ["dotnet", "Learn.VideoAnalysis.dll"]
|
ENTRYPOINT ["dotnet", "Learn.VideoAnalysis.dll"]
|
||||||
|
|
|
||||||
|
|
@ -17,12 +17,16 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="Dockerfile" />
|
<None Remove="Dockerfile" />
|
||||||
|
<None Remove="sources.list" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Dockerfile">
|
<Content Include="Dockerfile">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="sources.list">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
|
||||||
|
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
|
||||||
|
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
|
||||||
|
|
||||||
|
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
|
||||||
|
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
|
||||||
|
|
||||||
|
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
|
||||||
|
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
|
||||||
|
|
||||||
|
# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换
|
||||||
|
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
|
||||||
|
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
|
||||||
|
|
@ -63,8 +63,9 @@ namespace VideoAnalysisCore.AICore.ChatGPT.Dto
|
||||||
/// <para>满分100</para>
|
/// <para>满分100</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float AssessmentScore =>
|
public float AssessmentScore =>
|
||||||
(float)(Assessment?.Bad?.Sum(x => x.Score)??0 +
|
(float)(
|
||||||
Assessment?.Merit?.Sum(x => x.Score) ?? 0);
|
(Assessment?.Bad?.Sum(x => x.Score) ?? 0) +
|
||||||
|
(Assessment?.Merit?.Sum(x => x.Score) ?? 0));
|
||||||
//(float)Math.Round((Assessment?.Bad?.Select(x => x.Score)
|
//(float)Math.Round((Assessment?.Bad?.Select(x => x.Score)
|
||||||
//.Concat(Assessment?.Merit?.Select(s => s.Score) ?? [])
|
//.Concat(Assessment?.Merit?.Select(s => s.Score) ?? [])
|
||||||
//.Average() ?? 0) * 10,2);
|
//.Average() ?? 0) * 10,2);
|
||||||
|
|
|
||||||
|
|
@ -60,14 +60,14 @@ namespace VideoAnalysisCore.AICore.ChatGPT.KIMI
|
||||||
criteriaBuilder.Append(item.Id);
|
criteriaBuilder.Append(item.Id);
|
||||||
criteriaBuilder.Append(":");
|
criteriaBuilder.Append(":");
|
||||||
criteriaBuilder.Append(item.NamePrompt);
|
criteriaBuilder.Append(item.NamePrompt);
|
||||||
criteriaBuilder.Append("? 请基于解释精确打分");
|
criteriaBuilder.Append("? 请基于字幕内容对问题进行精确打分");
|
||||||
criteriaBuilder.Append("0-");
|
criteriaBuilder.Append("0-");
|
||||||
criteriaBuilder.Append((int)(item.TotalScore * 10));
|
criteriaBuilder.Append((int)(item.TotalScore * 10));
|
||||||
criteriaBuilder.Append("分");
|
criteriaBuilder.Append("分");
|
||||||
criteriaBuilder.Append((int)(item.PassScore * 10));
|
criteriaBuilder.Append((int)(item.PassScore * 10));
|
||||||
criteriaBuilder.Append("分为及格");
|
criteriaBuilder.Append("分为及格");
|
||||||
criteriaBuilder.Append(":");
|
criteriaBuilder.Append(":");
|
||||||
criteriaBuilder.Append("array=[得分,问题的回答,问题的详细改进意见,问题的详细扣分原因] 限制:给出的得分不要超过满分|");
|
criteriaBuilder.Append("array=[得分(得分不能超过满分/如果字幕内容不符合问题则给低分),问题的回答,问题的详细改进意见,问题的详细扣分原因]|");
|
||||||
|
|
||||||
}
|
}
|
||||||
//拼接枚举提问
|
//拼接枚举提问
|
||||||
|
|
@ -84,7 +84,7 @@ namespace VideoAnalysisCore.AICore.ChatGPT.KIMI
|
||||||
criteriaBuilder.Append("|");
|
criteriaBuilder.Append("|");
|
||||||
}
|
}
|
||||||
|
|
||||||
var resFormat = "[{问题编号:int,结果:array|bool|object,问题解释:string}]";
|
var resFormat = """[{"问题编号":number,"结果":array|bool|object,"问题解释":string}]""";
|
||||||
var postMessages =
|
var postMessages =
|
||||||
$"你是一个教学经验老道老师对教学工作有着深入的理解和丰富的经验,能够准确把握教学大纲的要求和教学重点。" +
|
$"你是一个教学经验老道老师对教学工作有着深入的理解和丰富的经验,能够准确把握教学大纲的要求和教学重点。" +
|
||||||
$"熟练掌握各种教学管理方法和手段,能够制定科学合理的教学计划和教学评估体系。" +
|
$"熟练掌握各种教学管理方法和手段,能够制定科学合理的教学计划和教学评估体系。" +
|
||||||
|
|
@ -92,11 +92,9 @@ namespace VideoAnalysisCore.AICore.ChatGPT.KIMI
|
||||||
$"以下是一段音频的字幕,分析这段字幕 字幕格式(说话人:开始秒:结束秒:内容|下一段字幕)." +
|
$"以下是一段音频的字幕,分析这段字幕 字幕格式(说话人:开始秒:结束秒:内容|下一段字幕)." +
|
||||||
$"字幕列表 {captions.Captions} " +
|
$"字幕列表 {captions.Captions} " +
|
||||||
$"基于字幕内容回答提出的所有问题 问题格式(问题编号:问题描述:结束秒:结果类型|下一个问题)" +
|
$"基于字幕内容回答提出的所有问题 问题格式(问题编号:问题描述:结束秒:结果类型|下一个问题)" +
|
||||||
$"问题列表 {criteriaBuilder} " +
|
$"返回固定的JSON数组格式({resFormat})";
|
||||||
$"返回固定的JSON数组格式({resFormat}).";
|
|
||||||
var modelsResp = await moonshotClient.ListModels();
|
|
||||||
if (modelsResp is null || modelsResp.data.Count == 0)
|
|
||||||
throw new Exception("未获取KIMI模型类型");
|
|
||||||
var reqTokenCount = await moonshotClient.GetAsTiMateTokenCount(postMessages);
|
var reqTokenCount = await moonshotClient.GetAsTiMateTokenCount(postMessages);
|
||||||
var maxTokens = 4000;
|
var maxTokens = 4000;
|
||||||
var modelId = reqTokenCount > 32 * 1000 - maxTokens ? "moonshot-v1-128k" : "moonshot-v1-32k";
|
var modelId = reqTokenCount > 32 * 1000 - maxTokens ? "moonshot-v1-128k" : "moonshot-v1-32k";
|
||||||
|
|
@ -109,17 +107,19 @@ namespace VideoAnalysisCore.AICore.ChatGPT.KIMI
|
||||||
model = modelId,
|
model = modelId,
|
||||||
messages = new List<MessagesItem>(){
|
messages = new List<MessagesItem>(){
|
||||||
new MessagesItem(postMessages,"system"),
|
new MessagesItem(postMessages,"system"),
|
||||||
new MessagesItem(resFormat,"assistant"),
|
//new MessagesItem(resFormat,"assistant",true),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
RedisExpand.SetTaskGPTReqCached(task, chatRep);
|
||||||
var chatResp = await moonshotClient.Chat(chatRep);
|
var chatResp = await moonshotClient.Chat(chatRep);
|
||||||
RedisExpand.SetTaskGPTCached(task, chatResp);
|
RedisExpand.SetTaskGPTCached(task, chatResp);
|
||||||
if (chatResp is null || chatResp.error != null)
|
if (chatResp is null || chatResp.error != null)
|
||||||
throw new Exception($"KIMI模型返回异常 Chat 返回参数: " +
|
throw new Exception($"KIMI模型返回异常 Chat 返回参数: " +
|
||||||
$" {JsonSerializer.Serialize(chatResp)}");
|
$" {JsonSerializer.Serialize(chatResp)}");
|
||||||
var chatResContent = chatResp?.choices.FirstOrDefault()?.message.content;
|
var chatResContent = chatResp?.choices.FirstOrDefault()?.message.content.Trim();
|
||||||
chatResContent = chatResContent?.Replace("字幕内容", "课堂情况");
|
chatResContent = chatResContent?.Replace("字幕内容", "课堂情况");
|
||||||
if (chatResContent is null)
|
if (string.IsNullOrEmpty(chatResContent))
|
||||||
throw new Exception("KIMIGPT返回message无效结果");
|
throw new Exception("KIMIGPT返回message无效结果");
|
||||||
var questionRes = JsonSerializer.Deserialize<QuestionRes[]>(chatResContent);
|
var questionRes = JsonSerializer.Deserialize<QuestionRes[]>(chatResContent);
|
||||||
var gptRes = new TaskRes(captions);
|
var gptRes = new TaskRes(captions);
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,11 @@
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
public MessagesItem(string content, string role = "user")
|
public MessagesItem(string content, string role = "user",bool partial = false)
|
||||||
{
|
{
|
||||||
this.content = content;
|
this.content = content;
|
||||||
this.role = role;
|
this.role = role;
|
||||||
|
this.partial = partial;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,11 @@ namespace VideoAnalysisCore.Common
|
||||||
/// <param name="taskId"></param>
|
/// <param name="taskId"></param>
|
||||||
public static void SetTaskGPTCached(object taskId, object? data)
|
public static void SetTaskGPTCached(object taskId, object? data)
|
||||||
{
|
{
|
||||||
Redis.Set(RedisExpandKey.TaskGPT(taskId), data, 3600*24);
|
Redis.Set(RedisExpandKey.TaskGPT(taskId), data, 3600 * 24);
|
||||||
|
}
|
||||||
|
public static void SetTaskGPTReqCached(object taskId, object? data)
|
||||||
|
{
|
||||||
|
Redis.Set(RedisExpandKey.TaskGPT(taskId)+":Req_"+ DateTime.Now.ToString("yyyy/MM/dd_HH/mm/ss"), data, 3600*24);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取任务进度
|
/// 获取任务进度
|
||||||
|
|
|
||||||
|
|
@ -13,14 +13,14 @@ namespace VideoAnalysisCore.Enum
|
||||||
[Display(Prompt = "分析授课中使用的高频词" +
|
[Display(Prompt = "分析授课中使用的高频词" +
|
||||||
"10个频率从高到低 结果类型[]")]
|
"10个频率从高到低 结果类型[]")]
|
||||||
高频词 = 5001,
|
高频词 = 5001,
|
||||||
[Display(Prompt = "基于字幕描述内容精准的划分成时间片段" +
|
[Display(Prompt = "基于字幕内容精准的提取出课堂上全部的事件" +
|
||||||
",提取片段的内容概览,字幕开始秒,结束秒.作为返回结果.每个个片段不低于120秒 结果类型[{Start:开始秒,End:结束秒,Content:概览}]")]
|
",分析事件的时间片段提取事件的的内容概览,字幕开始秒,结束秒.作为返回结果.每个片段不低于120秒 结果类型[{Start:开始秒,End:结束秒,Content:概览}]")]
|
||||||
时间段概览 = 5002,
|
时间段概览 = 5002,
|
||||||
[Display(Prompt = "统计授课中教师回答类型的次数 回答类型" +
|
[Display(Prompt = "统计授课中教师回答类型的次数 回答类型" +
|
||||||
"[重复回答,老师追问,简单性表扬,老师补充答案,表扬并补充答案] 结果类型{回答类型:次数}")]
|
"[重复回答,老师追问,简单性表扬,老师补充答案,表扬并补充答案] 结果类型{回答类型:次数}")]
|
||||||
提问类型 = 5003,
|
提问类型 = 5003,
|
||||||
[Display(Prompt = " 分析授课中教师提到 以下类型" +
|
[Display(Prompt = " 分析授课中教师提到 以下类型" +
|
||||||
"[独立学习,小组合作,随堂练习]的时间段,提取出其中字幕开始秒,结束秒 结果类型[{Start:开始秒,End:结束秒,Content:类型}/null]")]
|
"[独立学习,小组合作,随堂练习]的时间段,精准提取出其中字幕开始秒,结束秒 结果类型[{Start:开始秒(number),End:结束秒(number),Content:类型(string)}/null]")]
|
||||||
额外课堂情况 = 5004,
|
额外课堂情况 = 5004,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="7.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="org.k2fsa.sherpa.onnx" Version="1.10.30" />
|
<PackageReference Include="org.k2fsa.sherpa.onnx" Version="1.10.32" />
|
||||||
<PackageReference Include="SqlSugar.IOC" Version="2.0.0" />
|
<PackageReference Include="SqlSugar.IOC" Version="2.0.0" />
|
||||||
<PackageReference Include="SqlSugarCore" Version="5.1.4.170" />
|
<PackageReference Include="SqlSugarCore" Version="5.1.4.170" />
|
||||||
<PackageReference Include="UserCenter.Model" Version="1.3.4" />
|
<PackageReference Include="UserCenter.Model" Version="1.3.4" />
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue