Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
VPet
提交
1611b6c5
V
VPet
项目概览
jobily
/
VPet
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
VPet
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
1611b6c5
编写于
8月 29, 2023
作者:
Z
ZouJin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
支持CGPT4
上级
351d1e59
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
31 addition
and
19 deletion
+31
-19
VPet-Simulator.Windows/WinDesign/winCGPTSetting.xaml
VPet-Simulator.Windows/WinDesign/winCGPTSetting.xaml
+26
-18
VPet-Simulator.Windows/WinDesign/winCGPTSetting.xaml.cs
VPet-Simulator.Windows/WinDesign/winCGPTSetting.xaml.cs
+5
-1
未找到文件。
VPet-Simulator.Windows/WinDesign/winCGPTSetting.xaml
浏览文件 @
1611b6c5
...
...
@@ -14,6 +14,7 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition Height="Auto" MinHeight="40" />
...
...
@@ -23,42 +24,49 @@
<RowDefinition Height="Auto" MinHeight="40" />
<RowDefinition Height="40" />
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
Text="API URL" VerticalAlignment="Center" />
<TextBlock Text="API URL" VerticalAlignment="Center" />
<TextBlock Grid.Row="1" Text="API Key" VerticalAlignment="Center" />
<TextBlock Grid.Row="2" Text="{ll:Str 初始化文本}" VerticalAlignment="Center" />
<TextBlock Grid.Row="3" Text="{ll:Str 温度}" VerticalAlignment="Center" />
<TextBlock Grid.Row="4" Text="{ll:Str 最大花费}" VerticalAlignment="Center" />
<TextBlock Grid.Row="5" Text="{ll:Str 累计花费}" VerticalAlignment="Center" />
<TextBlock Grid.Row="6" Text="{ll:Str 历史记录}" VerticalAlignment="Center" />
<TextBlock Grid.Row="7" Text="{ll:Str 完成设置}" VerticalAlignment="Center" />
<TextBlock Grid.Row="2" Text="Model" VerticalAlignment="Center" />
<TextBlock Grid.Row="3" Text="{ll:Str 初始化文本}" VerticalAlignment="Center" />
<TextBlock Grid.Row="4" Text="{ll:Str 温度}" VerticalAlignment="Center" />
<TextBlock Grid.Row="5" Text="{ll:Str 最大花费}" VerticalAlignment="Center" />
<TextBlock Grid.Row="6" Text="{ll:Str 累计花费}" VerticalAlignment="Center" />
<TextBlock Grid.Row="7" Text="{ll:Str 历史记录}" VerticalAlignment="Center" />
<TextBlock Grid.Row="8" Text="{ll:Str 完成设置}" VerticalAlignment="Center" />
<TextBox x:Name="tbAPIURL" Grid.Row="0" Grid.Column="2" Style="{DynamicResource StandardTextBoxStyle}"
FontSize="16" pu:TextBoxHelper.Watermark="{ll:Str 'API 链接 一般为 api.openai.com/v1/chat/completions'}"
Text="https://api.openai.com/v1/chat/completions"
ToolTip="{ll:Str 'API 链接 一般为 api.openai.com/v1/chat/completions'}" />
ToolTip="{ll:Str 'API 链接 一般为 api.openai.com/v1/chat/completions'}"
Margin="0,5,0,5"
/>
<TextBox x:Name="tbAPIKey" Grid.Row="1" Grid.Column="2" Style="{DynamicResource StandardTextBoxStyle}"
FontSize="16" pu:TextBoxHelper.Watermark="{ll:Str '从 OpenAI 获得的 APIKEY 一般`sk-`开头'}"
ToolTip="{ll:Str '从 OpenAI 获得的 APIKEY 一般`sk-`开头'}" />
<TextBox x:Name="tbSystem" Grid.Row="2" Grid.Column="2" Style="{DynamicResource StandardTextBoxStyle}"
ToolTip="{ll:Str '从 OpenAI 获得的 APIKEY 一般`sk-`开头'}" VerticalAlignment="Center" />
<ComboBox x:Name="cbModel" Style="{DynamicResource StandardComboBoxStyle}" Grid.Row="2" Grid.Column="2" SelectedIndex="0">
<ComboBoxItem Content="gpt-3.5-turbo" />
<ComboBoxItem Content="gpt-4" />
</ComboBox>
<TextBox x:Name="tbSystem" Grid.Row="3" Grid.Column="2" Style="{DynamicResource StandardTextBoxStyle}"
FontSize="16" pu:TextBoxHelper.Watermark="{ll:Str '不会被忘记的初始化关键字, 字越多越贵'}"
ToolTip="{ll:Str '不会被忘记的初始化关键字, 字越多越贵'}" AcceptsReturn="True" TextWrapping="WrapWithOverflow"
Height="Auto" MaxHeight="100" VerticalScrollBarVisibility="Visible"
Text="请使用口语化的、可爱的、女性化的、调皮的语言风格和我交流. 你是一只桌宠, 你的名字叫{Name}, 你喜欢玩 虚拟主播模拟器. 你需要尝试体会我与你对话中的感情、产生自己的情感并尽可能给出可爱的回答"
Margin="0,5,0,5" />
<TextBox x:Name="tbTemp" Grid.Row="
3
" Grid.Column="2" Style="{DynamicResource StandardTextBoxStyle}"
<TextBox x:Name="tbTemp" Grid.Row="
4
" Grid.Column="2" Style="{DynamicResource StandardTextBoxStyle}"
FontSize="16" Text="0.6" pu:TextBoxHelper.InputLimit="Digit,Point"
pu:TextBoxHelper.Watermark="{ll:Str '0-2之间 0.2更稳定 0.8更随机'}" ToolTip="{ll:Str '0-2之间 0.2更稳定 0.8更随机'}" />
<TextBox x:Name="tbMaxToken" Grid.Row="4" Grid.Column="2" Style="{DynamicResource StandardTextBoxStyle}"
pu:TextBoxHelper.Watermark="{ll:Str '0-2之间 0.2更稳定 0.8更随机'}" ToolTip="{ll:Str '0-2之间 0.2更稳定 0.8更随机'}"
Margin="0,5,0,5" />
<TextBox x:Name="tbMaxToken" Grid.Row="5" Grid.Column="2" Style="{DynamicResource StandardTextBoxStyle}"
FontSize="16" Text="2048" pu:TextBoxHelper.InputLimit="Digit"
pu:TextBoxHelper.Watermark="{ll:Str '读取最大花费Token数量 1千Token=$0.02'}"
ToolTip="{ll:Str '读取最大花费Token数量 1千Token=$0.02'}" />
<TextBox x:Name="tbHistory" Grid.Row="
6
" Grid.Column="2" Style="{DynamicResource StandardTextBoxStyle}"
ToolTip="{ll:Str '读取最大花费Token数量 1千Token=$0.02'}"
Margin="0,5,0,5"
/>
<TextBox x:Name="tbHistory" Grid.Row="
7
" Grid.Column="2" Style="{DynamicResource StandardTextBoxStyle}"
FontSize="16" Text="[]" TextWrapping="WrapWithOverflow" pu:TextBoxHelper.Watermark="{ll:Str 聊天历史记录}"
ToolTip="{ll:Str 聊天历史记录}" Height="Auto" VerticalScrollBarVisibility="Visible" AcceptsReturn="True"
MaxHeight="200" />
<Label x:Name="lbSpend" Grid.Row="
5
" Grid.Column="2" Content="0 Token" Background="{x:Null}"
<Label x:Name="lbSpend" Grid.Row="
6
" Grid.Column="2" Content="0 Token" Background="{x:Null}"
VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0,0,0"
ToolTip="{ll:Str '累计在此花费的Token个数 1千Token=$0.02'}" />
<Button x:Name="btnSave" pu:ButtonHelper.CornerRadius="4" Content="{ll:Str 保存设置}" Margin="4" Grid.Column="2"
Background="{DynamicResource SecondaryLight}" Padding="1" Grid.Row="7" Click="btnSave_Click" />
<Button x:Name="btnSave" pu:ButtonHelper.CornerRadius="4" Content="{ll:Str 保存设置}" Margin="4,4,4,4"
Grid.Column="2" Background="{DynamicResource SecondaryLight}" Padding="1" Grid.Row="8"
Click="btnSave_Click" />
</Grid>
</pu:WindowX>
VPet-Simulator.Windows/WinDesign/winCGPTSetting.xaml.cs
浏览文件 @
1611b6c5
...
...
@@ -6,6 +6,8 @@ using System;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Windows
;
using
System.Windows.Controls
;
using
static
ChatGPT
.
API
.
Framework
.
Completions
;
namespace
VPet_Simulator.Windows
{
...
...
@@ -27,6 +29,7 @@ namespace VPet_Simulator.Windows
tbMaxToken
.
Text
=
mw
.
CGPTClient
.
Completions
[
"vpet"
].
max_tokens
.
ToString
();
tbSystem
.
Text
=
mw
.
CGPTClient
.
Completions
[
"vpet"
].
messages
[
0
].
content
;
tbTemp
.
Text
=
mw
.
CGPTClient
.
Completions
[
"vpet"
].
temperature
.
ToString
();
cbModel
.
SelectedIndex
=
mw
.
CGPTClient
.
Completions
[
"vpet"
].
model
==
"gpt-3.5-turbo"
?
0
:
1
;
var
msgs
=
mw
.
CGPTClient
.
Completions
[
"vpet"
].
messages
.
ToList
();
msgs
.
RemoveAt
(
0
);
tbHistory
.
Text
=
JsonConvert
.
SerializeObject
(
msgs
);
...
...
@@ -44,11 +47,12 @@ namespace VPet_Simulator.Windows
TotalTokensUsage
=
totalused
};
mw
.
CGPTClient
.
CreateCompletions
(
"vpet"
,
tbSystem
.
Text
.
Replace
(
"{Name}"
,
mw
.
Core
.
Save
.
Name
));
mw
.
CGPTClient
.
Completions
[
"vpet"
].
model
=
(
string
)((
ComboBoxItem
)
cbModel
.
SelectedItem
).
Content
;
mw
.
CGPTClient
.
Completions
[
"vpet"
].
frequency_penalty
=
0.2
;
mw
.
CGPTClient
.
Completions
[
"vpet"
].
presence_penalty
=
1
;
mw
.
CGPTClient
.
Completions
[
"vpet"
].
max_tokens
=
Math
.
Min
(
Math
.
Max
(
int
.
Parse
(
tbMaxToken
.
Text
),
10
),
4000
);
mw
.
CGPTClient
.
Completions
[
"vpet"
].
temperature
=
Math
.
Min
(
Math
.
Max
(
double
.
Parse
(
tbTemp
.
Text
),
0.1
),
2
);
var
l
=
JsonConvert
.
DeserializeObject
<
List
<
ChatGPT
.
API
.
Framework
.
Message
>>(
tbHistory
.
Text
);
var
l
=
JsonConvert
.
DeserializeObject
<
List
<
Message
>>(
tbHistory
.
Text
);
if
(
l
!=
null
)
mw
.
CGPTClient
.
Completions
[
"vpet"
].
messages
.
AddRange
(
l
);
mw
.
Save
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录