添加国际化

This commit is contained in:
2025-01-08 11:06:24 +08:00
parent 6fd65fc61d
commit c19b32cae3
21 changed files with 2046 additions and 244 deletions
@@ -1,16 +1,30 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="firstArticleInspection.aspx.cs" Inherits="FineUIPro.Web.ZHGL.FirstArticalInspaction.firstArticleInspection" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>黑夜将至,而这一切都将消失!</title>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<f:PageManager ID="PageManager1" runat="server" />
<f:SimpleForm ID="SimpleForm1" IsFluid="true" BodyPadding="10px" EnableCollapse="false"
Title="登录表单" ShowHeader="true" runat="server">
<Items>
<f:TextBox runat="server" Label="用户名" EmptyText="请输入用户名" ID="tbxUserName" Required="true" ShowRedStar="true">
</f:TextBox>
<f:TextBox runat="server" ID="tbxPassword" Label="密码" EmptyText="请输入密码" TextMode="Password" Required="true" ShowRedStar="true">
</f:TextBox>
<f:Button ID="btnSubmit" CssClass="marginr" runat="server" OnClick="btnSubmit_Click" ValidateForms="SimpleForm1"
Text="登录">
</f:Button>
<f:Button ID="btnReset" runat="server" EnablePostBack="false" Text="重置">
</f:Button>
</Items>
</f:SimpleForm>
<br />
<f:Label ID="labResult" ShowLabel="false" runat="server">
</f:Label>
</form>
</body>
</html>
</html>
@@ -7,11 +7,22 @@ using System.Web.UI.WebControls;
namespace FineUIPro.Web.ZHGL.FirstArticalInspaction
{
public partial class firstArticleInspection : System.Web.UI.Page
public partial class firstArticleInspection : PageBase
{
public firstArticleInspection()
{
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
btnReset.OnClientClick = SimpleForm1.GetResetReference();
}
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
labResult.Text = "用户名:" + tbxUserName.Text + " 密码:" + tbxPassword.Text;
}
}
}
@@ -22,5 +22,68 @@ namespace FineUIPro.Web.ZHGL.FirstArticalInspaction
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// SimpleForm1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.SimpleForm SimpleForm1;
/// <summary>
/// tbxUserName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox tbxUserName;
/// <summary>
/// tbxPassword 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox tbxPassword;
/// <summary>
/// btnSubmit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSubmit;
/// <summary>
/// btnReset 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnReset;
/// <summary>
/// labResult 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label labResult;
}
}
@@ -5,12 +5,35 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>大模型测试!</title>
<title></title>
<link href="res/css/common.css" rel="stylesheet" />
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel5" runat="server" />
<f:Panel ID="Panel5" Margin="24px" runat="server" ShowBorder="true" EnableCollapse="true"
Layout="VBox" AutoScroll="true"
ShowHeader="true" Title="大模型提问"
BoxConfigChildMargin="0 0 5 0" BodyPadding="5">
<Items>
<f:Panel ID="Panel1" Title="面板1" Height="350px" runat="server"
BodyPadding="10px" ShowBorder="true" ShowHeader="false" AutoScroll="true">
<Items>
<f:Label ID="Label1" runat="server" EncodeText="false" Text="" AutoScroll="true">
</f:Label>
</Items>
</f:Panel>
</Items>
<Items>
<f:TextBox ID="TextBox2" runat="server" Label="请输入问题" OnTextChanged="TextBox2_TextChanged" EmptyText="输入问题后点击提交按钮">
</f:TextBox>
</Items>
<Items>
<f:Button runat="server" Text="提交"></f:Button>
</Items>
</f:Panel>
</form>
</body>
</html>
@@ -4,14 +4,142 @@ using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Diagnostics;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Text.Json.Serialization;
using NPOI.Util;
using HeyRed.MarkdownSharp;
namespace FineUIPro.Web.ZHGL.FirstArticalInspaction
{
public partial class LLM : System.Web.UI.Page
public partial class LLM : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void TextBox2_TextChanged(object sender, EventArgs e)
{
var result = GetResult(TextBox2.Text);
var response = System.Text.Json.JsonSerializer.Deserialize<ResponseModel>(result);
var finalResult = response.Output.Text;
Markdown mark = new Markdown();
string markdownResult = mark.Transform(finalResult);
Label1.Text = markdownResult;
}
private static readonly string API_KEY = "sk-Sbcnxh0YXz";
//不返回资料来源接口
private static readonly string URL = "https://dashscope.aliyuncs.com/api/v1/apps/7e0c1e47a6364f8e914982c99a1e00c5/completion";
//返回原始资料来源
private static readonly string URL2 = "https://dashscope.aliyuncs.com/api/v1/apps/d9461732646e49a38d7832d5c3eb8332/completion";
private static readonly string URL3 = "https://dashscope.aliyuncs.com/api/v1/apps/7e0c1e47a6364f8e914982c99a1e00c5/completion";
static String GetResult(string question)
{
var client = new LLM();
try
{
string result = client.GetCompletion(question);
Debug.WriteLine(result);
return result;
}
catch (Exception ex)
{
Debug.WriteLine($"发生错误: {ex.Message}");
return $"发生错误: {ex.Message}";
}
}
public string GetCompletion(string question)
{
using (var client = new HttpClient())
{
// 设置请求头
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {API_KEY}");
// 构建请求体
var requestBody = new
{
input = new
{
prompt = question
},
parameters = new { },
debug = new { }
};
// 将对象序列化为 JSON
var jsonContent = System.Text.Json.JsonSerializer.Serialize(requestBody);
var content = new StringContent(jsonContent, Encoding.UTF8, "application/json");
try
{
// 发送 POST 请求
var response = client.PostAsync(URL, content).Result;
// 确保请求成功
response.EnsureSuccessStatusCode();
// 读取响应内容
return response.Content.ReadAsStringAsync().Result;
}
catch (HttpRequestException ex)
{
Console.WriteLine($"请求失败: {ex.Message}");
throw;
}
}
}
}
public class ResponseModel
{
[JsonPropertyName("output")]
public Output Output { get; set; }
[JsonPropertyName("usage")]
public Usage Usage { get; set; }
[JsonPropertyName("request_id")]
public string RequestId { get; set; }
}
public class Output
{
[JsonPropertyName("finish_reason")]
public string FinishReason { get; set; }
[JsonPropertyName("session_id")]
public string SessionId { get; set; }
[JsonPropertyName("text")]
public string Text { get; set; }
}
public class Usage
{
[JsonPropertyName("models")]
public List<Model> Models { get; set; }
}
public class Model
{
[JsonPropertyName("output_tokens")]
public int OutputTokens { get; set; }
[JsonPropertyName("model_id")]
public string ModelId { get; set; }
[JsonPropertyName("input_tokens")]
public int InputTokens { get; set; }
}
}
@@ -22,5 +22,50 @@ namespace FineUIPro.Web.ZHGL.FirstArticalInspaction
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel5 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel5;
/// <summary>
/// Panel1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// Label1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label Label1;
/// <summary>
/// TextBox2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox TextBox2;
}
}
@@ -1,17 +1,68 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ZHJ_TEST.aspx.cs" Inherits="FineUIPro.Web.ZHGL.FirstArticalInspaction.ZHJ_TEST" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>测试页面!</title>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<f:Image runat="server" ImageUrl="https://i.pximg.net/c/768x1200_80/img-master/img/2023/12/06/04/58/17/113989485_p0_master1200.jpg"></f:Image>
</div>
<f:PageManager ID="PageManager1" runat="server" AutoSizePanelID="Panel1" />
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" EnableAjax="false" ShowHeader="false" Title="待办" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="DataId" AllowCellEditing="true" OnPageIndexChange="Grid1_PageIndexChange"
ClicksToEdit="2" DataIDField="DataId" OnRowDoubleClick="Grid1_RowDoubleClick" AllowSorting="true" SortField="DocCode"
SortDirection="DESC" EnableColumnLines="true" ForceFit="true" OnFilterChange="Grid1_FilterChange"
AllowPaging="true" IsDatabasePaging="true" PageSize="10"
EnableRowDoubleClickEvent="true" AllowFilters="true"
EnableTextSelection="True">
<Columns>
<f:TemplateField ColumnID="tfPageIndex" Width="50px" HeaderText="序号" HeaderTextAlign="Center" TextAlign="Center"
EnableLock="true" Locked="False">
<ItemTemplate>
<asp:Label ID="lblPageIndex" runat="server" Text='<%# Grid1.PageIndex * Grid1.PageSize + Container.DataItemIndex + 1 %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:RenderField ColumnID="MenuName" Width="100px" DataField="MenuName"
SortField="MenuName" FieldType="String" HeaderText="菜单名称" TextAlign="Center"
HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField ColumnID="Content" Width="100px" DataField="Content"
SortField="Content" FieldType="String" HeaderText="内容" TextAlign="Center"
HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="DataTime" DataField="DataTime" SortField="DataTime"
FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd" HeaderText="日期" TextAlign="Center" HeaderTextAlign="Center">
</f:RenderField>
</Columns>
<PageItems>
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
</f:ToolbarSeparator>
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
</f:ToolbarText>
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
<f:ListItem Text="10" Value="10" />
<f:ListItem Text="15" Value="15" />
<f:ListItem Text="20" Value="20" />
<f:ListItem Text="25" Value="25" />
<f:ListItem Text="所有行" Value="100000" />
</f:DropDownList>
<f:ToolbarFill runat="server">
</f:ToolbarFill>
</PageItems>
</f:Grid>
</Items>
</f:Panel>
<f:Window ID="WindowAtt" Title="待办事项" Hidden="true" EnableIFrame="true" EnableMaximize="true" OnClose="WindowAtt_Close"
Target="Parent" EnableResize="false" runat="server" IsModal="true" Width="1300px"
Height="700px">
</f:Window>
</form>
</body>
</html>
@@ -1,17 +1,64 @@
using System;
using BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.ZHGL.FirstArticalInspaction
namespace FineUIPro.Web.ZHGL.HSSESystem
{
public partial class ZHJ_TEST : System.Web.UI.Page
public partial class ZHJ_TEST : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindGrid();
}
}
void BindGrid()
{
}
/// <summary>
/// 分页显示条数下拉框
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
BindGrid();
}
/// <summary>
/// 过滤表头
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_FilterChange(object sender, EventArgs e)
{
BindGrid();
}
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
}
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
BindGrid();
}
protected void WindowAtt_Close(object sender, WindowCloseEventArgs e)
{
BindGrid();
}
}
}
}