Skip to content

Commit

Permalink
フォームウィンドウが多重化してしまう問題の修正
Browse files Browse the repository at this point in the history
  • Loading branch information
komiyamma committed May 9, 2024
1 parent d10c09f commit ec7f85e
Show file tree
Hide file tree
Showing 27 changed files with 101 additions and 57 deletions.
Binary file not shown.
Binary file not shown.
Binary file modified src/.vs/HmChatGPT35Turbo/v17/.futdcache.v2
Binary file not shown.
Binary file modified src/.vs/HmChatGPT35Turbo/v17/.suo
Binary file not shown.
64 changes: 37 additions & 27 deletions src/.vs/HmChatGPT35Turbo/v17/DocumentLayout.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
"AbsoluteMoniker": "D:0:0:{55774E11-538A-4560-8B0C-BAA17E75C622}|HmChatGPT35Turbo\\HmChatGPT35Turbo.csproj|g:\\repogitory\\hm_openai_chatgpt35_turbo\\src\\hmchatgpt35turbo\\hmchatgpt35turbo.csproj||{04B8AB82-A572-4FEF-95CE-5222444B6B64}|",
"RelativeMoniker": "D:0:0:{55774E11-538A-4560-8B0C-BAA17E75C622}|HmChatGPT35Turbo\\HmChatGPT35Turbo.csproj|solutionrelative:hmchatgpt35turbo\\hmchatgpt35turbo.csproj||{04B8AB82-A572-4FEF-95CE-5222444B6B64}|"
},
{
"AbsoluteMoniker": "D:0:0:{55774E11-538A-4560-8B0C-BAA17E75C622}|HmChatGPT35Turbo\\HmChatGPT35Turbo.csproj|g:\\repogitory\\hm_openai_chatgpt35_turbo\\src\\hmchatgpt35turbo\\winformcominterface.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{55774E11-538A-4560-8B0C-BAA17E75C622}|HmChatGPT35Turbo\\HmChatGPT35Turbo.csproj|solutionrelative:hmchatgpt35turbo\\winformcominterface.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{55774E11-538A-4560-8B0C-BAA17E75C622}|HmChatGPT35Turbo\\HmChatGPT35Turbo.csproj|g:\\repogitory\\hm_openai_chatgpt35_turbo\\src\\hmchatgpt35turbo\\openaichat.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{55774E11-538A-4560-8B0C-BAA17E75C622}|HmChatGPT35Turbo\\HmChatGPT35Turbo.csproj|solutionrelative:hmchatgpt35turbo\\openaichat.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
Expand Down Expand Up @@ -42,8 +46,25 @@
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 0,
"SelectedChildIndex": 2,
"Children": [
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "WinFormCOMInterface.cs",
"DocumentMoniker": "G:\\repogitory\\hm_openai_chatgpt35_turbo\\src\\HmChatGPT35Turbo\\WinFormCOMInterface.cs",
"RelativeDocumentMoniker": "HmChatGPT35Turbo\\WinFormCOMInterface.cs",
"ToolTip": "G:\\repogitory\\hm_openai_chatgpt35_turbo\\src\\HmChatGPT35Turbo\\WinFormCOMInterface.cs",
"RelativeToolTip": "HmChatGPT35Turbo\\WinFormCOMInterface.cs",
"ViewState": "AQIAAEIAAAAAAAAAAAAIwEkAAAANAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-05-09T15:53:27.437Z",
"EditorCaption": ""
},
{
"$type": "Bookmark",
"Name": "ST:0:0:{a80febb4-e7e0-4147-b476-21aaf2453969}"
},
{
"$type": "Document",
"DocumentIndex": 0,
Expand All @@ -58,98 +79,87 @@
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "HmChatGPT35Turbo",
"DocumentIndex": 3,
"Title": "HmChatGPT35Turbo.csproj",
"DocumentMoniker": "G:\\repogitory\\hm_openai_chatgpt35_turbo\\src\\HmChatGPT35Turbo\\HmChatGPT35Turbo.csproj",
"RelativeDocumentMoniker": "HmChatGPT35Turbo\\HmChatGPT35Turbo.csproj",
"ToolTip": "G:\\repogitory\\hm_openai_chatgpt35_turbo\\src\\HmChatGPT35Turbo\\HmChatGPT35Turbo.csproj",
"RelativeToolTip": "HmChatGPT35Turbo\\HmChatGPT35Turbo.csproj",
"ViewState": "AQIAAAAAAAAAAAAAAADwvwAAAAAAAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000758|",
"WhenOpened": "2024-03-29T13:20:17.96Z",
"EditorCaption": ""
},
{
"$type": "Bookmark",
"Name": "ST:0:0:{a80febb4-e7e0-4147-b476-21aaf2453969}"
"WhenOpened": "2024-03-29T13:20:17.96Z"
},
{
"$type": "Document",
"DocumentIndex": 4,
"DocumentIndex": 5,
"Title": "IOutputWriter.cs",
"DocumentMoniker": "G:\\repogitory\\hm_openai_chatgpt35_turbo\\src\\HmChatGPT35Turbo\\IOutputWriter.cs",
"RelativeDocumentMoniker": "HmChatGPT35Turbo\\IOutputWriter.cs",
"ToolTip": "G:\\repogitory\\hm_openai_chatgpt35_turbo\\src\\HmChatGPT35Turbo\\IOutputWriter.cs",
"RelativeToolTip": "HmChatGPT35Turbo\\IOutputWriter.cs",
"ViewState": "AQIAAAAAAAAAAAAAAAA7wAAAAAAAAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-03-07T10:40:04.527Z",
"EditorCaption": ""
"WhenOpened": "2024-03-07T10:40:04.527Z"
},
{
"$type": "Document",
"DocumentIndex": 5,
"DocumentIndex": 6,
"Title": "IInputReader.cs",
"DocumentMoniker": "G:\\repogitory\\hm_openai_chatgpt35_turbo\\src\\HmChatGPT35Turbo\\IInputReader.cs",
"RelativeDocumentMoniker": "HmChatGPT35Turbo\\IInputReader.cs",
"ToolTip": "G:\\repogitory\\hm_openai_chatgpt35_turbo\\src\\HmChatGPT35Turbo\\IInputReader.cs",
"RelativeToolTip": "HmChatGPT35Turbo\\IInputReader.cs",
"ViewState": "AQIAAAAAAAAAAAAAAAA7wAAAAAAAAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-03-07T10:40:02.708Z",
"EditorCaption": ""
"WhenOpened": "2024-03-07T10:40:02.708Z"
},
{
"$type": "Document",
"DocumentIndex": 1,
"DocumentIndex": 2,
"Title": "OpenAIChat.cs",
"DocumentMoniker": "G:\\repogitory\\hm_openai_chatgpt35_turbo\\src\\HmChatGPT35Turbo\\OpenAIChat.cs",
"RelativeDocumentMoniker": "HmChatGPT35Turbo\\OpenAIChat.cs",
"ToolTip": "G:\\repogitory\\hm_openai_chatgpt35_turbo\\src\\HmChatGPT35Turbo\\OpenAIChat.cs",
"RelativeToolTip": "HmChatGPT35Turbo\\OpenAIChat.cs",
"ViewState": "AQIAAHwAAAAAAAAAAAAhwJEAAABvAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-03-06T10:50:12.483Z",
"EditorCaption": ""
"WhenOpened": "2024-03-06T10:50:12.483Z"
},
{
"$type": "Document",
"DocumentIndex": 3,
"DocumentIndex": 4,
"Title": "HmOutputWriter.cs",
"DocumentMoniker": "G:\\repogitory\\hm_openai_chatgpt35_turbo\\src\\HmChatGPT35Turbo\\HmOutputWriter.cs",
"RelativeDocumentMoniker": "HmChatGPT35Turbo\\HmOutputWriter.cs",
"ToolTip": "G:\\repogitory\\hm_openai_chatgpt35_turbo\\src\\HmChatGPT35Turbo\\HmOutputWriter.cs",
"RelativeToolTip": "HmChatGPT35Turbo\\HmOutputWriter.cs",
"ViewState": "AQIAAAMAAAAAAAAAAADwvwAAAAAAAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-03-06T10:49:48.518Z",
"EditorCaption": ""
"WhenOpened": "2024-03-06T10:49:48.518Z"
},
{
"$type": "Document",
"DocumentIndex": 6,
"DocumentIndex": 7,
"Title": "HmInputReader.cs",
"DocumentMoniker": "G:\\repogitory\\hm_openai_chatgpt35_turbo\\src\\HmChatGPT35Turbo\\HmInputReader.cs",
"RelativeDocumentMoniker": "HmChatGPT35Turbo\\HmInputReader.cs",
"ToolTip": "G:\\repogitory\\hm_openai_chatgpt35_turbo\\src\\HmChatGPT35Turbo\\HmInputReader.cs",
"RelativeToolTip": "HmChatGPT35Turbo\\HmInputReader.cs",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-03-06T10:49:42.055Z",
"EditorCaption": ""
"WhenOpened": "2024-03-06T10:49:42.055Z"
},
{
"$type": "Document",
"DocumentIndex": 7,
"DocumentIndex": 8,
"Title": "WinForm.cs",
"DocumentMoniker": "G:\\repogitory\\hm_openai_chatgpt35_turbo\\src\\HmChatGPT35Turbo\\WinForm.cs",
"RelativeDocumentMoniker": "HmChatGPT35Turbo\\WinForm.cs",
"ToolTip": "G:\\repogitory\\hm_openai_chatgpt35_turbo\\src\\HmChatGPT35Turbo\\WinForm.cs",
"RelativeToolTip": "HmChatGPT35Turbo\\WinForm.cs",
"ViewState": "AQIAAAAAAAAAAAAAAADwvwAAAAAAAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-03-06T10:49:34.351Z",
"EditorCaption": ""
"WhenOpened": "2024-03-06T10:49:34.351Z"
}
]
}
Expand Down
Binary file modified src/.vs/ProjectEvaluation/hmchatgpt35turbo.metadata.v7.bin
Binary file not shown.
Binary file modified src/.vs/ProjectEvaluation/hmchatgpt35turbo.projects.v7.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion src/HmChatGPT35Turbo/HmChatGPT35Turbo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<EnableComHosting>true</EnableComHosting>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<PlatformTarget>x86</PlatformTarget>
<PlatformTarget>x64</PlatformTarget>
<BaseOutputPath>bin\$(PlatformTarget)</BaseOutputPath>
<Authors>Akitsugu Komiyama</Authors>
<Copyright>$(Authors)</Copyright>
Expand Down
68 changes: 52 additions & 16 deletions src/HmChatGPT35Turbo/WinFormCOMInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class HmChatGPT35Turbo

