You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// gemini only uses the last breakpoint for caching, so the others will be ignored
81
+
openAiMessages[0]={
82
+
role: "system",
83
+
content: [
84
+
{
85
+
type: "text",
86
+
text: systemPrompt,
87
+
// @ts-ignore-next-line
88
+
cache_control: {type: "ephemeral"},
89
+
},
90
+
],
91
+
}
90
92
91
-
// for safety, but this should always be the case
92
-
if(openAiMessages.length>=2){
93
-
constmsg=openAiMessages[1]
93
+
// for safety, but this should always be the case
94
+
if(openAiMessages.length>=2){
95
+
constmsg=openAiMessages[1]
94
96
95
-
if(msg){
96
-
if(typeofmsg.content==="string"){
97
-
msg.content=[{type: "text",text: msg.content}]
98
-
}
99
-
if(Array.isArray(msg.content)){
100
-
// NOTE: this is fine since env details will always be added at the end. but if it weren't there, and the user added a image_url type message, it would pop a text part before it and then move it after to the end.
// NOTE: this is fine since env details will always be added at the end. but if it weren't there, and the user added a image_url type message, it would pop a text part before it and then move it after to the end.
// NOTE: this is fine since env details will always be added at the end. but if it weren't there, and the user added a image_url type message, it would pop a text part before it and then move it after to the end.
131
-
let lastTextPart = msg.content.filter((part) => part.type === "text").pop()
// NOTE: this is fine since env details will always be added at the end. but if it weren't there, and the user added a image_url type message, it would pop a text part before it and then move it after to the end.
133
+
let lastTextPart = msg.content.filter((part) => part.type === "text").pop()
// Not sure how openrouter defaults max tokens when no value is provided, but the anthropic api requires this value and since they offer both 4096 and 8192 variants, we should ensure 8192.
0 commit comments