更新了编辑配置文件的时候,模型类型名称没有跟上的bug
This commit is contained in:
@@ -178,6 +178,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
// 模拟可能出现异常的网络操作,这里需要替换为你的实际网络请求相关代码
|
// 模拟可能出现异常的网络操作,这里需要替换为你的实际网络请求相关代码
|
||||||
// 比如使用 OkHttp 或者其他网络库进行请求
|
// 比如使用 OkHttp 或者其他网络库进行请求
|
||||||
val response = withContext(Dispatchers.IO) {
|
val response = withContext(Dispatchers.IO) {
|
||||||
|
statusText.text = "发起请求"
|
||||||
client.newCall(request).execute()
|
client.newCall(request).execute()
|
||||||
}
|
}
|
||||||
if (response.isSuccessful) {
|
if (response.isSuccessful) {
|
||||||
@@ -236,8 +237,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
// 获取 EditText 中的文本内容,创建request的body
|
// 获取 EditText 中的文本内容,创建request的body
|
||||||
val textFromEditText = inputEditText.text.toString()
|
val textFromEditText = inputEditText.text.toString()
|
||||||
val combinedText =
|
val combinedText =
|
||||||
"$textFromEditText。请为以上文章分析并给出 4 个最合理的标签,没有其他内容。以 JSON 格式输出,格式为 labels: [标签 1, 标签 2, 标签 3, 标签 4]"
|
"$textFromEditText。如果是英文文章则先翻译成中文,并为以上文章分析并给出 4 个最合理的标签,没有其他内容。以 JSON 格式输出,格式为 labels: [标签 1, 标签 2, 标签 3, 标签 4]"
|
||||||
|
|
||||||
|
|
||||||
// 从配置中读取 api_key
|
// 从配置中读取 api_key
|
||||||
val sharedPrefs = getSharedPreferences("APIConfigs", MODE_PRIVATE)
|
val sharedPrefs = getSharedPreferences("APIConfigs", MODE_PRIVATE)
|
||||||
@@ -286,6 +286,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
// 模拟可能出现异常的网络操作,这里需要替换为你的实际网络请求相关代码
|
// 模拟可能出现异常的网络操作,这里需要替换为你的实际网络请求相关代码
|
||||||
// 比如使用 OkHttp 或者其他网络库进行请求
|
// 比如使用 OkHttp 或者其他网络库进行请求
|
||||||
val response = withContext(Dispatchers.IO) {
|
val response = withContext(Dispatchers.IO) {
|
||||||
|
statusText.text = "提交请求"
|
||||||
client.newCall(request).execute()
|
client.newCall(request).execute()
|
||||||
}
|
}
|
||||||
if (response.isSuccessful) {
|
if (response.isSuccessful) {
|
||||||
|
|||||||
@@ -130,7 +130,6 @@ class SecondActivity : AppCompatActivity() {
|
|||||||
tvName.text = "Name: ${config.name}"
|
tvName.text = "Name: ${config.name}"
|
||||||
tvName.setTextColor(Color.BLACK)
|
tvName.setTextColor(Color.BLACK)
|
||||||
|
|
||||||
|
|
||||||
// 获取并设置 URL 的 TextView 前景色和背景色
|
// 获取并设置 URL 的 TextView 前景色和背景色
|
||||||
val tvUrl = configView.findViewById<TextView>(R.id.tvUrl)
|
val tvUrl = configView.findViewById<TextView>(R.id.tvUrl)
|
||||||
tvUrl.text = "URL: ${config.url}"
|
tvUrl.text = "URL: ${config.url}"
|
||||||
@@ -172,6 +171,7 @@ class SecondActivity : AppCompatActivity() {
|
|||||||
etApiUrl.setText(config.url)
|
etApiUrl.setText(config.url)
|
||||||
etApiKey.setText(config.key)
|
etApiKey.setText(config.key)
|
||||||
etApiSecretKey.setText(config.secretKey)
|
etApiSecretKey.setText(config.secretKey)
|
||||||
|
etApiModel.setText(config.model)
|
||||||
// 设置编辑状态
|
// 设置编辑状态
|
||||||
editingId = config.id
|
editingId = config.id
|
||||||
btnSave.text = "更新配置"
|
btnSave.text = "更新配置"
|
||||||
|
|||||||
Reference in New Issue
Block a user