HmChatGPT35TurboSharedMemory sm = new HmChatGPT35TurboSharedMemory();

public long CreateForm(string key = "", string model="", int maxtokens = 2000)
public long CreateForm(string key = "", string model = "", int maxtokens = 2000)
{
try
{
Expand Down Expand Up @@ -73,26 +73,49 @@ public void CreateSharedMemory()
try
{
// 新規にメモリマップを作成して、そこに現在の秀丸ハンドルを数値として入れておく
share_mem = MemoryMappedFile.CreateNew("HmChatGPT35TurboSharedMem", 8);
MemoryMappedViewAccessor accessor = share_mem.CreateViewAccessor();
accessor.Write(0, (long)Hm.WindowHandle);
accessor.Dispose();
if (share_mem == null)
{
share_mem = MemoryMappedFile.CreateNew("HmChatGPT35TurboSharedMem", 8);
}
}
catch (Exception e)
{
}

try
{
using (var share_mem = MemoryMappedFile.OpenExisting("HmChatGPT35TurboSharedMem"))
{
if (share_mem != null)
{
using (var accessor = share_mem.CreateViewAccessor())
{
accessor.Write(0, (long)Hm.WindowHandle);
}
}
}
}
catch (Exception e)
{
}
catch (Exception) { }
}

public long GetSharedMemory()
{
long value = 0;
try
{
// (主に)違うプロセスからメモリマップの数値を読み込む
share_mem = MemoryMappedFile.OpenExisting("HmChatGPT35TurboSharedMem");
MemoryMappedViewAccessor accessor = share_mem.CreateViewAccessor();
value = accessor.ReadInt64(0);
accessor.Dispose();
using (var share_mem = MemoryMappedFile.OpenExisting("HmChatGPT35TurboSharedMem"))
{
using (var accessor = share_mem.CreateViewAccessor())
{
value = accessor.ReadInt64(0);
}
}
}
catch (Exception)
{
}
catch (Exception) { }

return value;
}
Expand All @@ -104,14 +127,27 @@ public void DeleteSharedMemory()
if (share_mem != null)
{
// メモリマップを削除。
MemoryMappedViewAccessor accessor = share_mem.CreateViewAccessor();
accessor.Write(0, (long)0);
accessor.Dispose();
using (var accessor = share_mem.CreateViewAccessor())
{
accessor.Write(0, (long)0);
}
}
}
catch (Exception)
{
}

