mirror of
https://github.com/mudler/LocalAI.git
synced 2026-11-06 12:33:16 -05:00
No release carried add-ons, so nothing reads older add-on data or manifests. Delete the code that did. - Connectors: the kind and the add-on of the Telegram connectors that core once carried are gone (LegacyAddon, KindTelegram, the stored binding normalization, the platform titles). A binding needs a kind, and its add-on is the one that serves the kind. The conversion of the old agent pool lists every connector as dropped instead of making a Telegram binding, and its notes say so. - The library index reads only the id field of an entry, not addonId. - A host control that has a capability block (the network policy) is attached by that block alone, not by a tool that replaces bash. - The Office create tools no longer answer for the argument names of an earlier schema, and the identity file note about old addresses is gone. - The known debt of the provider-name guard drops the entries of the conversion and of the resource listing shim, and its ceiling goes from 13 to 5. Assisted-by: Claude:claude-sonnet-5-5 go test
49 lines
1.9 KiB
Go
49 lines
1.9 KiB
Go
package studio
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/labstack/echo/v4"
|
|
|
|
"github.com/mudler/LocalAI/core/schema"
|
|
"github.com/mudler/LocalAI/core/services/studio/convert"
|
|
)
|
|
|
|
func totalsOf(r convert.Report) schema.ChatsConversionTotals {
|
|
c := r.Counts()
|
|
return schema.ChatsConversionTotals{Converted: c[convert.StatusConverted], Skipped: c[convert.StatusSkipped],
|
|
Failed: c[convert.StatusFailed], Dropped: c[convert.StatusDropped]}
|
|
}
|
|
|
|
// Conversion returns what the conversion of the old data did for the caller.
|
|
// @Summary Report the conversion of your old agents, skills and chats.
|
|
// @Description At start the server converts the old chat page, agents, tasks, skills and connectors into chats, saved agents, triggers and skills. Triggers are made switched off; connectors are listed as dropped and are made again in the Connectors page. This lists the items that belong to you, with what was dropped and why; an administrator also gets the totals of all users. It never holds a token or the text of a prompt.
|
|
// @Tags chats
|
|
// @Success 200 {object} schema.ChatsConversion "The report"
|
|
// @Router /api/chats/conversion [get]
|
|
func (h *Handlers) Conversion(c echo.Context) error {
|
|
rep, ok, err := h.svc.Conversion(c.Request().Context())
|
|
if err != nil {
|
|
return failFor(c, err)
|
|
}
|
|
out := schema.ChatsConversion{Done: ok, Items: []schema.ChatsConversionItem{}}
|
|
if ok {
|
|
own := rep.ForUser(userID(c))
|
|
if isAdmin(c) && userID(c) != "" {
|
|
// What had no owner when accounts were switched on belongs to nobody
|
|
// who could read it: the administrator gets it.
|
|
own.Items = append(own.Items, rep.ForUser("").Items...)
|
|
}
|
|
out.At = &rep.At
|
|
out.Counts = totalsOf(own)
|
|
for _, i := range own.Items {
|
|
out.Items = append(out.Items, schema.ChatsConversionItem{Kind: i.Kind, Name: i.Name, Status: i.Status, Reason: i.Reason})
|
|
}
|
|
if isAdmin(c) {
|
|
t := totalsOf(rep)
|
|
out.Totals = &t
|
|
}
|
|
}
|
|
return c.JSON(http.StatusOK, out)
|
|
}
|