add_AI_chat
This commit is contained in:
1 parent
b7c1baa654
commit
9ead305544
23 files changed
+1101
-13
No files matched your search
@@ -4,7 +4,7 @@
|
|||||||
<ProjectVersion>2.1</ProjectVersion>
|
<ProjectVersion>2.1</ProjectVersion>
|
||||||
<DockerTargetOS>Linux</DockerTargetOS>
|
<DockerTargetOS>Linux</DockerTargetOS>
|
||||||
<ProjectGuid>81dded9d-158b-e303-5f62-77a2896d2a5a</ProjectGuid>
|
<ProjectGuid>81dded9d-158b-e303-5f62-77a2896d2a5a</ProjectGuid>
|
||||||
<DockerLaunchAction>LaunchBrowser</DockerLaunchAction>
|
<DockerLaunchAction></DockerLaunchAction>
|
||||||
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}</DockerServiceUrl>
|
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}</DockerServiceUrl>
|
||||||
<DockerServiceName>medica-info</DockerServiceName>
|
<DockerServiceName>medica-info</DockerServiceName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- ASPNETCORE_ENVIRONMENT=Production
|
- ASPNETCORE_ENVIRONMENT=Production
|
||||||
- ASPNETCORE_HTTP_PORTS=8080
|
- ASPNETCORE_HTTP_PORTS=8080
|
||||||
|
- ConnectionStrings__Default=Server=192.168.232.100,1433;Database=Medica_info;User Id=medinfo;Password=medica@n5k;TrustServerCertificate=False;
|
||||||
|
- //192.168.232.33/medica.info/:/app/Data
|
||||||
ports:
|
ports:
|
||||||
- "2222:8080"
|
- "2222:8080"
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@@ -4,5 +4,9 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: medica-info/Dockerfile
|
dockerfile: medica-info/Dockerfile
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
volumes:
|
volumes:
|
||||||
- //192.168.232.33/medica.info/:/app/Data
|
- //192.168.232.33/medica.info/:/app/Data
|
||||||
|
environment:
|
||||||
|
ConnectionStrings__Default: "Server=192.168.232.100,1433;Database=Medica_info;User Id=medinfo;Password=medica@n5k;TrustServerCertificate=false;"
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<parameters>
|
||||||
|
<parameter name="IIS Web Application Name" description="" value="medica.info" tags="IisApp">
|
||||||
|
<parameterEntry kind="ProviderPath" scope="IisApp" match="^C:\\Users\\i\.roger\\source\\repos\\medica-info\\medica-info\\obj\\Release\\net10\.0\\win-x86\\PubTmp\\Out\\$" />
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<parameters>
|
||||||
|
<setParameter name="IIS Web Application Name" value="medica.info" />
|
||||||
|
</parameters>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<sitemanifest>
|
||||||
|
<IisApp path="C:\Users\i.roger\source\repos\medica-info\medica-info\obj\Release\net10.0\win-x86\PubTmp\Out\" />
|
||||||
|
</sitemanifest>
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
===========================
|
||||||
|
Prerequisites :
|
||||||
|
--------------------------
|
||||||
|
To deploy this Web package, Web Deploy (msdeploy.exe) must be installed on the computer that runs the .cmd file. For information about how to install Web Deploy, see the following URL:
|
||||||
|
https://go.microsoft.com/?linkid=9278654
|
||||||
|
This batch file requires that the package file "medica-info.zip" and optionally provided the parameters file "medica-info.SetParameters.xml" in the same folder or destination folder by environment variable.
|
||||||
|
|
||||||
|
===========================
|
||||||
|
Usage:
|
||||||
|
--------------------------
|
||||||
|
medica-info.deploy.cmd [/T|/Y] [/M:ComputerName] [/U:UserName] [/P:Password] [/G:<True | False>] [/A:<Basic | NTLM>] [Additional msdeploy.exe flags ...]
|
||||||
|
|
||||||
|
|
||||||
|
===========================
|
||||||
|
Required Flags:
|
||||||
|
--------------------------
|
||||||
|
/T:
|
||||||
|
Calls msdeploy.exe with the "-whatif" flag, which simulates deployment. This does not deploy the package. Instead, it creates a report of what will happen when you actually deploy the package.
|
||||||
|
/Y:
|
||||||
|
Calls msdeploy.exe without the "-whatif" flag, which deploys the package to the current machine or a destination server. Use /Y after you have verified the output that was generated by using the /T flag.
|
||||||
|
|
||||||
|
Note: Do not use /T and /Y in the same command.
|
||||||
|
|
||||||
|
===========================
|
||||||
|
Optional Flags:
|
||||||
|
--------------------------
|
||||||
|
By Default, this script deploy on the current machine where this script is called with current user credential without agent service. Only pass the following value for advance scenario.
|
||||||
|
|
||||||
|
/M:<Destination server name or Service URL>
|
||||||
|
If this flag is not specified, the package is installed on the computer where the command is run. The Service URL can be in the following format:
|
||||||
|
https://<DestinationServer>:8172/MSDeploy.axd
|
||||||
|
This format requires that IIS 7 be installed on the destination server and that IIS 7 Web Management Service(WMSvc) and Web Deployment Handler be set up.
|
||||||
|
The service URL can also be in the following format:
|
||||||
|
http://<DestinationServer>/MSDeployAgentService
|
||||||
|
This format requires administrative rights on the destination server, and it requires that Web Deploy Remote Service (MsDepSvc) be installed on the destination server. IIS 7 does not have to be installed on the destination server.
|
||||||
|
|
||||||
|
/U:<UserName>
|
||||||
|
/P:<Password>
|
||||||
|
/G:<True | False>
|
||||||
|
Specifies that the package is deployed by creating a temporary listener on the destination server. This requires no special installation on the destination server, but it requires you to be an administrator on that server. The default value of this flag is False.
|
||||||
|
|
||||||
|
/A:<Basic | NTLM>
|
||||||
|
Specifies the type of authentication to be used. The possible values are NTLM and Basic. If the wmsvc provider setting is specified, the default authentication type is Basic; otherwise, the default authentication type is NTLM.
|
||||||
|
|
||||||
|
/L
|
||||||
|
Specifies that the package is deployed to local IISExpress user instance.
|
||||||
|
|
||||||
|
[Additional msdeploy.exe flags]
|
||||||
|
The msdeploy.exe command supports additional flags. You can include any of these additional flags in the "medica-info.Deploy.cmd" file, and the flags are passed through to msdeploy.exe during execution.
|
||||||
|
Alternatively, you can specify additional flags by setting the "_MsDeployAdditionalFlags" environment variable. These settings are used by this batch file.
|
||||||
|
Note: Any flag value that includes an equal sign (=) must be enclosed in double quotation marks, as shown in the following example, which will skip deploying the databases that are included in the package:
|
||||||
|
"-skip:objectName=dbFullSql"
|
||||||
|
|
||||||
|
===========================
|
||||||
|
Environment-Specific Settings:
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
To customize application-specific settings for each deployment environment (for example, the IIS application name, the physical path, and any connection strings), edit the settings in the following file:
|
||||||
|
"medica-info.SetParameters.xml"
|
||||||
|
===========================
|
||||||
|
For more information on this deploy script visit: https://go.microsoft.com/fwlink/?LinkID=183544
|
||||||
@@ -0,0 +1,316 @@
|
|||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
@rem This is provided as sample to deploy the package using msdeploy.exe
|
||||||
|
@rem For information about IIS Web Deploy technology,
|
||||||
|
@rem please visit https://go.microsoft.com/?linkid=9278654
|
||||||
|
@rem Note: This batch file assumes the package and setparameters.xml are in the same folder with this file
|
||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
@if %_echo%!==! echo off
|
||||||
|
setlocal
|
||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
@rem Please Make sure you have Web Deploy install in your machine.
|
||||||
|
@rem Alternatively, you can explicit set the MsDeployPath to the location it is on your machine
|
||||||
|
@rem set MSDeployPath="C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\"
|
||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
@rem if user does not set MsDeployPath environment variable, we will try to retrieve it from registry.
|
||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
if "%MSDeployPath%" == "" (
|
||||||
|
for /F "usebackq tokens=1,2,*" %%h in (`reg query "HKLM\SOFTWARE\Microsoft\IIS Extensions\MSDeploy" /s ^| findstr -i "InstallPath"`) do (
|
||||||
|
if /I "%%h" == "InstallPath" (
|
||||||
|
if /I "%%i" == "REG_SZ" (
|
||||||
|
if not "%%j" == "" (
|
||||||
|
if "%%~dpj" == "%%j" (
|
||||||
|
set MSDeployPath=%%j
|
||||||
|
))))))
|
||||||
|
|
||||||
|
@rem ------------------------------------------
|
||||||
|
|
||||||
|
@rem ------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
if not exist "%MSDeployPath%msdeploy.exe" (
|
||||||
|
echo. msdeploy.exe is not found on this machine. Please install Web Deploy before execute the script.
|
||||||
|
echo. Please visit https://go.microsoft.com/?linkid=9278654
|
||||||
|
goto :usage
|
||||||
|
)
|
||||||
|
|
||||||
|
set RootPath=%~dp0
|
||||||
|
if /I "%_DeploySetParametersFile%" == "" (
|
||||||
|
set _DeploySetParametersFile=%RootPath%medica-info.SetParameters.xml
|
||||||
|
)
|
||||||
|
|
||||||
|
@rem ------------------------------------------
|
||||||
|
|
||||||
|
@rem ------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
set _ArgTestDeploy=
|
||||||
|
set _ArgDestinationType=auto
|
||||||
|
set _ArgComputerNameWithQuote=""
|
||||||
|
set _ArgUserNameWithQuote=""
|
||||||
|
set _ArgPasswordWithQuote=""
|
||||||
|
set _ArgEncryptPasswordWithQuote=""
|
||||||
|
set _ArgIncludeAclsWithQuote="False"
|
||||||
|
set _ArgAuthTypeWithQuote=""
|
||||||
|
set _ArgtempAgentWithQuote=""
|
||||||
|
set _ArgLocalIIS=
|
||||||
|
set _ArgLocalIISVersion=
|
||||||
|
set _HaveArgMSDeployAdditonalFlags=
|
||||||
|
|
||||||
|
|
||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
@rem Simple Parse the arguments
|
||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
:NextArgument
|
||||||
|
set _ArgCurrent=%~1
|
||||||
|
set _ArgFlagFirst=%_ArgCurrent:~0,1%
|
||||||
|
set _ArgFlag=%_ArgCurrent:~0,3%
|
||||||
|
set _ArgValue=%_ArgCurrent:~3%
|
||||||
|
|
||||||
|
if /I "%_ArgFlag%" == "" goto :GetStarted
|
||||||
|
if /I "%_ArgFlag%" == "~0,3" goto :GetStarted
|
||||||
|
if /I "%_ArgFlag%" == "/T" set _ArgTestDeploy=true&goto :ArgumentOK
|
||||||
|
if /I "%_ArgFlag%" == "/Y" set _ArgTestDeploy=false&goto :ArgumentOK
|
||||||
|
if /I "%_ArgFlag%" == "/L" set _ArgLocalIIS=true&goto :ArgumentOK
|
||||||
|
|
||||||
|
if /I "%_ArgFlag%" == "/M:" set _ArgComputerNameWithQuote="%_ArgValue%"&goto :ArgumentOK
|
||||||
|
if /I "%_ArgFlag%" == "/U:" set _ArgUserNameWithQuote="%_ArgValue%"&goto :ArgumentOK
|
||||||
|
if /I "%_ArgFlag%" == "/P:" set _ArgPasswordWithQuote="%_ArgValue%"&goto :ArgumentOK
|
||||||
|
if /I "%_ArgFlag%" == "/E:" set _ArgEncryptPasswordWithQuote="%_ArgValue%"&goto :ArgumentOK
|
||||||
|
if /I "%_ArgFlag%" == "/I:" set _ArgIncludeAclsWithQuote="%_ArgValue%"&goto :ArgumentOK
|
||||||
|
if /I "%_ArgFlag%" == "/A:" set _ArgAuthTypeWithQuote="%_ArgValue%"&goto :ArgumentOK
|
||||||
|
if /I "%_ArgFlag%" == "/G:" set _ArgtempAgentWithQuote="%_ArgValue%"&goto :ArgumentOK
|
||||||
|
|
||||||
|
@rem Any addition flags, pass through to the msdeploy
|
||||||
|
if "%_HaveArgMSDeployAdditonalFlags%" == "" (
|
||||||
|
goto :Assign_ArgMsDeployAdditionalFlags
|
||||||
|
)
|
||||||
|
set _ArgMsDeployAdditionalFlags=%_ArgMsDeployAdditionalFlags:&=^&% %_ArgCurrent:&=^&%
|
||||||
|
set _HaveArgMSDeployAdditonalFlags=1
|
||||||
|
goto :ArgumentOK
|
||||||
|
|
||||||
|
|
||||||
|
:Assign_ArgMsDeployAdditionalFlags
|
||||||
|
set _ArgMsDeployAdditionalFlags=%_ArgCurrent:&=^&%
|
||||||
|
set _HaveArgMSDeployAdditonalFlags=1
|
||||||
|
goto :ArgumentOK
|
||||||
|
|
||||||
|
:ArgumentOK
|
||||||
|
shift
|
||||||
|
goto :NextArgument
|
||||||
|
|
||||||
|
:GetStarted
|
||||||
|
@rem ------------------------------------------
|
||||||
|
|
||||||
|
@rem ------------------------------------------
|
||||||
|
if /I "%_ArgTestDeploy%" == "" goto :usage
|
||||||
|
if /I "%_ArgDestinationType%" == "" goto :usage
|
||||||
|
|
||||||
|
set _Destination=%_ArgDestinationType%
|
||||||
|
if not %_ArgComputerNameWithQuote% == "" set _Destination=%_Destination%,computerName=%_ArgComputerNameWithQuote%
|
||||||
|
if not %_ArgUserNameWithQuote% == "" set _Destination=%_Destination%,userName=%_ArgUserNameWithQuote%
|
||||||
|
if not %_ArgPasswordWithQuote% == "" set _Destination=%_Destination%,password=%_ArgPasswordWithQuote%
|
||||||
|
if not %_ArgAuthTypeWithQuote% == "" set _Destination=%_Destination%,authtype=%_ArgAuthTypeWithQuote%
|
||||||
|
if not %_ArgEncryptPasswordWithQuote% == "" set _Destination=%_Destination%,encryptPassword=%_ArgEncryptPasswordWithQuote%
|
||||||
|
if not %_ArgIncludeAclsWithQuote% == "" set _Destination=%_Destination%,includeAcls=%_ArgIncludeAclsWithQuote%
|
||||||
|
if not %_ArgtempAgentWithQuote% == "" set _Destination=%_Destination%,tempAgent=%_ArgtempAgentWithQuote%
|
||||||
|
|
||||||
|
@rem ------------------------------------------
|
||||||
|
|
||||||
|
@rem ------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
@rem add -whatif when -T is specified
|
||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
if /I "%_ArgTestDeploy%" NEQ "false" (
|
||||||
|
set _MsDeployAdditionalFlags=-whatif %_MsDeployAdditionalFlags%
|
||||||
|
)
|
||||||
|
|
||||||
|
@rem ------------------------------------------
|
||||||
|
|
||||||
|
@rem ------------------------------------------
|
||||||
|
|
||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
@rem add flags for IISExpress when -L is specified
|
||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
if /I "%_ArgLocalIIS%" == "true" (
|
||||||
|
call :SetIISExpressArguments
|
||||||
|
)
|
||||||
|
if /I "%_ArgLocalIIS%" == "true" (
|
||||||
|
if not exist "%IISExpressPath%%IISExpressManifest%" (
|
||||||
|
echo. IISExpress is not found on this machine. Please install through Web Platform Installer before execute the script.
|
||||||
|
echo. or remove /L flag
|
||||||
|
echo. Please visit https://go.microsoft.com/?linkid=9278654
|
||||||
|
goto :usage
|
||||||
|
)
|
||||||
|
if not exist "%IISExpressUserProfileDirectory%" (
|
||||||
|
echo. %IISExpressUserProfileDirectory% is not exists
|
||||||
|
echo. IISExpress is found on the machine. But the user have run IISExpress at least once.
|
||||||
|
echo. Please visit https://go.microsoft.com/?linkid=9278654 for detail
|
||||||
|
goto :usage
|
||||||
|
)
|
||||||
|
|
||||||
|
set _MsDeployAdditionalFlags=%_MsDeployAdditionalFlags% -appHostConfigDir:%IISExpressUserProfileDirectory% -WebServerDir:"%IISExpressPath%" -webServerManifest:"%IISExpressManifest%"
|
||||||
|
)
|
||||||
|
|
||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
@rem check the existence of the package file
|
||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
if not exist "%RootPath%medica-info.zip" (
|
||||||
|
echo "%RootPath%medica-info.zip" does not exist.
|
||||||
|
echo This batch file relies on this deploy source file^(s^) in the same folder.
|
||||||
|
goto :usage
|
||||||
|
)
|
||||||
|
|
||||||
|
@rem ---------------------------------------------
|
||||||
|
|
||||||
|
@rem ---------------------------------------------
|
||||||
|
|
||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
@rem Execute msdeploy.exe command line
|
||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
call :CheckParameterFile
|
||||||
|
echo. Start executing msdeploy.exe
|
||||||
|
echo -------------------------------------------------------
|
||||||
|
if not exist "%_DeploySetParametersFile%" (
|
||||||
|
set _MSDeployCommandline="%MSDeployPath%msdeploy.exe" -source:package='%RootPath%medica-info.zip' -dest:%_Destination% -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension
|
||||||
|
) else (
|
||||||
|
set _MSDeployCommandline="%MSDeployPath%msdeploy.exe" -source:package='%RootPath%medica-info.zip' -dest:%_Destination% -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"%_DeploySetParametersFile%"
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%_HaveArgMSDeployAdditonalFlags%" == "" (
|
||||||
|
goto :MSDeployWithOutArgMsDeployAdditionalFlag
|
||||||
|
)
|
||||||
|
goto :MSDeployWithArgMsDeployAdditionalFlag
|
||||||
|
goto :eof
|
||||||
|
|
||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
@rem MSDeployWithArgMsDeployAdditionalFlag
|
||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
:MSDeployWithArgMsDeployAdditionalFlag
|
||||||
|
echo. %_MSDeployCommandline% %_MsDeployAdditionalFlags% %_ArgMsDeployAdditionalFlags:&=^&%
|
||||||
|
%_MSDeployCommandline% %_MsDeployAdditionalFlags% %_ArgMsDeployAdditionalFlags:&=^&%
|
||||||
|
IF %ERRORLEVEL% NEQ 0 (
|
||||||
|
exit 1
|
||||||
|
)
|
||||||
|
goto :eof
|
||||||
|
|
||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
@rem MSDeployWithOutArgMsDeployAdditionalFlag
|
||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
:MSDeployWithOutArgMsDeployAdditionalFlag
|
||||||
|
echo. %_MSDeployCommandline% %_MsDeployAdditionalFlags%
|
||||||
|
%_MSDeployCommandline% %_MsDeployAdditionalFlags%
|
||||||
|
IF %ERRORLEVEL% NEQ 0 (
|
||||||
|
exit 1
|
||||||
|
)
|
||||||
|
goto :eof
|
||||||
|
|
||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
@rem Find and set IISExpress argument.
|
||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
:SetIISExpressArguments
|
||||||
|
|
||||||
|
if "%IISExpressPath%" == "" (
|
||||||
|
for /F "usebackq tokens=1,2,*" %%h in (`reg query "HKLM\SOFTWARE\Microsoft\IISExpress" /s ^| findstr -i "InstallPath"`) do (
|
||||||
|
if /I "%%h" == "InstallPath" (
|
||||||
|
if /I "%%i" == "REG_SZ" (
|
||||||
|
if not "%%j" == "" (
|
||||||
|
if "%%~dpj" == "%%j" (
|
||||||
|
set IISExpressPath=%%j
|
||||||
|
))))))
|
||||||
|
|
||||||
|
if "%IISExpressPath%" == "" (
|
||||||
|
for /F "usebackq tokens=1,2,*" %%h in (`reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\IISExpress" /s ^| findstr -i "InstallPath"`) do (
|
||||||
|
if /I "%%h" == "InstallPath" (
|
||||||
|
if /I "%%i" == "REG_SZ" (
|
||||||
|
if not "%%j" == "" (
|
||||||
|
if "%%~dpj" == "%%j" (
|
||||||
|
set IISExpressPath=%%j
|
||||||
|
))))))
|
||||||
|
|
||||||
|
if "%PersonalDocumentFolder%" == "" (
|
||||||
|
for /F "usebackq tokens=2*" %%i in (`reg query "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Personal`) do (
|
||||||
|
set PersonalDocumentFolder=%%j
|
||||||
|
))
|
||||||
|
|
||||||
|
if "%IISExpressManifest%" == "" (
|
||||||
|
for /F "usebackq tokens=1,2,*" %%h in (`reg query "HKLM\SOFTWARE\Microsoft\IISExpress" /s ^| findstr -i "Manifest"`) do (
|
||||||
|
if /I "%%h" == "Manifest" (
|
||||||
|
if /I "%%i" == "REG_SZ" (
|
||||||
|
if not "%%j" == "" (
|
||||||
|
set IISExpressManifest=%%j
|
||||||
|
)))))
|
||||||
|
|
||||||
|
if "%IISExpressManifest%" == "" (
|
||||||
|
for /F "usebackq tokens=1,2,*" %%h in (`reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\IISExpress" /s ^| findstr -i "Manifest"`) do (
|
||||||
|
if /I "%%h" == "Manifest" (
|
||||||
|
if /I "%%i" == "REG_SZ" (
|
||||||
|
if not "%%j" == "" (
|
||||||
|
set IISExpressManifest=%%j
|
||||||
|
)))))
|
||||||
|
|
||||||
|
set IISExpressUserProfileDirectory="%PersonalDocumentFolder%\IISExpress\config"
|
||||||
|
|
||||||
|
@rem ---------------------------------------------
|
||||||
|
|
||||||
|
@rem ---------------------------------------------
|
||||||
|
|
||||||
|
goto :eof
|
||||||
|
|
||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
@rem CheckParameterFile -- check if the package's setparamters.xml exists or not
|
||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
:CheckParameterFile
|
||||||
|
if exist "%_DeploySetParametersFile%" (
|
||||||
|
echo SetParameters from:
|
||||||
|
echo "%_DeploySetParametersFile%"
|
||||||
|
echo You can change IIS Application Name, Physical path, connectionString
|
||||||
|
echo or other deploy parameters in the above file.
|
||||||
|
) else (
|
||||||
|
echo SetParamterFiles does not exist in package location.
|
||||||
|
echo Use package embedded defaultValue to deploy.
|
||||||
|
)
|
||||||
|
echo -------------------------------------------------------
|
||||||
|
goto :eof
|
||||||
|
|
||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
@rem Usage
|
||||||
|
@rem ---------------------------------------------------------------------------------
|
||||||
|
:usage
|
||||||
|
echo =========================================================
|
||||||
|
if not exist "%RootPath%medica-info.deploy-readme.txt" (
|
||||||
|
echo Usage:%~nx0 [/T^|/Y] [/M:ComputerName] [/U:userName] [/P:password] [/G:tempAgent] [additional msdeploy flags ...]
|
||||||
|
echo Required flags:
|
||||||
|
echo /T Calls msdeploy.exe with the "-whatif" flag, which simulates deployment.
|
||||||
|
echo /Y Calls msdeploy.exe without the "-whatif" flag, which deploys the package to the current machine or destination server
|
||||||
|
echo Optional flags:
|
||||||
|
echo. By Default, this script deploy to the current machine where this script is invoked which will use current user credential without tempAgent.
|
||||||
|
echo. Only pass these arguments when in advance scenario.
|
||||||
|
echo /M: Msdeploy destination name of remote computer or proxy-URL. Default is local.
|
||||||
|
echo /U: Msdeploy destination user name.
|
||||||
|
echo /P: Msdeploy destination password.
|
||||||
|
echo /G: Msdeploy destination tempAgent. True or False. Default is false.
|
||||||
|
echo /A: specifies the type of authentication to be used. The possible values are NTLM and Basic. If the wmsvc provider setting is specified, the default authentication type is Basic
|
||||||
|
otherwise, the default authentication type is NTLM.
|
||||||
|
echo /L: Deploy to Local IISExpress User Instance.
|
||||||
|
|
||||||
|
echo.[additional msdeploy flags]: note: " is required for passing = through command line.
|
||||||
|
echo "-skip:objectName=setAcl" "-skip:objectName=dbFullSql"
|
||||||
|
echo.Alternative environment variable _MsDeployAdditionalFlags is also honored.
|
||||||
|
echo.
|
||||||
|
echo. Please make sure MSDeploy is installed in the box https://go.microsoft.com/?linkid=9278654
|
||||||
|
echo.
|
||||||
|
echo In addition, you can change IIS Application Name, Physical path,
|
||||||
|
echo connectionString and other deploy parameters in the following file:
|
||||||
|
echo "%_DeploySetParametersFile%"
|
||||||
|
echo.
|
||||||
|
echo For more information about this batch file, visit https://go.microsoft.com/fwlink/?LinkID=183544
|
||||||
|
) else (
|
||||||
|
start notepad "%RootPath%medica-info.deploy-readme.txt"
|
||||||
|
)
|
||||||
|
echo =========================================================
|
||||||
|
goto :eof
|
||||||
Binary file not shown.
@@ -7,6 +7,9 @@
|
|||||||
|
|
||||||
<main>
|
<main>
|
||||||
<div class="top-row px-4">
|
<div class="top-row px-4">
|
||||||
|
<a href="/docgpt2" target="_blank">ТЕСТ</a>
|
||||||
|
<a href="/rkl" target="_blank">РКЛ</a>
|
||||||
|
|
||||||
<a href="https://medica-nsk.clinic" target="_blank">О нас</a>
|
<a href="https://medica-nsk.clinic" target="_blank">О нас</a>
|
||||||
</div>
|
</div>
|
||||||
<article class="content px-4">
|
<article class="content px-4">
|
||||||
|
|||||||
@@ -21,7 +21,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="nav-item px-3">
|
<div class="nav-item px-3">
|
||||||
<NavLink class="nav-link" href="uslugi">
|
<NavLink class="nav-link" href="uslugi">
|
||||||
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> Услугии
|
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> Услуги
|
||||||
|
</NavLink>
|
||||||
|
</div>
|
||||||
|
<div class="nav-item px-3">
|
||||||
|
<NavLink class="nav-link" href="docgpt">
|
||||||
|
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> Чат DoctorAI
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
@@ -13,7 +13,8 @@
|
|||||||
|
|
||||||
<InputText @onkeydown="HandleKeyPress" @bind-Value="lekInput" />
|
<InputText @onkeydown="HandleKeyPress" @bind-Value="lekInput" />
|
||||||
<InputSelect @bind-Value="otdValue">
|
<InputSelect @bind-Value="otdValue">
|
||||||
<option value="">***Аптека НСК***</option>
|
<option value="">Все</option>
|
||||||
|
<option value="***Аптека НСК***">***Аптека НСК***</option>
|
||||||
<option value="НСК_Поликлиника">НСК_Поликлиника</option>
|
<option value="НСК_Поликлиника">НСК_Поликлиника</option>
|
||||||
<option value="НСК_Стационар">НСК_Стационар</option>
|
<option value="НСК_Стационар">НСК_Стационар</option>
|
||||||
<option value="НСК_Реанимация">НСК_Реанимация</option>
|
<option value="НСК_Реанимация">НСК_Реанимация</option>
|
||||||
@@ -96,7 +97,7 @@ else
|
|||||||
|
|
||||||
private async Task LoadAndFilterAptekaAsync(string? filter, string? filterOTD)
|
private async Task LoadAndFilterAptekaAsync(string? filter, string? filterOTD)
|
||||||
{
|
{
|
||||||
// string file = @"\\192.168.232.33\medica.info\Apteka\price.xml";
|
// string file = @"/Medica/Apteka/price.xml";
|
||||||
string file = @"/app/Data/Apteka/price.xml";
|
string file = @"/app/Data/Apteka/price.xml";
|
||||||
XmlDocument xml = new XmlDocument();
|
XmlDocument xml = new XmlDocument();
|
||||||
xml.Load(file);
|
xml.Load(file);
|
||||||
|
|||||||
@@ -0,0 +1,155 @@
|
|||||||
|
@page "/docgpt"
|
||||||
|
@using System.Net.Http.Json
|
||||||
|
@using System.IO
|
||||||
|
@using System.Text
|
||||||
|
@using System.Text.Json
|
||||||
|
@using System.Threading
|
||||||
|
@implements IDisposable
|
||||||
|
@rendermode RenderMode.InteractiveServer
|
||||||
|
@inject IHttpClientFactory HttpClientFactory
|
||||||
|
|
||||||
|
<PageTitle>DoctorAI</PageTitle>
|
||||||
|
|
||||||
|
<h1 class="display-4">DoctorAI</h1>
|
||||||
|
<p class="text-muted">Я работаю локально, это значит, что я могу работать с конфиденциальной информацией.</p>
|
||||||
|
|
||||||
|
<div class="container mt-4">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="userInput" class="form-label">Чем могу помочь???</label>
|
||||||
|
<textarea class="form-control" id="userInput" rows="10" @bind="userInput" @bind:event="oninput" placeholder="Введите ваш запрос здесь..."></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button class="btn btn-primary" @onclick="SendMessageToApi" disabled="@isProcessing">
|
||||||
|
@if (isProcessing)
|
||||||
|
{
|
||||||
|
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||||
|
<span class="ms-2">Обработка...</span>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<span class="ms-2">Отправить запрос</span>
|
||||||
|
}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
@if (isProcessing)
|
||||||
|
{
|
||||||
|
<button class="btn btn-outline-secondary ms-2" @onclick="CancelRequest">Отменить</button>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (!string.IsNullOrEmpty(result))
|
||||||
|
{
|
||||||
|
<div class="mt-4">
|
||||||
|
<h3 class="text-success">Ответ:</h3>
|
||||||
|
<div class="p-3 border bg-light" style="white-space: pre-wrap; min-height: 100px; border-radius: 5px;">@result</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private string? userInput;
|
||||||
|
private string? result;
|
||||||
|
private bool isProcessing = false;
|
||||||
|
private CancellationTokenSource? cts;
|
||||||
|
|
||||||
|
public class DocRequest
|
||||||
|
{
|
||||||
|
public string model { get; set; } = string.Empty;
|
||||||
|
public string input { get; set; } = string.Empty;
|
||||||
|
public bool stream { get; set; } = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task SendMessageToApi()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(userInput))
|
||||||
|
{
|
||||||
|
result = "Пожалуйста, введите текст.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
isProcessing = true;
|
||||||
|
result = "";
|
||||||
|
|
||||||
|
// Дополнительный лимит на уровне запроса (10 минут), даже если клиент настроен иначе.
|
||||||
|
cts = new CancellationTokenSource(TimeSpan.FromMinutes(10));
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var httpClient = HttpClientFactory.CreateClient("DocGPT");
|
||||||
|
|
||||||
|
var requestData = new DocRequest
|
||||||
|
{
|
||||||
|
model = "google/gemma-4-12b-qat",
|
||||||
|
input = userInput,
|
||||||
|
stream = true
|
||||||
|
};
|
||||||
|
|
||||||
|
using var requestMessage = new HttpRequestMessage(HttpMethod.Post, "http://host.docker.internal:1234/api/v1/chat")
|
||||||
|
{
|
||||||
|
Content = JsonContent.Create(requestData)
|
||||||
|
};
|
||||||
|
|
||||||
|
// ResponseHeadersRead — чтобы получать чанки по мере поступления, а не после буферизации всего ответа.
|
||||||
|
using var response = await httpClient.SendAsync(
|
||||||
|
requestMessage,
|
||||||
|
HttpCompletionOption.ResponseHeadersRead,
|
||||||
|
cts.Token);
|
||||||
|
|
||||||
|
if (response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
using var stream = await response.Content.ReadAsStreamAsync(cts.Token);
|
||||||
|
using var reader = new StreamReader(stream);
|
||||||
|
|
||||||
|
while (!reader.EndOfStream)
|
||||||
|
{
|
||||||
|
var line = await reader.ReadLineAsync(cts.Token);
|
||||||
|
if (string.IsNullOrEmpty(line)) continue;
|
||||||
|
|
||||||
|
if (line.Contains("message.delta"))
|
||||||
|
{
|
||||||
|
var jsonPart = line.Replace("data: ", "").Trim();
|
||||||
|
|
||||||
|
int contentStart = jsonPart.IndexOf("\"content\":\"") + 11;
|
||||||
|
int contentEnd = jsonPart.IndexOf('"', contentStart);
|
||||||
|
|
||||||
|
if (contentStart > 10 && contentEnd > contentStart)
|
||||||
|
{
|
||||||
|
result += jsonPart.Substring(contentStart, contentEnd - contentStart);
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (line.Contains("message.end")) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = $"Ошибка сервера: {(int)response.StatusCode} {response.ReasonPhrase}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException)
|
||||||
|
{
|
||||||
|
result += "\n[Запрос прерван по таймауту или отменён]";
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
result = $"Ошибка: {ex.Message}";
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
isProcessing = false;
|
||||||
|
cts?.Dispose();
|
||||||
|
cts = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CancelRequest()
|
||||||
|
{
|
||||||
|
cts?.Cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
cts?.Cancel();
|
||||||
|
cts?.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,370 @@
|
|||||||
|
@page "/docgpt2"
|
||||||
|
@using System.Net.Http.Json
|
||||||
|
@using System.Text
|
||||||
|
@using System.Text.Json
|
||||||
|
@using System.Threading
|
||||||
|
@using Microsoft.AspNetCore.Components.Forms
|
||||||
|
@using DocumentFormat.OpenXml.Packaging
|
||||||
|
@using DocumentFormat.OpenXml.Wordprocessing
|
||||||
|
@using UglyToad.PdfPig
|
||||||
|
@implements IDisposable
|
||||||
|
@rendermode RenderMode.InteractiveServer
|
||||||
|
@inject IHttpClientFactory HttpClientFactory
|
||||||
|
|
||||||
|
<PageTitle>DoctorAI</PageTitle>
|
||||||
|
|
||||||
|
<h1 class="display-4">DoctorAI</h1>
|
||||||
|
<p class="text-muted">Я работаю локально, это значит, что я могу работать с конфиденциальной информацией.</p>
|
||||||
|
|
||||||
|
<div class="container mt-4">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="userInput" class="form-label">Чем могу помочь???</label>
|
||||||
|
<textarea class="form-control" id="userInput" rows="10" @bind="userInput" @bind:event="oninput" placeholder="Введите ваш запрос здесь..."></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Изображение (необязательно)</label>
|
||||||
|
<InputFile OnChange="OnImageSelected" class="form-control" accept=".jpg,.jpeg,.png,.webp" />
|
||||||
|
@if (!string.IsNullOrEmpty(imageFileName))
|
||||||
|
{
|
||||||
|
<div class="form-text">
|
||||||
|
Выбрано: @imageFileName
|
||||||
|
<button type="button" class="btn btn-sm btn-link p-0 ms-2" @onclick="ClearImage">убрать</button>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (imageError is not null)
|
||||||
|
{
|
||||||
|
<div class="text-danger small">@imageError</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Документ PDF или DOCX (необязательно)</label>
|
||||||
|
<InputFile OnChange="OnDocumentSelected" class="form-control" accept=".pdf,.docx" />
|
||||||
|
@if (!string.IsNullOrEmpty(documentFileName))
|
||||||
|
{
|
||||||
|
<div class="form-text">
|
||||||
|
Выбрано: @documentFileName (@documentCharCount символов извлечено)
|
||||||
|
<button type="button" class="btn btn-sm btn-link p-0 ms-2" @onclick="ClearDocument">убрать</button>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (documentError is not null)
|
||||||
|
{
|
||||||
|
<div class="text-danger small">@documentError</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button class="btn btn-primary" @onclick="SendMessageToApi" disabled="@isProcessing">
|
||||||
|
@if (isProcessing)
|
||||||
|
{
|
||||||
|
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
||||||
|
<span class="ms-2">Обработка...</span>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<span class="ms-2">Отправить запрос</span>
|
||||||
|
}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
@if (isProcessing)
|
||||||
|
{
|
||||||
|
<button class="btn btn-outline-secondary ms-2" @onclick="CancelRequest">Отменить</button>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (!string.IsNullOrEmpty(result))
|
||||||
|
{
|
||||||
|
<div class="mt-4">
|
||||||
|
<h3 class="text-success">Ответ:</h3>
|
||||||
|
<div class="p-3 border bg-light" style="white-space: pre-wrap; min-height: 100px; border-radius: 5px;">@result</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private string? userInput;
|
||||||
|
private string? result;
|
||||||
|
private bool isProcessing = false;
|
||||||
|
private CancellationTokenSource? cts;
|
||||||
|
|
||||||
|
// --- Изображение ---
|
||||||
|
private string? imageDataUrl;
|
||||||
|
private string? imageFileName;
|
||||||
|
private string? imageError;
|
||||||
|
private const long MaxImageBytes = 10 * 1024 * 1024; // 10 МБ
|
||||||
|
|
||||||
|
// --- Документ (PDF/DOCX) ---
|
||||||
|
private string? documentText;
|
||||||
|
private string? documentFileName;
|
||||||
|
private string? documentError;
|
||||||
|
private int documentCharCount;
|
||||||
|
private const long MaxDocumentBytes = 25 * 1024 * 1024; // 25 МБ
|
||||||
|
private const int MaxDocumentChars = 60_000; // защита от переполнения контекста модели
|
||||||
|
|
||||||
|
private class ChatEvent
|
||||||
|
{
|
||||||
|
public string type { get; set; } = "";
|
||||||
|
public string? content { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnImageSelected(InputFileChangeEventArgs e)
|
||||||
|
{
|
||||||
|
imageError = null;
|
||||||
|
var file = e.File;
|
||||||
|
if (file is null) return;
|
||||||
|
|
||||||
|
if (file.Size > MaxImageBytes)
|
||||||
|
{
|
||||||
|
imageError = "Файл слишком большой (максимум 10 МБ).";
|
||||||
|
imageDataUrl = null;
|
||||||
|
imageFileName = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var stream = file.OpenReadStream(MaxImageBytes);
|
||||||
|
using var ms = new MemoryStream();
|
||||||
|
await stream.CopyToAsync(ms);
|
||||||
|
|
||||||
|
var base64 = Convert.ToBase64String(ms.ToArray());
|
||||||
|
var mimeType = string.IsNullOrEmpty(file.ContentType) ? "image/png" : file.ContentType;
|
||||||
|
|
||||||
|
imageDataUrl = $"data:{mimeType};base64,{base64}";
|
||||||
|
imageFileName = file.Name;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
imageError = $"Не удалось прочитать файл: {ex.Message}";
|
||||||
|
imageDataUrl = null;
|
||||||
|
imageFileName = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ClearImage()
|
||||||
|
{
|
||||||
|
imageDataUrl = null;
|
||||||
|
imageFileName = null;
|
||||||
|
imageError = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnDocumentSelected(InputFileChangeEventArgs e)
|
||||||
|
{
|
||||||
|
documentError = null;
|
||||||
|
var file = e.File;
|
||||||
|
if (file is null) return;
|
||||||
|
|
||||||
|
if (file.Size > MaxDocumentBytes)
|
||||||
|
{
|
||||||
|
documentError = "Файл слишком большой (максимум 25 МБ).";
|
||||||
|
documentText = null;
|
||||||
|
documentFileName = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var stream = file.OpenReadStream(MaxDocumentBytes);
|
||||||
|
using var ms = new MemoryStream();
|
||||||
|
await stream.CopyToAsync(ms);
|
||||||
|
ms.Position = 0;
|
||||||
|
|
||||||
|
var extension = Path.GetExtension(file.Name).ToLowerInvariant();
|
||||||
|
|
||||||
|
string extracted = extension switch
|
||||||
|
{
|
||||||
|
".pdf" => ExtractTextFromPdf(ms),
|
||||||
|
".docx" => ExtractTextFromDocx(ms),
|
||||||
|
_ => throw new NotSupportedException($"Формат {extension} не поддерживается.")
|
||||||
|
};
|
||||||
|
|
||||||
|
if (extracted.Length > MaxDocumentChars)
|
||||||
|
{
|
||||||
|
extracted = extracted[..MaxDocumentChars] + "\n\n[...текст обрезан, документ слишком длинный...]";
|
||||||
|
}
|
||||||
|
|
||||||
|
documentText = extracted;
|
||||||
|
documentFileName = file.Name;
|
||||||
|
documentCharCount = extracted.Length;
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(extracted))
|
||||||
|
{
|
||||||
|
documentError = "Текст не найден — возможно, это отсканированный PDF без текстового слоя.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
documentError = $"Не удалось обработать документ: {ex.Message}";
|
||||||
|
documentText = null;
|
||||||
|
documentFileName = null;
|
||||||
|
documentCharCount = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ClearDocument()
|
||||||
|
{
|
||||||
|
documentText = null;
|
||||||
|
documentFileName = null;
|
||||||
|
documentError = null;
|
||||||
|
documentCharCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string ExtractTextFromPdf(Stream stream)
|
||||||
|
{
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
using var pdf = PdfDocument.Open(stream);
|
||||||
|
|
||||||
|
foreach (var page in pdf.GetPages())
|
||||||
|
{
|
||||||
|
sb.AppendLine(page.Text);
|
||||||
|
sb.AppendLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.ToString().Trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string ExtractTextFromDocx(Stream stream)
|
||||||
|
{
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
using var doc = WordprocessingDocument.Open(stream, false);
|
||||||
|
|
||||||
|
var body = doc.MainDocumentPart?.Document?.Body;
|
||||||
|
if (body is null) return "";
|
||||||
|
|
||||||
|
foreach (var paragraph in body.Elements<Paragraph>())
|
||||||
|
{
|
||||||
|
sb.AppendLine(paragraph.InnerText);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Таблицы — отдельно, InnerText у Body таблицы не включает построчно без этого прохода
|
||||||
|
foreach (var table in body.Elements<Table>())
|
||||||
|
{
|
||||||
|
foreach (var row in table.Elements<TableRow>())
|
||||||
|
{
|
||||||
|
var cells = row.Elements<TableCell>().Select(c => c.InnerText);
|
||||||
|
sb.AppendLine(string.Join(" | ", cells));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.ToString().Trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task SendMessageToApi()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(userInput))
|
||||||
|
{
|
||||||
|
result = "Пожалуйста, введите текст.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
isProcessing = true;
|
||||||
|
result = "";
|
||||||
|
cts = new CancellationTokenSource(TimeSpan.FromMinutes(10));
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var httpClient = HttpClientFactory.CreateClient("DocGPT");
|
||||||
|
|
||||||
|
// Собираем текстовое содержимое: вопрос пользователя + текст документа (если есть)
|
||||||
|
var textContent = userInput;
|
||||||
|
if (!string.IsNullOrWhiteSpace(documentText))
|
||||||
|
{
|
||||||
|
textContent = $"{userInput}\n\n--- Содержимое документа \"{documentFileName}\" ---\n{documentText}";
|
||||||
|
}
|
||||||
|
|
||||||
|
var inputItems = new List<object>
|
||||||
|
{
|
||||||
|
new { type = "message", content = textContent }
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(imageDataUrl))
|
||||||
|
{
|
||||||
|
inputItems.Add(new { type = "image", data_url = imageDataUrl });
|
||||||
|
}
|
||||||
|
|
||||||
|
var requestBody = new
|
||||||
|
{
|
||||||
|
model = "google/gemma-4-12b-qat",
|
||||||
|
input = inputItems,
|
||||||
|
stream = true
|
||||||
|
};
|
||||||
|
|
||||||
|
using var requestMessage = new HttpRequestMessage(HttpMethod.Post, "http://host.docker.internal:1234/api/v1/chat")
|
||||||
|
{
|
||||||
|
Content = JsonContent.Create(requestBody)
|
||||||
|
};
|
||||||
|
|
||||||
|
using var response = await httpClient.SendAsync(
|
||||||
|
requestMessage,
|
||||||
|
HttpCompletionOption.ResponseHeadersRead,
|
||||||
|
cts.Token);
|
||||||
|
|
||||||
|
if (!response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
var errorBody = await response.Content.ReadAsStringAsync(cts.Token);
|
||||||
|
result = $"Ошибка сервера: {(int)response.StatusCode} {response.ReasonPhrase}\n{errorBody}";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using var stream = await response.Content.ReadAsStreamAsync(cts.Token);
|
||||||
|
using var reader = new StreamReader(stream);
|
||||||
|
|
||||||
|
while (!reader.EndOfStream)
|
||||||
|
{
|
||||||
|
var line = await reader.ReadLineAsync(cts.Token);
|
||||||
|
if (string.IsNullOrWhiteSpace(line)) continue;
|
||||||
|
if (!line.StartsWith("data:")) continue;
|
||||||
|
|
||||||
|
var jsonPart = line["data:".Length..].Trim();
|
||||||
|
if (jsonPart.Length == 0) continue;
|
||||||
|
|
||||||
|
ChatEvent? evt;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
evt = JsonSerializer.Deserialize<ChatEvent>(jsonPart);
|
||||||
|
}
|
||||||
|
catch (JsonException)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (evt is null) continue;
|
||||||
|
|
||||||
|
if (evt.type == "message.delta")
|
||||||
|
{
|
||||||
|
result += evt.content;
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
else if (evt.type == "error")
|
||||||
|
{
|
||||||
|
result += $"\n[Ошибка модели: {jsonPart}]";
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException)
|
||||||
|
{
|
||||||
|
result += "\n[Запрос прерван по таймауту или отменён]";
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
result = $"Ошибка: {ex.Message}";
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
isProcessing = false;
|
||||||
|
cts?.Dispose();
|
||||||
|
cts = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CancelRequest()
|
||||||
|
{
|
||||||
|
cts?.Cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
cts?.Cancel();
|
||||||
|
cts?.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
@page "/rkl"
|
||||||
|
@using System.Net.Http.Json
|
||||||
|
@using System.Threading.Tasks
|
||||||
|
@inject HttpClient Http
|
||||||
|
@rendermode RenderMode.InteractiveServer
|
||||||
|
|
||||||
|
<PageTitle>RLK - Запрос данных</PageTitle>
|
||||||
|
|
||||||
|
<h2 class="mb-4">Запрос данных по документу</h2>
|
||||||
|
|
||||||
|
<div class="card p-4 shadow-sm">
|
||||||
|
<EditForm Model="@requestModel" OnValidSubmit="HandleSubmit" class="row g-3">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label">ФИО</label>
|
||||||
|
<InputText @bind-Value="requestModel.Fio" class="form-control" placeholder="Введите ФИО" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label">Номер документа</label>
|
||||||
|
<InputText @bind-Value="requestModel.DocNum" class="form-control" placeholder="Например: 40175861" />
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label">Дата рождения</label>
|
||||||
|
<InputDate @bind-Value="requestModel.BirthDate" class="form-control" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label">Дата выдачи документа</label>
|
||||||
|
<InputDate @bind-Value="requestModel.DocDate" class="form-control" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-12">
|
||||||
|
<button type="submit" class="btn btn-primary">Отправить запрос</button>
|
||||||
|
</div>
|
||||||
|
</EditForm>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (!string.IsNullOrEmpty(responseMessage))
|
||||||
|
{
|
||||||
|
<div class="mt-4">
|
||||||
|
<div class="alert alert-info">
|
||||||
|
<strong class="d-block">Результат (@requestDate.ToString("dd.MM.yyyy HH:mm:ss")):</strong>
|
||||||
|
@responseMessage
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (!string.IsNullOrEmpty(rawResponse))
|
||||||
|
{
|
||||||
|
<div class="mt-3">
|
||||||
|
<label class="form-label">Ответ:</label>
|
||||||
|
<pre class="bg-light p-3 border rounded" style="max-height: 400px; overflow: auto; font-size: 0.85rem;">@rawResponse</pre>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@code {
|
||||||
|
private RequestModel requestModel = new();
|
||||||
|
private string responseMessage = "";
|
||||||
|
private string rawResponse = ""; // Переменная для хранения сырого контента
|
||||||
|
private DateTime requestDate = DateTime.MinValue;
|
||||||
|
|
||||||
|
private const string FixedToken = "f2d3394efba501f7e78f4f8d3a1b2e42";
|
||||||
|
private const string FixedType = "rkl";
|
||||||
|
|
||||||
|
private async Task HandleSubmit()
|
||||||
|
{
|
||||||
|
requestDate = DateTime.Now;
|
||||||
|
responseMessage = "Отправка запроса...";
|
||||||
|
rawResponse = ""; // Очищаем старый ответ перед новым запросом
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var url = $"https://api-cloud.ru/api/mvd.php?" +
|
||||||
|
$"type={FixedType}&" +
|
||||||
|
$"fio={Uri.EscapeDataString(requestModel.Fio)}&" +
|
||||||
|
$"docnum={requestModel.DocNum}&" +
|
||||||
|
$"docdate={requestModel.DocDate:dd.MM.yyyy}&" +
|
||||||
|
$"birthdate={requestModel.BirthDate:dd.MM.yyyy}&" +
|
||||||
|
$"token={FixedToken}";
|
||||||
|
|
||||||
|
var result = await Http.GetAsync(url);
|
||||||
|
|
||||||
|
// Получаем содержимое ответа как строку
|
||||||
|
rawResponse = await result.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
if (result.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
responseMessage = "Запрос успешно отправлен. Ответ получен.";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
responseMessage = $"Ошибка сервера: {result.StatusCode} ({result.ReasonPhrase})";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
responseMessage = $"Произошла ошибка: {ex.Message}";
|
||||||
|
rawResponse = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RequestModel
|
||||||
|
{
|
||||||
|
public string Fio { get; set; } = "";
|
||||||
|
public string DocNum { get; set; } = "";
|
||||||
|
public DateTime DocDate { get; set; } = DateTime.Now;
|
||||||
|
public DateTime BirthDate { get; set; } = DateTime.Now;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
<button class="btn btn-primary" @onclick="OnSearchClicked">Поиск</button>
|
<button class="btn btn-primary" @onclick="OnSearchClicked">Поиск</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if (apteka == null || apteka.Count == 0)
|
@if (uslugi == null || uslugi.Count == 0)
|
||||||
{
|
{
|
||||||
<p><em>Данные не найдены или загружаются...</em></p>
|
<p><em>Данные не найдены или загружаются...</em></p>
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@ else
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach (var item in apteka)
|
@foreach (var item in uslugi)
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td>@item.code</td>
|
<td>@item.code</td>
|
||||||
@@ -48,7 +48,7 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private List<UslugiFore> apteka = new List<UslugiFore>();
|
private List<UslugiFore> uslugi = new List<UslugiFore>();
|
||||||
private string data { set; get; } = string.Empty;
|
private string data { set; get; } = string.Empty;
|
||||||
private string UslugiInput { set; get; } = string.Empty;
|
private string UslugiInput { set; get; } = string.Empty;
|
||||||
|
|
||||||
@@ -75,12 +75,12 @@ else
|
|||||||
|
|
||||||
private async Task LoadAndFilterUslugiAsync(string? filter)
|
private async Task LoadAndFilterUslugiAsync(string? filter)
|
||||||
{
|
{
|
||||||
// string file = @"\\192.168.232.33\medica.info\Apteka\price.xml";
|
// string file = @"/Medica/PriceNSK/price.xml";
|
||||||
string file = @"/app/Data/PriceNSK/price.xml";
|
string file = @"/app/Data/PriceNSK/price.xml";
|
||||||
XmlDocument xml = new XmlDocument();
|
XmlDocument xml = new XmlDocument();
|
||||||
xml.Load(file);
|
xml.Load(file);
|
||||||
XmlElement? root = xml.DocumentElement;
|
XmlElement? root = xml.DocumentElement;
|
||||||
apteka.Clear();
|
uslugi.Clear();
|
||||||
if (root != null)
|
if (root != null)
|
||||||
{
|
{
|
||||||
foreach (XmlElement row in root.ChildNodes)
|
foreach (XmlElement row in root.ChildNodes)
|
||||||
@@ -118,7 +118,7 @@ else
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
apteka.Add(item);
|
uslugi.Add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace medica_info.DB
|
||||||
|
{
|
||||||
|
public class ApplicationDbContext
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
namespace medica_info.DB
|
||||||
|
{
|
||||||
|
public class rkl_request
|
||||||
|
{
|
||||||
|
public int Id { set; get; }
|
||||||
|
public string Fio { set; get; } = string.Empty;
|
||||||
|
public DateTime Bdate { set; get; }
|
||||||
|
public int NumDocum { set; get; }
|
||||||
|
public DateTime DateDocum { set; get; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace medica_info.DB
|
||||||
|
{
|
||||||
|
public class rkl_respons
|
||||||
|
{
|
||||||
|
public int Id { set; get; }
|
||||||
|
public bool Found { set; get; }
|
||||||
|
public DateTime dateTime { set; get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,6 +13,11 @@ builder.Services.AddRazorComponents()
|
|||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
builder.Services.AddRazorComponents();
|
builder.Services.AddRazorComponents();
|
||||||
|
builder.Services.AddHttpClient("DocGPT", c =>
|
||||||
|
{
|
||||||
|
// c.BaseAddress = new Uri("http://host.docker.internal:1234/");
|
||||||
|
c.Timeout = TimeSpan.FromMinutes(10); // Устанавливаем лимит 10 минут вместо 100 секунд
|
||||||
|
});
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
|
|||||||
@@ -5,5 +5,8 @@
|
|||||||
"Microsoft.AspNetCore": "Warning"
|
"Microsoft.AspNetCore": "Warning"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*",
|
||||||
}
|
"ConnectionStrings": {
|
||||||
|
"DefaultConnection": "Server=192.168.232.100\\MEDICA_SQL;Database=MedicaMVD;User Id=rkl_user;Password=medica@n5k;TrustServerCertificate=False;"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"isRoot": true,
|
||||||
|
"tools": {
|
||||||
|
"dotnet-ef": {
|
||||||
|
"version": "10.0.9",
|
||||||
|
"commands": [
|
||||||
|
"dotnet-ef"
|
||||||
|
],
|
||||||
|
"rollForward": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,9 +12,10 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="DocumentFormat.OpenXml" Version="3.5.1" />
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.23.0" />
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.23.0" />
|
||||||
|
<PackageReference Include="PdfPig" Version="0.1.15" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Components\Serv\" />
|
<Folder Include="Components\Serv\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
Reference in new issue
Block a user