try
{
if (share_mem != null)
{
share_mem.Dispose();
share_mem = null;
}
}
catch (Exception) { }
catch (Exception)
{
}
}


Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ SET_OPENAI_KEY:
// モデルの指定
SET_MODEL:

$MODEL = "gpt-3.5-turbo"; // あなたのOpenAIアカウント内のAPIで、gpt-4 以上が使えるならば、"gpt-4"などの設定可能。しかしながら値段が10倍以上に跳ね上がるので注意。
// 最大トークンを大きくしたいなら gpt-3.5-turbo-16k などとすれば4倍になる。この場合は料金は2倍ほどで済むので格安具合をある程度維持できる。
$MODEL = "gpt-3.5-turbo"; // "gpt-4-turbo"などの設定可能。しかしながら値段が15倍以上に跳ね上がるので注意。


SET_MAXTOKENS:
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@ SET_OPENAI_KEY:
// モデルの指定
SET_MODEL:

$MODEL = "gpt-3.5-turbo"; // あなたのOpenAIアカウント内のAPIで、gpt-4 以上が使えるならば、"gpt-4"などの設定可能。しかしながら値段が10倍以上に跳ね上がるので注意。
// 最大トークンを大きくしたいなら gpt-3.5-turbo-16k などとすれば4倍になる。この場合は料金は2倍ほどで済むので格安具合をある程度維持できる。
$MODEL = "gpt-3.5-turbo"; // "gpt-4-turbo"などの設定可能。しかしながら値段が15倍以上に跳ね上がるので注意。


