on main help sign in
fix: handle OpenAI compat type correctly in TestConnection
7d14abbKujtim Hoxha
internal/agent/agent.go+10
@@ -430,6 +430,16 @@ func (a *sessionAgent) Run(ctx context.Context, call SessionAgentCall) (*fantasy
430 if summarizeErr := a.Summarize(genCtx, call.SessionID, call.ProviderOptions); summarizeErr != nil {
430 if summarizeErr := a.Summarize(genCtx, call.SessionID, call.ProviderOptions); summarizeErr != nil {
431 return nil, summarizeErr
431 return nil, summarizeErr
432 }
432 }
433+ // if the agent was not done...
434+ if len(currentAssistant.ToolCalls()) > 0 {
435+ existing, ok := a.messageQueue.Get(call.SessionID)
436+ if !ok {
437+ existing = []SessionAgentCall{}
438+ }
439+ call.Prompt = fmt.Sprintf("The previous session was interrupted because it got too long, the initial user request was: `%s`", call.Prompt)
440+ existing = append(existing, call)
441+ a.messageQueue.Set(call.SessionID, existing)
442+ }
433 }
443 }
434
444
435 // release active request before processing queued messages
445 // release active request before processing queued messages
internal/agent/templates/summary.md+5−1
@@ -10,4 +10,8 @@ Focus on information that would be helpful for continuing the conversation, incl
10- Any context that would be needed to continue working on the task
10- Any context that would be needed to continue working on the task
11- What needs to be done next
11- What needs to be done next
12
12
13−Your summary should be comprehensive enough to provide context but concise enough to be quickly understood.
13+Your summary should be comprehensive enough to provide context to be quickly understood.
14+
15+It is very important to keep context of files that are important and strategy you are following.
16+
17+It is very important to have the next steps clearly defined.
internal/config/config.go+1−1
@@ -542,7 +542,7 @@ func (c *ProviderConfig) TestConnection(resolver VariableResolver) error {
542 headers := make(map[string]string)
542 headers := make(map[string]string)
543 apiKey, _ := resolver.ResolveValue(c.APIKey)
543 apiKey, _ := resolver.ResolveValue(c.APIKey)
544 switch c.Type {
544 switch c.Type {
545− case catwalk.TypeOpenAI:
545+ case catwalk.TypeOpenAI, catwalk.TypeOpenAICompat:
546 baseURL, _ := resolver.ResolveValue(c.BaseURL)
546 baseURL, _ := resolver.ResolveValue(c.BaseURL)
547 if baseURL == "" {
547 if baseURL == "" {
548 baseURL = "https://api.openai.com/v1"
548 baseURL = "https://api.openai.com/v1"