Skip to content

Commit 08441df

Browse files
cryptaxradare
authored andcommitted
support r2ai.host having port specified
1 parent 20fb48c commit 08441df

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/r2ai.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -785,11 +785,15 @@ R_IPI const char *r2ai_get_provider_url(RCore *core, const char *provider) {
785785
return "https://generativelanguage.googleapis.com/v1beta/openai";
786786
} else if (strcmp (provider, "ollama") == 0) {
787787
if (R_STR_ISNOTEMPTY (host)) {
788-
int port = r_config_get_i (core->config, "r2ai.port");
789-
if (r_str_startswith (host, "http")) {
790-
return r_str_newf("%s:%d/api", host, port);
788+
if (strchr (host, ':')) {
789+
return r_str_newf ("%s/api", host);
790+
} else {
791+
int port = r_config_get_i (core->config, "r2ai.port");
792+
if (r_str_startswith (host, "http")) {
793+
return r_str_newf("%s:%d/api", host, port);
794+
}
795+
return r_str_newf ("http://%s:%d/api", host, port);
791796
}
792-
return r_str_newf ("http://%s:%d/api", host, port);
793797
}
794798
return "http://localhost:11434/api";
795799
} else if (strcmp (provider, "xai") == 0) {

0 commit comments

Comments
 (0)