SET_MAXTOKENS:

#MAXTOKENS = 4000; // この数値は概ね 使用対象のmodelの最大トークンの半分程度を使用するのが望ましい。
// 「gpt-3.5-turbo なら 2000」「gpt-4 なら 4000」、「gpt-4-32k なら 16000」といった具合。
// 「gpt-3.5-turbo なら 2000」「gpt-4-turbo なら 4000」が目安


SET_TOPMOST_TYPE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyCopyrightAttribute("Akitsugu Komiyama")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.7.3")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.7.3+395563fea4ad6007f6a9b74bac5b0f9382e4b21a")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.7.3+d10c09f6ba523a7b1248d6c4de401119aff17d34")]
[assembly: System.Reflection.AssemblyProductAttribute("HmChatGPT35Turbo")]
[assembly: System.Reflection.AssemblyTitleAttribute("HmChatGPT35Turbo")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.7.3")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ae13e5e6d53e5c5836b7e539980c8da537878a8ec5e48f6c09e3ef8365002aa1
a3e8adf808ea1cf1725c8a03fc548516154945af868b8c07c526609451c9d82e
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"privateAssets": "none"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.202\\RuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.204\\RuntimeIdentifierGraph.json"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyCopyrightAttribute("Akitsugu Komiyama")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.7.3")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.7.3+395563fea4ad6007f6a9b74bac5b0f9382e4b21a")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.7.3+d10c09f6ba523a7b1248d6c4de401119aff17d34")]
[assembly: System.Reflection.AssemblyProductAttribute("HmChatGPT35Turbo")]
[assembly: System.Reflection.AssemblyTitleAttribute("HmChatGPT35Turbo")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.7.3")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b9691618c4fab151107a936bf5319ebfbbb43108c3ad256a1b39ddf5d9803c58
10fc05b6830ce02775ffa9ec7042eb2c2053f09f8343928cae7d6da666727500
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5e47ab532af06c9c356650ad19260f88b085dfb3897ccb19d0cced35ab0c7b4a
ccf936c40a85af387a7dddc6474bfefff72f71166809514ae96c797d2982598f
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion src/HmChatGPT35Turbo/obj/project.assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@
"privateAssets": "none"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.202\\RuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.204\\RuntimeIdentifierGraph.json"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/HmChatGPT35Turbo/obj/project.nuget.cache
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": 2,
"dgSpecHash": "n57OC6+UC1T2jwzI0+nrdFr2Hnl7joih7R2dwv+/P04PV1L8GXrzQwG5eeKZjiZlj0aKrV4XqcKuc7vqbtE3VA==",
"dgSpecHash": "9OxMGYj82xGEObcNoaoA7N7nUWo9hgO8ismd7bxT/7aHkx6Lgka8DTp3Ss1jOp+UbK6pukpfljGyLChRb1t3PQ==",
"success": true,
"projectFilePath": "G:\\repogitory\\hm_openai_chatgpt35_turbo\\src\\HmChatGPT35Turbo\\HmChatGPT35Turbo.csproj",
"expectedPackageFiles": [
Expand Down

0 comments on commit ec7f85e

Please sign in to comment.