diff options
| author | Grail Finder <wohilas@gmail.com> | 2026-02-06 11:32:06 +0300 |
|---|---|---|
| committer | Grail Finder <wohilas@gmail.com> | 2026-02-06 11:32:06 +0300 |
| commit | 478a505869bf26b15dcbc77feb2c09c1f2ff4aac (patch) | |
| tree | 8103c459a1db2e202f9ea1acc80c2d982b1b7ff1 /llm.go | |
| parent | d0722c6f98aa4755f271aefdd8af1cca28fb6f35 (diff) | |
Enha: client stop string for completion only
Diffstat (limited to 'llm.go')
| -rw-r--r-- | llm.go | 27 |
1 files changed, 26 insertions, 1 deletions
@@ -78,6 +78,7 @@ type ChunkParser interface { ParseChunk([]byte) (*models.TextChunk, error) FormMsg(msg, role string, cont bool) (io.Reader, error) GetToken() string + GetAPIType() models.APIType } func choseChunkParser() { @@ -127,6 +128,10 @@ type OpenRouterChat struct { Model string } +func (lcp LCPCompletion) GetAPIType() models.APIType { + return models.APITypeCompletion +} + func (lcp LCPCompletion) GetToken() string { return "" } @@ -233,7 +238,11 @@ func (lcp LCPCompletion) ParseChunk(data []byte) (*models.TextChunk, error) { return resp, nil } -func (op LCPChat) GetToken() string { +func (lcp LCPChat) GetAPIType() models.APIType { + return models.APITypeChat +} + +func (lcp LCPChat) GetToken() string { return "" } @@ -371,6 +380,10 @@ func (op LCPChat) FormMsg(msg, role string, resume bool) (io.Reader, error) { } // deepseek +func (ds DeepSeekerCompletion) GetAPIType() models.APIType { + return models.APITypeCompletion +} + func (ds DeepSeekerCompletion) ParseChunk(data []byte) (*models.TextChunk, error) { llmchunk := models.DSCompletionResp{} if err := json.Unmarshal(data, &llmchunk); err != nil { @@ -453,6 +466,10 @@ func (ds DeepSeekerCompletion) FormMsg(msg, role string, resume bool) (io.Reader return bytes.NewReader(data), nil } +func (ds DeepSeekerChat) GetAPIType() models.APIType { + return models.APITypeChat +} + func (ds DeepSeekerChat) ParseChunk(data []byte) (*models.TextChunk, error) { llmchunk := models.DSChatStreamResp{} if err := json.Unmarshal(data, &llmchunk); err != nil { @@ -539,6 +556,10 @@ func (ds DeepSeekerChat) FormMsg(msg, role string, resume bool) (io.Reader, erro } // openrouter +func (or OpenRouterCompletion) GetAPIType() models.APIType { + return models.APITypeCompletion +} + func (or OpenRouterCompletion) ParseChunk(data []byte) (*models.TextChunk, error) { llmchunk := models.OpenRouterCompletionResp{} if err := json.Unmarshal(data, &llmchunk); err != nil { @@ -618,6 +639,10 @@ func (or OpenRouterCompletion) FormMsg(msg, role string, resume bool) (io.Reader } // chat +func (or OpenRouterChat) GetAPIType() models.APIType { + return models.APITypeChat +} + func (or OpenRouterChat) ParseChunk(data []byte) (*models.TextChunk, error) { llmchunk := models.OpenRouterChatResp{} if err := json.Unmarshal(data, &llmchunk); err != nil { |
