>>108312297
>I wrote my own client but it's terminal only
I did the same thing, that's why I speak from experience in building abstractions.
in pseudo code and very simplified I build shit this way:
if url.includes("/responses")
adapter = new RAdapter()
if url.includes("/chat/completions")
adapter = new CCAdapter()
function run(messages, overrides) {
payload = adapter.ploadbuilder(messages, overrides)
connection = await post(payload)
for chunk of connection
output(parseSSE(chunk, adapter.parser))
}
where parseSSE initializes timeout controllers, calls out to the real parser passed with the adapter strategy etc
can't fucking imagine managing this sort of copy paste mess when you can compartmentalize properly and handle special cases through overrides
recently implemented the obsolete completion endpoint for the lulz, all I had to do was flatten the message array in the adapter payload builder and add model specific templates in my presets processors, which already supported templates for other purposes (like replacing {{sourcelanguage}} etc for batching translation)
proper abstraction make it really easy to add and change functionality.