Commit bb77b90
fix: resolve OpenAI backend compatibility issues and build failures
This commit addresses multiple critical issues preventing proper OpenAI integration:
**Build Issues Fixed:**
- Update `github.com/ebitengine/purego` from v0.8.2 to v0.8.4
- Resolves duplicate symbol linker errors (dlopen conflicts) on Intel macOS
- Enables successful compilation of wavesrv backend server
**API Compatibility Improvements:**
- Filter out "error" role messages in convertPrompt() function
- Prevents "400 Bad Request: user and assistant roles should be alternating" errors
- Ensures clean message flow to OpenAI API endpoints
**Enhanced Model Support:**
- Extend o1-model handling to include newer model families
- Add support for gpt-4.1+, o4+, and o3+ model series
- Use max_completion_tokens parameter for reasoning models instead of max_tokens
- Maintain backward compatibility with existing model configurations
**Technical Details:**
- Error role filtering prevents API rejection due to invalid role types
- Non-streaming API usage for reasoning models improves response quality
- Dependency update resolves CGO compilation conflicts on multiple architectures
**Testing:**
- Verified successful wavesrv compilation on darwin/x64
- Confirmed OpenAI API calls complete without 400/401 errors
- Tested with multiple model configurations (gpt-4o, gpt-4o-mini)
Fixes build failures and API integration issues reported in development environment.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>1 parent 0d339af commit bb77b90
3 files changed
+12
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
64 | | - | |
| 63 | + | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
58 | 62 | | |
59 | 63 | | |
60 | 64 | | |
| |||
106 | 110 | | |
107 | 111 | | |
108 | 112 | | |
109 | | - | |
110 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
111 | 118 | | |
112 | 119 | | |
113 | 120 | | |
| |||
0 commit comments