aaa
Some checks failed
Flask 提示词大师 - CI/CD 流水线 / 代码质量检查 (push) Has been cancelled
Flask 提示词大师 - CI/CD 流水线 / 单元测试 (push) Has been cancelled
Flask 提示词大师 - CI/CD 流水线 / 集成测试 (push) Has been cancelled
Flask 提示词大师 - CI/CD 流水线 / 构建Docker镜像 (push) Has been cancelled
Flask 提示词大师 - CI/CD 流水线 / 部署到测试环境 (push) Has been cancelled
Flask 提示词大师 - CI/CD 流水线 / 部署到生产环境 (push) Has been cancelled
Flask 提示词大师 - CI/CD 流水线 / 部署监控系统 (push) Has been cancelled
Some checks failed
Flask 提示词大师 - CI/CD 流水线 / 代码质量检查 (push) Has been cancelled
Flask 提示词大师 - CI/CD 流水线 / 单元测试 (push) Has been cancelled
Flask 提示词大师 - CI/CD 流水线 / 集成测试 (push) Has been cancelled
Flask 提示词大师 - CI/CD 流水线 / 构建Docker镜像 (push) Has been cancelled
Flask 提示词大师 - CI/CD 流水线 / 部署到测试环境 (push) Has been cancelled
Flask 提示词大师 - CI/CD 流水线 / 部署到生产环境 (push) Has been cancelled
Flask 提示词大师 - CI/CD 流水线 / 部署监控系统 (push) Has been cancelled
This commit is contained in:
@@ -4,6 +4,7 @@ import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ProgressBar;
|
||||
@@ -29,6 +30,8 @@ import retrofit2.Response;
|
||||
*/
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private static final String TAG = "MainActivity";
|
||||
|
||||
private EditText etInput;
|
||||
private MaterialButton btnGenerate;
|
||||
private ProgressBar progressBar;
|
||||
@@ -90,12 +93,15 @@ public class MainActivity extends AppCompatActivity {
|
||||
if (body.getCode() == 200 && body.getData() != null) {
|
||||
showResult(body);
|
||||
} else {
|
||||
Toast.makeText(MainActivity.this,
|
||||
body.getMessage() != null ? body.getMessage() : getString(R.string.error_network),
|
||||
Toast.LENGTH_LONG).show();
|
||||
String msg = body.getMessage() != null ? body.getMessage() : getString(R.string.error_network);
|
||||
Log.w(TAG, "API 业务错误: code=" + body.getCode() + ", message=" + msg);
|
||||
Toast.makeText(MainActivity.this, msg, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(MainActivity.this, R.string.error_network, Toast.LENGTH_LONG).show();
|
||||
String err = "HTTP " + response.code() + (response.errorBody() != null ? ": " + response.message() : "");
|
||||
Log.e(TAG, "API 请求失败: " + err);
|
||||
Toast.makeText(MainActivity.this, getString(R.string.error_network) + " " + err,
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +111,9 @@ public class MainActivity extends AppCompatActivity {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
tvLoading.setVisibility(View.GONE);
|
||||
btnGenerate.setEnabled(true);
|
||||
Toast.makeText(MainActivity.this, R.string.error_network + ": " + t.getMessage(),
|
||||
String detail = t != null ? t.getMessage() : "unknown";
|
||||
Log.e(TAG, "网络请求失败: " + detail, t);
|
||||
Toast.makeText(MainActivity.this, getString(R.string.error_network) + ": " + detail,
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class RetrofitClient {
|
||||
|
||||
private static final String BASE_URL = "http://101.43.95.130:5002/";
|
||||
private static final String BASE_URL = BuildConfig.BASE_URL;
|
||||
|
||||
private static Retrofit retrofit;
|
||||
private static ExpertGenerate3Api api;
|
||||
|
||||
Reference in New Issue
Block a user