mirror of
https://github.com/jie65535/JChatGPT.git
synced 2025-12-08 18:31:36 +08:00
Update Jina to allow trial usage without a key
This commit is contained in:
@@ -41,7 +41,7 @@ class VisitWeb : BaseAgent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override val isEnabled: Boolean
|
override val isEnabled: Boolean
|
||||||
get() = PluginConfig.jinaApiKey.isNotEmpty()
|
get() = true // PluginConfig.jinaApiKey.isNotEmpty()
|
||||||
|
|
||||||
override val loadingMessage: String
|
override val loadingMessage: String
|
||||||
get() = "上网中..."
|
get() = "上网中..."
|
||||||
@@ -62,7 +62,9 @@ class VisitWeb : BaseAgent(
|
|||||||
private suspend fun jinaReadPage(url: String): String {
|
private suspend fun jinaReadPage(url: String): String {
|
||||||
return try {
|
return try {
|
||||||
httpClient.get(JINA_READER_URL_PREFIX + url) {
|
httpClient.get(JINA_READER_URL_PREFIX + url) {
|
||||||
header("Authorization", "Bearer ${PluginConfig.jinaApiKey}")
|
if (PluginConfig.jinaApiKey.isNotEmpty()) {
|
||||||
|
header("Authorization", "Bearer ${PluginConfig.jinaApiKey}")
|
||||||
|
}
|
||||||
}.bodyAsText()
|
}.bodyAsText()
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
"Error fetching \"$url\": ${e.message}"
|
"Error fetching \"$url\": ${e.message}"
|
||||||
|
|||||||
Reference in New Issue
Block a user